diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 6f92b8d..d66c2d8 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -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" . }} \ No newline at end of file + {{- 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}} diff --git a/templates/envConfig.yaml b/templates/envConfig.yaml new file mode 100644 index 0000000..1935079 --- /dev/null +++ b/templates/envConfig.yaml @@ -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 }} \ No newline at end of file diff --git a/templates/secrets.yaml b/templates/secrets.yaml index c0bf1d5..2969f17 100644 --- a/templates/secrets.yaml +++ b/templates/secrets.yaml @@ -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 }} diff --git a/values.yaml b/values.yaml index f915811..9f5afe0 100644 --- a/values.yaml +++ b/values.yaml @@ -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