Skip to content

feat: secrets and volumes as secrets #27

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

Merged
merged 8 commits into from
Jul 13, 2023
Merged
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 stable/firehose/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: firehose
description: A Helm chart for deploying Firehose on Kubernetes
type: application
version: 0.1.5
version: 0.1.6
appVersion: 0.7.1
31 changes: 17 additions & 14 deletions stable/firehose/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,24 @@ spec:
name: {{ .Chart.Name }}
image: "{{ .Values.firehose.image.repository }}:{{ .Values.firehose.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.firehose.image.pullPolicy }}
{{- if or (index .Values "init-firehose" "enabled") (gt (len .Values.firehose.volumeMounts) 0) }}
{{- if or (index .Values "init-firehose" "enabled") (gt (len .Values.mountSecrets) 0 ) }}
volumeMounts:
{{- if index .Values "init-firehose" "enabled" }}
- mountPath: /work-dir
name: workdir
{{- end }}
{{- range $_, $volumeMount := .Values.firehose.volumeMounts }}
- name: {{ $volumeMount.name}}
mountPath: {{ $volumeMount.mountPath }}
{{- end}}
{{- end}}
{{- if (gt (len .Values.mountSecrets) 0 ) }}
- mountPath: /etc/secret/{{ include "firehose.fullname" . }}-mount-secrets
name: {{ include "firehose.fullname" . }}-mount-secrets
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.firehose.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ include "firehose.fullname" . }}-config
- secretRef:
name: {{ include "firehose.fullname" . }}-secrets
env:
- name: POD_NAME
valueFrom:
Expand Down Expand Up @@ -81,7 +83,7 @@ spec:
- mountPath: /work-dir
name: workdir
{{- end }}
{{if or (index .Values.telegraf.enabled) (index .Values "init-firehose" "enabled") (gt (len .Values.secretsAsVolumes) 0)}}
{{if or (index .Values.telegraf.enabled) (index .Values "init-firehose" "enabled") (gt (len .Values.mountSecrets) 0 ) }}
volumes:
{{- if index .Values.telegraf.enabled }}
- configMap:
Expand All @@ -92,14 +94,15 @@ spec:
- emptyDir: {}
name: workdir
{{- end }}
{{- range $_, $volume := .Values.secretsAsVolumes }}
- name: {{ $volume.name}}
{{- if (gt (len .Values.mountSecrets) 0 ) }}
- name: {{ include "firehose.fullname" . }}-mount-secrets
secret:
secretName: {{ $volume.secretName }}
defaultMode: {{ $volume.defaultMode }}
items: {{- range $_, $item := $volume.items }}
- key: {{ $item.key }}
path: {{ $item.path }}
secretName: {{ include "firehose.fullname" . }}-mount-secrets
defaultMode: 420
items:
{{- range $_, $mountSecret := .Values.mountSecrets}}
- key: {{$mountSecret.key}}
path: {{$mountSecret.path}}
{{- end}}
{{- end}}
{{- end}}
Expand Down
25 changes: 25 additions & 0 deletions stable/firehose/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "firehose.fullname" . }}-secrets
namespace: {{ .Release.Namespace }}
labels: {{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value }}
{{- end }}
stringData:
{{- toYaml .Values.envSecrets | nindent 2 }}

---

apiVersion: v1
kind: Secret
metadata:
name: {{ include "firehose.fullname" . }}-mount-secrets
namespace: {{ .Release.Namespace }}
labels: {{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value }}
{{- end }}
stringData:
{{- range $_, $mountSecret := .Values.mountSecrets }}
{{$mountSecret.key }}: {{ $mountSecret.value }}
{{- end }}
7 changes: 4 additions & 3 deletions stable/firehose/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@ firehose:
requests:
cpu: 200m
memory: 512Mi
volumeMounts: []

tolerations: []

secretsAsVolumes: []

nodeAffinityMatchExpressions:
requiredDuringSchedulingIgnoredDuringExecution: []
preferredDuringSchedulingIgnoredDuringExecution: []
Expand Down Expand Up @@ -85,3 +82,7 @@ telegraf:
requests:
cpu: 50m
memory: 64Mi

envSecrets: {}
mountSecrets: []