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

Allow other forms of extra env variables to allow secrets #218

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/opencost/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords:
- finops
- monitoring
- opencost
version: 1.41.0
version: 1.42.0
maintainers:
- name: mattray
url: https://mattray.dev
Expand Down
2 changes: 1 addition & 1 deletion charts/opencost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $ helm install opencost opencost/opencost
| opencost.exporter.defaultClusterId | string | `"default-cluster"` | Default cluster ID to use if cluster_id is not set in Prometheus metrics. |
| opencost.exporter.env | list | `[]` | List of additional environment variables to set in the container |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this existing variable (env instead of extraEnv) not provide whats needed here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's definitely a misread on my part, didn't realize there was two ways of adding environment variables, and since the "standard" is extraEnv in most helm charts, I didn't look further. Thanks!

| opencost.exporter.extraArgs | list | `[]` | List of extra arguments for the command, e.g.: log-format=json |
| opencost.exporter.extraEnv | object | `{}` | Any extra environment variables you would like to pass on to the pod |
| opencost.exporter.extraEnv | list | `[]` | A list of extra environment variables you would like to pass on to the pod |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapping the type of object is backwards incompatible. For the sanity of downstream users, I recommend we keep breaking changes to only those absolutely required, and when we do we increment the chart major version.

| opencost.exporter.extraVolumeMounts | list | `[]` | A list of volume mounts to be added to the pod |
| opencost.exporter.image.fullImageName | string | `nil` | Override the full image name for development purposes |
| opencost.exporter.image.pullPolicy | string | `"IfNotPresent"` | Exporter container image pull policy |
Expand Down
5 changes: 2 additions & 3 deletions charts/opencost/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,8 @@ spec:
value: {{ .Values.opencost.metrics.kubeStateMetrics.emitKsmV1MetricsOnly | quote }}
{{- end }}
# Add any additional provided variables
{{- range $key, $value := .Values.opencost.exporter.extraEnv }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- with .Values.opencost.exporter.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if or .Values.plugins.enabled .Values.opencost.exporter.persistence.enabled .Values.opencost.exporter.extraVolumeMounts .Values.opencost.customPricing.enabled .Values.opencost.cloudIntegrationSecret}}
volumeMounts:
Expand Down
12 changes: 8 additions & 4 deletions charts/opencost/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,14 @@ opencost:
# -- List of additional environment variables to set in the container
env: []
# -- Any extra environment variables you would like to pass on to the pod
extraEnv: {}
# FOO: BAR
# For example, if accessing mimir directly and getting 401 Unauthorized
# PROMETHEUS_HEADER_X_SCOPE_ORGID: anonymous
extraEnv: []
# - name: FOO
# value: bar
# - name: SECRET_FOO
# valueFrom:
# secretKeyRef:
# name: secret-foo
# key: bar
customPricing:
# -- Enables custom pricing configuration
enabled: false
Expand Down
Loading