Adds env to chart which is passed to the container, this allows the operator to mount a external secret as env to be used with the entrypoint script.
Adds idracConfigIsTemplate as a new bool in chart. This will control if idracConfig secret key is idrac.yml or idrac.yml.template.
Modify the entrypoint script to envsubst if IDRAC_USERNAME and IDRAC_PASSWORD is already exported in env, if not then continue with the logic added in PR 30.
Generate config to /app/config in entrypoint to tmpfs volume. /etc/prometheus is mounted readOnly and we don't want to store the templated config with any persistence.
# Starting with IDRAC_USERNAME and IDRAC_PASSWORD defined:
➜ ~ docker run -it --rm -e IDRAC_USERNAME=test -e IDRAC_PASSWORD=test2 docker.io/library/idrac_exporter
2024-04-25T14:31:07.342 INFO Build information: version=unknown revision=cc4a45ac19bf09cc21bf8f6f5e0dd86559458ba6
2024-04-25T14:31:07.342 INFO Server listening on 0.0.0.0:9348
# Starting without env-vars defined just like today:
➜ ~ docker run -it --rm docker.io/library/idrac_exporter
/etc/prometheus/idrac.yml not found _and_ /authconfig/ not found.
2024-04-25T14:31:15.275 FATAL Error opening configuration file /etc/prometheus/idrac.yml: open /etc/prometheus/idrac.yml: no such file or directory
As mentioned above /etc/prometheus is mounted readOnly and so is root filesystem, so to support the templating generating a config I opted for a Kubernetes emptyDir to hold the generated runtime config and included commented snippets for that in the values file.
Bumped appVersion to 1.2.2 so you'll have to tag a new release due to the edited entrypoint script.
Bumped chart version for the changes made to the chart templating.
The idea with the added support is both to add the necessary customization (passing envvars) to the container for the existing entrypoint.
My/our usecase is to sync the default credentials from Hashicorp Vault to a secret in the kubernetes cluster, then reference that secret -> env var -> idrac_exporter. These changes makes that possible.
https://github.com/mrlhansen/idrac_exporter/pull/30 added code without adding support to be compatible with the chart.
env
to chart which is passed to the container, this allows the operator to mount a external secret as env to be used with the entrypoint script.idracConfigIsTemplate
as a new bool in chart. This will control ifidracConfig
secret key isidrac.yml
oridrac.yml.template
.envsubst
if IDRAC_USERNAME and IDRAC_PASSWORD is already exported in env, if not then continue with the logic added in PR 30.As mentioned above /etc/prometheus is mounted
readOnly
and so is root filesystem, so to support the templating generating a config I opted for a Kubernetes emptyDir to hold the generated runtime config and included commented snippets for that in the values file.The idea with the added support is both to add the necessary customization (passing envvars) to the container for the existing entrypoint. My/our usecase is to sync the default credentials from Hashicorp Vault to a secret in the kubernetes cluster, then reference that secret -> env var -> idrac_exporter. These changes makes that possible.