blob: 037bcb9547e52eeb176be74d8f2d1b4807a2eefd [file] [log] [blame]
Giorgi Lekveishviliee15ee22024-03-28 12:35:10 +04001apiVersion: apps/v1
2kind: Deployment
3metadata:
4 name: {{ .Release.Name }}-git-backend-deployment
5 labels:
6 app.kubernetes.io/component: git-backend
7 app.kubernetes.io/instance: {{ .Release.Name }}
8 chart: {{ template "gerrit-replica.chart" . }}
9 heritage: {{ .Release.Service }}
10 release: {{ .Release.Name }}
11 {{- if .Values.additionalLabels }}
12{{ toYaml .Values.additionalLabels | indent 4 }}
13 {{- end }}
14spec:
15 replicas: {{ .Values.gitBackend.replicas }}
16 strategy:
17 rollingUpdate:
18 maxSurge: {{ .Values.gitBackend.maxSurge }}
19 maxUnavailable: {{ .Values.gitBackend.maxUnavailable }}
20 selector:
21 matchLabels:
22 app.kubernetes.io/component: git-backend
23 app.kubernetes.io/instance: {{ .Release.Name }}
24 template:
25 metadata:
26 labels:
27 app.kubernetes.io/component: git-backend
28 app.kubernetes.io/instance: {{ .Release.Name }}
29 chart: {{ template "gerrit-replica.chart" . }}
30 heritage: {{ .Release.Service }}
31 release: {{ .Release.Name }}
32 {{- if .Values.additionalLabels }}
33{{ toYaml .Values.additionalLabels | indent 8 }}
34 {{- end }}
35 {{- if .Values.gitBackend.additionalPodLabels }}
36{{ toYaml .Values.gitBackend.additionalPodLabels | indent 8 }}
37 {{- end }}
38 annotations:
39 chartRevision: "{{ .Release.Revision }}"
40 spec:
41 {{- with .Values.gitBackend.tolerations }}
42 tolerations:
43 {{- toYaml . | nindent 8 }}
44 {{- end }}
45 {{- with .Values.gitBackend.topologySpreadConstraints }}
46 topologySpreadConstraints:
47 {{- toYaml . | nindent 8 }}
48 {{- end }}
49 {{- with .Values.gitBackend.nodeSelector }}
50 nodeSelector:
51 {{- toYaml . | nindent 8 }}
52 {{- end }}
53 {{- with .Values.gitBackend.affinity }}
54 affinity:
55 {{- toYaml . | nindent 8 }}
56 {{- end }}
57 securityContext:
58 fsGroup: 100
59 {{ if .Values.images.registry.ImagePullSecret.name -}}
60 imagePullSecrets:
61 - name: {{ .Values.images.registry.ImagePullSecret.name }}
62 {{- range .Values.images.additionalImagePullSecrets }}
63 - name: {{ . }}
64 {{- end }}
65 {{- end }}
66 initContainers:
67 {{- if and .Values.nfsWorkaround.enabled .Values.nfsWorkaround.chownOnStartup }}
68 - name: nfs-init
69 image: {{ .Values.images.busybox.registry -}}/busybox:{{- .Values.images.busybox.tag }}
70 command:
71 - sh
72 - -c
73 args:
74 - |
75 chown 1000:100 /var/mnt/logs
76 chown 1000:100 /var/mnt/git
77 env:
78 - name: POD_NAME
79 valueFrom:
80 fieldRef:
81 fieldPath: metadata.name
82 volumeMounts:
83 - name: logs
84 subPathExpr: "gerrit-replica/$(POD_NAME)"
85 mountPath: "/var/mnt/logs"
86 - name: git-repositories
87 mountPath: "/var/mnt/git"
88 {{- if .Values.nfsWorkaround.idDomain }}
89 - name: nfs-config
90 mountPath: "/etc/idmapd.conf"
91 subPath: idmapd.conf
92 {{- end }}
93 {{- end }}
94 containers:
95 - name: apache-git-http-backend
96 imagePullPolicy: {{ .Values.images.imagePullPolicy }}
97 image: {{ template "registry" . }}{{ .Values.gitBackend.image }}:{{ .Values.images.version }}
98 env:
99 - name: POD_NAME
100 valueFrom:
101 fieldRef:
102 fieldPath: metadata.name
103 ports:
104 - name: http-port
105 containerPort: 80
106 resources:
107{{ toYaml .Values.gitBackend.resources | indent 10 }}
108 livenessProbe:
109 tcpSocket:
110 port: http-port
111{{ toYaml .Values.gitBackend.livenessProbe | indent 10 }}
112 readinessProbe:
113 tcpSocket:
114 port: http-port
115{{ toYaml .Values.gitBackend.readinessProbe | indent 10 }}
116 volumeMounts:
117 - name: git-repositories
118 mountPath: "/var/gerrit/git"
119 - name: logs
120 subPathExpr: "apache-git-http-backend/$(POD_NAME)"
121 mountPath: "/var/log/apache2"
122 {{- if and .Values.nfsWorkaround.enabled .Values.nfsWorkaround.idDomain }}
123 - name: nfs-config
124 mountPath: "/etc/idmapd.conf"
125 subPath: idmapd.conf
126 {{- end }}
127 - name: git-backend-secret
128 readOnly: true
129 subPath: .htpasswd
130 mountPath: "/var/apache/credentials/.htpasswd"
131 {{ if .Values.istio.enabled -}}
132 - name: istio-proxy
133 image: auto
134 lifecycle:
135 preStop:
136 exec:
137 command:
138 - "/bin/sh"
139 - "-c"
140 - "while [ $(netstat -plunt | grep tcp | grep -v envoy | wc -l | xargs) -ne 0 ]; do sleep 1; done"
141 {{- end }}
142 volumes:
143 - name: git-repositories
144 persistentVolumeClaim:
145 {{- if .Values.gitRepositoryStorage.externalPVC.use }}
146 claimName: {{ .Values.gitRepositoryStorage.externalPVC.name }}
147 {{- else }}
148 claimName: {{ .Release.Name }}-git-repositories-pvc
149 {{- end }}
150 - name: git-backend-secret
151 secret:
152 secretName: {{ .Release.Name }}-git-backend-secret
153 - name: logs
154 {{ if .Values.logStorage.enabled -}}
155 persistentVolumeClaim:
156 {{- if .Values.logStorage.externalPVC.use }}
157 claimName: {{ .Values.logStorage.externalPVC.name }}
158 {{- else }}
159 claimName: {{ .Release.Name }}-log-pvc
160 {{- end }}
161 {{ else -}}
162 emptyDir: {}
163 {{- end }}
164 {{- if and .Values.nfsWorkaround.enabled .Values.nfsWorkaround.idDomain }}
165 - name: nfs-config
166 configMap:
167 name: {{ .Release.Name }}-nfs-configmap
168 {{- end }}