fix: support .env file
continuous-integration/drone/push Build is passing Details

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 protocol: TCP
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }} {{- if and (hasKey .Values.envFile "content") (hasKey .Values.config "DRONE_RUNNER_ENV_FILE") }}
nodeSelector: volumeMounts:
{{- toYaml . | nindent 8 }} - name: env-file
{{- end }} mountPath: {{ dir .Values.config.DRONE_RUNNER_ENV_FILE }}
readOnly: true
{{- end}}
{{- with .Values.affinity }} {{- with .Values.affinity }}
affinity: affinity:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "droneRunner.fullname" . }}
{{- with .Values.tolerations }} {{- with .Values.tolerations }}
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- 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 -}} {{- $_ := set .Values.config "DRONE_NAMESPACE_DEFAULT" .Release.Namespace -}}
{{- end -}} {{- 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 */}} {{/* SETUP CONFIG */}}
{{ range $key, $value := .Values.config }} {{ range $key, $value := .Values.config }}
{{ upper $key}}: {{ quote $value }} {{ upper $key}}: {{ quote $value }}

View File

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