|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: {{ include "gitlab-runner.fullname" . }} |
| 5 | + namespace: {{ .Release.Namespace }} |
| 6 | + labels: |
| 7 | + {{- include "gitlab-runner.labels" . | nindent 4 }} |
| 8 | +spec: |
| 9 | + replicas: {{ .Values.replicaCount }} |
| 10 | +{{- with .Values.strategy }} |
| 11 | + strategy: |
| 12 | + {{ toYaml . | nindent 4 }} |
| 13 | +{{- end }} |
| 14 | + selector: |
| 15 | + matchLabels: |
| 16 | + {{- include "gitlab-runner.selectorLabels" . | nindent 6 }} |
| 17 | + template: |
| 18 | + metadata: |
| 19 | + labels: |
| 20 | + {{- include "gitlab-runner.selectorLabels" . | nindent 8 }} |
| 21 | + annotations: |
| 22 | + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 23 | + spec: |
| 24 | + {{- with .Values.imagePullSecrets }} |
| 25 | + imagePullSecrets: |
| 26 | + {{- toYaml . | nindent 8 }} |
| 27 | + {{- end }} |
| 28 | + serviceAccountName: {{ include "gitlab-runner.serviceAccountName" . }} |
| 29 | + securityContext: |
| 30 | + {{- toYaml .Values.podSecurityContext | nindent 8 }} |
| 31 | + initContainers: |
| 32 | + - name: registrator |
| 33 | + image: "{{ .Values.image.repository }}:{{ include "gitlab-runner.tag" . }}" |
| 34 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 35 | + args: |
| 36 | + - register |
| 37 | + - --non-interactive |
| 38 | + env: |
| 39 | + {{- with .Values.env }} |
| 40 | + {{- . | toYaml | nindent 12 }} |
| 41 | + {{- end}} |
| 42 | + - name: CONFIG_FILE |
| 43 | + value: /opt/gitlab-runner-config/config.toml |
| 44 | + - name: TEMPLATE_CONFIG_FILE |
| 45 | + value: /opt/gitlab-runner-configmap/config.template.toml |
| 46 | + - name: RUNNER_NAME |
| 47 | + valueFrom: |
| 48 | + fieldRef: |
| 49 | + fieldPath: metadata.name |
| 50 | + volumeMounts: |
| 51 | + - name: configmap |
| 52 | + mountPath: /opt/gitlab-runner-configmap |
| 53 | + readOnly: true |
| 54 | + - name: config |
| 55 | + mountPath: /opt/gitlab-runner-config |
| 56 | + containers: |
| 57 | + - name: {{ .Chart.Name }} |
| 58 | + securityContext: |
| 59 | + {{- toYaml .Values.securityContext | nindent 12 }} |
| 60 | + image: "{{ .Values.image.repository }}:{{ include "gitlab-runner.tag" . }}" |
| 61 | + args: |
| 62 | + - run |
| 63 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 64 | + ports: |
| 65 | + - name: http-metrics |
| 66 | + containerPort: 9252 |
| 67 | + livenessProbe: |
| 68 | + {{- toYaml .Values.livenessProbe | nindent 12 }} |
| 69 | + readinessProbe: |
| 70 | + {{- toYaml .Values.readinessProbe | nindent 12 }} |
| 71 | + resources: |
| 72 | + {{- toYaml .Values.resources | nindent 12 }} |
| 73 | + env: |
| 74 | + - name: CONFIG_FILE |
| 75 | + value: /opt/gitlab-runner-config/config.toml |
| 76 | + - name: LISTEN_ADDRESS |
| 77 | + value: ":9252" |
| 78 | + - name: RUNNER_NAME |
| 79 | + valueFrom: |
| 80 | + fieldRef: |
| 81 | + fieldPath: metadata.name |
| 82 | + {{- with .Values.env }} |
| 83 | + {{- toYaml . | nindent 12 }} |
| 84 | + {{- end }} |
| 85 | + lifecycle: |
| 86 | + preStop: |
| 87 | + exec: |
| 88 | + command: |
| 89 | + - gitlab-runner |
| 90 | + - unregister |
| 91 | + - --all-runners |
| 92 | + volumeMounts: |
| 93 | + - name: config |
| 94 | + mountPath: /opt/gitlab-runner-config |
| 95 | + {{- with .Values.volumeMounts }} |
| 96 | + {{- toYaml . | nindent 12 }} |
| 97 | + {{- end }} |
| 98 | + {{- range .Values.additionalContainers }} |
| 99 | + - {{ toYaml . | nindent 10 }} |
| 100 | + {{- end}} |
| 101 | + volumes: |
| 102 | + - name: configmap |
| 103 | + configMap: |
| 104 | + name: {{ include "gitlab-runner.fullname" . }} |
| 105 | + - name: config |
| 106 | + emptyDir: { } |
| 107 | + {{- with .Values.volumes }} |
| 108 | + {{- toYaml . | nindent 8 }} |
| 109 | + {{- end }} |
| 110 | + {{- with .Values.nodeSelector }} |
| 111 | + nodeSelector: |
| 112 | + {{- toYaml . | nindent 8 }} |
| 113 | + {{- end }} |
| 114 | + {{- with .Values.affinity }} |
| 115 | + affinity: |
| 116 | + {{- toYaml . | nindent 8 }} |
| 117 | + {{- end }} |
| 118 | + {{- with .Values.tolerations }} |
| 119 | + tolerations: |
| 120 | + {{- toYaml . | nindent 8 }} |
| 121 | + {{- end }} |
0 commit comments