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

[prometheus-rabbitmq-exporter] allow passing an external ConfigMap to override env vars #3582

Conversation

davido912
Copy link
Contributor

@davido912 davido912 commented Jul 11, 2023

What this PR does / why we need it

Following #3574, I added a way to template the URL so that parent charts can template the URL into it without having to hardcode it. However, it appears subcharts don't read values from the parent chart.

Therefore, to allow for customisation of the envs vars, I moved all the env vars to a configmap and added the option to add an externally supplied configmap which will override whatever is in the first one.

According to the Kubernetes API reference, for envFrom:

"List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated."

So the last overriding configmap which was added here will override, whereas anything in env will override everything in envFrom. Therefore, when for the password, when a secret is supplied, env takes precedence.

I hope this was clear and would appreciate feedback. Couldn't think of a better way to give some control back to the user.

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

Signed-off-by: David Ohayon <david.ohayon@traderepublic.com>
@davido912
Copy link
Contributor Author

@monotek perhaps you can assist in getting this through or checking this out, given you checked the previous PR :)

davido912 and others added 3 commits July 18, 2023 14:43
Co-authored-by: MH <zanhsieh@gmail.com>
Signed-off-by: David O <48397009+davido912@users.noreply.github.com>
Co-authored-by: MH <zanhsieh@gmail.com>
Signed-off-by: David O <48397009+davido912@users.noreply.github.com>
@davido912 davido912 requested a review from zanhsieh July 18, 2023 12:53
@davido912
Copy link
Contributor Author

@zanhsieh applied the changes

@davido912
Copy link
Contributor Author

Apparently we're missing one more review (@desaintmartin / @Juanchimienti / @monotek ) 🙌

@monotek monotek merged commit 3b422ce into prometheus-community:main Jul 20, 2023
Matiasmct pushed a commit to giffgaff/prometheus-charts-backup that referenced this pull request Aug 25, 2023
… override env vars (prometheus-community#3582)

* enable supplying an external configmap to override rmq exporter configs

Signed-off-by: David Ohayon <david.ohayon@traderepublic.com>

* Update charts/prometheus-rabbitmq-exporter/templates/configmap.yaml

Co-authored-by: MH <zanhsieh@gmail.com>
Signed-off-by: David O <48397009+davido912@users.noreply.github.com>

* Update charts/prometheus-rabbitmq-exporter/templates/deployment.yaml

Co-authored-by: MH <zanhsieh@gmail.com>
Signed-off-by: David O <48397009+davido912@users.noreply.github.com>

---------

Signed-off-by: David Ohayon <david.ohayon@traderepublic.com>
Signed-off-by: David O <48397009+davido912@users.noreply.github.com>
Co-authored-by: MH <zanhsieh@gmail.com>
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

Successfully merging this pull request may close these issues.

3 participants