fix: support .env file
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Markus Pesch 2021-09-10 18:37:05 +02:00
parent fbb66d867b
commit 286e8945a2
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 41 additions and 5 deletions

View File

@ -35,16 +35,31 @@ spec:
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and (hasKey .Values.envFile "content") (hasKey .Values.config "DRONE_RUNNER_ENV_FILE") }}
volumeMounts:
- name: env-file
mountPath: {{ dir .Values.config.DRONE_RUNNER_ENV_FILE }}
readOnly: true
{{- end}}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "droneRunner.fullname" . }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "droneRunner.fullname" . }}
{{- if and (hasKey .Values.envFile "content") (hasKey .Values.config "DRONE_RUNNER_ENV_FILE") }}
volumes:
- name: env-file
configMap:
name: {{ include "droneRunner.fullname" . }}
items:
- key: {{ base .Values.config.DRONE_RUNNER_ENV_FILE }}
path: {{ base .Values.config.DRONE_RUNNER_ENV_FILE }}
{{- end}}

11
templates/envConfig.yaml Normal file
View File

@ -0,0 +1,11 @@
{{- if and (hasKey .Values.envFile "content") (hasKey .Values.config "DRONE_RUNNER_ENV_FILE") }}
apiVersion: v1
kind: ConfigMap
metadata:
labels:
{{- include "droneRunner.labels" . | nindent 4 }}
name: {{ include "droneRunner.fullname" . }}
data:
{{ base .Values.config.DRONE_RUNNER_ENV_FILE }}: |
{{ .Values.envFile.content }}
{{- end }}

View File

@ -13,6 +13,10 @@ stringData:
{{- $_ := set .Values.config "DRONE_NAMESPACE_DEFAULT" .Release.Namespace -}}
{{- end -}}
{{- if and (not (hasKey .Values.config "DRONE_RUNNER_ENV_FILE")) (hasKey .Values.envFile "content") }}
{{- $_ := set .Values.config "DRONE_RUNNER_ENV_FILE" "/tmp/drone-runner/drone.conf" -}}
{{- end }}
{{/* SETUP CONFIG */}}
{{ range $key, $value := .Values.config }}
{{ upper $key}}: {{ quote $value }}

View File

@ -334,6 +334,12 @@ config:
# https://docs.drone.io/runner/kubernetes/configuration/reference/drone-ui-username/
# DRONE_UI_USERNAME: ""
envFile: {}
# content: |
# KEY=VALUE
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little