Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm installation with sentinel cluster and broker-transport-option #234

Open
adursun1606 opened this issue Mar 23, 2023 · 7 comments
Open

Comments

@adursun1606
Copy link

Hello. I am gonna deploy celery-exporter by using helm. I have 3 nodes redis sentinel cluster. So how can apply CE_BROKER_URL for sentinel cluster, for one redis I just give the one IP but here no idea and also how can I apply "broker-transport-option master_name=my_master" for example. By using docker commands I can do it but how can apply these values with helm installation. For example should I use CE_BROKER_TRANSPORT_OPTION as an env in values yaml?

@danihodovic
Copy link
Owner

@adinhodovic helm expert

@ClementGautier
Copy link

Hi there 👋 I am trying to do the same thing but can't make it work. I used this values:

    env:
    - name: CE_BROKER_URL
      value: sentinel://redis-node-0.redis-headless.redis.svc.cluster.local:26379/0;sentinel://redis-node-1.redis-headless.redis.svc.cluster.local:26379/0;sentinel://redis-node-2.redis-headless.redis.svc.cluster.local:26379/0
    - name: CE_BROKER_TRANSPORT_OPTION
      value: 'master_name=default-master'
    - name: CE_LOG_LEVEL
      value: DEBUG

The config looks good, the exporter start as expected, cf the logs:

2023-05-31 14:15:34.116 | DEBUG    | src.exporter:run:255 - Setting celery broker_transport_option master_name=default-master
2023-05-31 14:15:34.138 | INFO     | src.http_server:start_http_server:66 - Started celery-exporter at host='0.0.0.0' on port='9808'

But I get no metrics exported on /metrics compared when I use the following (I deployed a small haproxy that target the redis leader)

    env:
    - name: CE_BROKER_URL
      value: redis://haproxy.redis.svc.cluster.local:6379/0

At this point I don't really know how to dig the issue, if someone have any idea I'm all ears

@gabohc
Copy link

gabohc commented May 18, 2024

Using the redis-sentinel bitnami chart, for me the following worked:

env:
- name: CE_BROKER_URL
  value: "sentinel://redis-sentinel.web.svc.cluster.local:26379"
- name: CE_BROKER_TRANSPORT_OPTION
  value: "master_name=redis-master"

I am able to see the metrics through the Grafana dashboards

@sebglon
Copy link

sebglon commented Sep 11, 2024

Work well with version 0.10.10 but not 0.10.7

@zqyong
Copy link

zqyong commented Dec 4, 2024

I have a question regarding Helm installation to connect to a Sentinel cluster as well, how would the equivalent helm values env look like for the example provided connection with docker? Is it possible to declare multiple --broker-transport-option through the env values for Helm chart installation? I am having difficulty passing in the password for the sentinel_kwargs.

docker run -p 9808:9808 danihodovic/celery-exporter --broker-url=sentinel://sentinel.service.consul/1 \
  --broker-transport-option master_name=my_master \
  --broker-transport-option sentinel_kwargs="{\"password\": \"sentinelpass\"}"

Helm values:

env:
- name: CE_BROKER_URL
  value: "sentinel://sentinel.service.consul/1"
- name: CE_BROKER_TRANSPORT_OPTION
  value: "master_name=my_master"
# how can --broker-transport-option sentinel_kwargs="{\"password\": \"sentinelpass\"}" be defined?

@danihodovic
Copy link
Owner

danihodovic commented Dec 4, 2024

@zqyong you can try cloning the project, starting the docker containers running the Python program to see how the --broker-transport-options translate to environment variables. I'm not sure myself.

git clone $PROJECT
cd celery-exporter
docker compose up -d redis
pip install
poetry install
CE_BROKER_TRANSPORT_OPTION=x python -m cli --broker-url redis://localhost:6379

@zqyong
Copy link

zqyong commented Dec 5, 2024

Yeah I poked around and found out how it can be done, to anyone trying to pass multiple broker_transport_option values through a single environment variable this can be done by:

env:
- name: CE_BROKER_URL
  value: "sentinel://sentinel.service.consul/1"
- name: CE_BROKER_TRANSPORT_OPTION
  value: "master_name=my_master"
- name: CE_BROKER_TRANSPORT_OPTION
  value: 'master_name=my_master sentinel_kwargs={"password":"sentinelpass"}'

the values are parsed by Click, and by default Click uses whitespace as a separator. Thank you @danihodovic for your quick reply and the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants