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

Add envfrom parameters #93

Closed
wants to merge 1 commit into from
Closed

Conversation

Elbandi
Copy link
Contributor

@Elbandi Elbandi commented May 22, 2024

What this PR does / why we need it:

Allow extra environment variables from secrets or configmaps.

(my usecase: added custom userparameters, which use some passwords. This password can set from secrets with env)

Special notes for your reviewer:

I hesitated the right variable name (envFrom vs extraEnvFrom). i checked some other helm charts, and more use envFrom names.
like traefik, filebeat (with extraEnvs and extraVolumes).

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • DCO signed
  • Chart Version bumped
  • Variables are documented in the README.md

@aeciopires
Copy link
Member

aeciopires commented May 26, 2024

Hey @Elbandi!
Thank you for your contribution.
But I think extraEnv can be refactored to add support for the same functionality as envFrom. This avoids confusion for users of helm charts.

What do you think? Could you make this change or can I make it?

The final solution is to change each template file:

before (example):

           {{- range $item := .Values.zabbixServer.extraEnv }}
            - name: {{ $item.name }}
              value: {{ $item.value | quote }}
            {{- end }}

after (example):

            {{- with .Values.zabbixServer.extraEnv }}
              {{- toYaml . | nindent 12 }}
            {{- end }}

The final values (example) can be:

  extraEnv:
    - name: "ZBX_EXAMPLE_MY_ENV_1"
      value: "true"
    - name: "ZBX_EXAMPLE_MY_ENV_2"
      value: "false"
    - name: "ZBX_EXAMPLE_MY_ENV_3"
      value: "100"
    - name: MY_USERNAME
      valueFrom:
        secretKeyRef:
          name: my-envs
          key: user
    - name: MY_PASSWORD
      valueFrom:
        secretKeyRef:
          name: my-envs
          key: password      

Did you understand the suggestion?

@aeciopires aeciopires added documentation Improvements or additions to documentation enhancement New feature or request labels May 26, 2024
@aeciopires
Copy link
Member

Hi @Elbandi!

I launched the version 4.4.1. See:

Please sync this changes in your local branch

@aeciopires aeciopires mentioned this pull request Jun 4, 2024
3 tasks
@aeciopires
Copy link
Member

Hello @Elbandi!

I published a new chart version to support Zabbix 7.0 and added the improvements suggested in this PR, but I keep your credits related the idea and implementation.

More details: #96

I will close this PR to avoid code conflicts

Thanks for your contribution.

@aeciopires aeciopires closed this Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants