Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
helm: add option to use an existing secret for rgw credentials
Browse files Browse the repository at this point in the history
Resolves #53

Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Oct 10, 2023
1 parent 644978f commit 37eb6fc
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/extended-ceph-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.2.8
version: 1.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
13 changes: 13 additions & 0 deletions charts/extended-ceph-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ spec:
envFrom:
- secretRef:
name: {{ include "extended-ceph-exporter.fullname" . }}
{{- if .Values.config.rgw.existingSecret.name }}
env:
- name: CEPH_METRICS_RGW_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.config.rgw.existingSecret.name | quote }}
key: {{ .Values.config.rgw.existingSecret.keys.access | quote }}
- name: CEPH_METRICS_RGW_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.config.rgw.existingSecret.name | quote }}
key: {{ .Values.config.rgw.existingSecret.keys.secret | quote }}
{{- end }}
ports:
- name: http-metrics
containerPort: 9138
Expand Down
22 changes: 16 additions & 6 deletions charts/extended-ceph-exporter/templates/post-install-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,28 @@ spec:
- name: CEPH_METRICS_RGW_HOST
valueFrom:
secretKeyRef:
name: {{ include "extended-ceph-exporter.fullname" . }}
key: CEPH_METRICS_RGW_HOST
name: {{ include "extended-ceph-exporter.fullname" . }}
key: CEPH_METRICS_RGW_HOST
- name: RGW_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "extended-ceph-exporter.fullname" . }}
key: CEPH_METRICS_RGW_ACCESS_KEY
{{- if .Values.config.rgw.existingSecret.name }}
name: {{ .Values.config.rgw.existingSecret.name | quote }}
key: {{ .Values.config.rgw.existingSecret.keys.access | quote }}
{{ else }}
name: {{ include "extended-ceph-exporter.fullname" . }}
key: CEPH_METRICS_RGW_ACCESS_KEY
{{- end }}
- name: RGW_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ include "extended-ceph-exporter.fullname" . }}
key: CEPH_METRICS_RGW_SECRET_KEY
{{- if .Values.config.rgw.existingSecret.name }}
name: {{ .Values.config.rgw.existingSecret.name | quote }}
key: {{ .Values.config.rgw.existingSecret.keys.secret | quote }}
{{ else }}
name: {{ include "extended-ceph-exporter.fullname" . }}
key: CEPH_METRICS_RGW_SECRET_KEY
{{- end }}
command:
- /bin/bash
- -c
Expand Down
2 changes: 2 additions & 0 deletions charts/extended-ceph-exporter/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ metadata:
{{- include "extended-ceph-exporter.labels" . | nindent 4 }}
data:
CEPH_METRICS_RGW_HOST: {{ include "extended-ceph-exporter.rgwHost" . | b64enc }}
{{- if not .Values.config.rgw.existingSecret.name }}
CEPH_METRICS_RGW_ACCESS_KEY: {{ .Values.config.rgw.accessKey | default (randAlphaNum 20) | b64enc }}
CEPH_METRICS_RGW_SECRET_KEY: {{ .Values.config.rgw.secretKey | default (randAlphaNum 40) | b64enc }}
{{- end }}
{{- range $k, $v := .Values.additionalEnv }}
{{ $k }}: {{ $v | b64enc }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/extended-ceph-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ config:
# -- The Ceph RGW endpoint as a URL, e.g. "https://your-ceph-rgw-endpoint-here:8443"
# @default -- First detected RGW endpoint
host: ""
# -- Existing RGW admin credentials secret config
existingSecret:
# -- Name of the existing RGW admin credentials secret
name: ""
keys:
# -- Access key secret key name
access: ""
# -- Secret key secret key name
secret: ""
# -- RGW admin access key
# @default -- Randomly generated
accessKey: null
Expand Down

0 comments on commit 37eb6fc

Please sign in to comment.