apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "gitks.fullname" . }} labels: {{- include "gitks.labels" . | nindent 4 }} spec: serviceName: {{ include "gitks.headlessServiceName" . }} {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} podManagementPolicy: Parallel selector: matchLabels: {{- include "gitks.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "gitks.labels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "gitks.serviceAccountName" . }} {{- with .Values.podSecurityContext }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} terminationGracePeriodSeconds: 30 containers: - name: gitks {{- with .Values.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: ["gitks"] ports: - name: grpc containerPort: {{ .Values.gitks.grpc.port }} protocol: TCP - name: metrics containerPort: {{ .Values.gitks.metrics.port }} protocol: TCP - name: cluster containerPort: {{ .Values.gitks.cluster.port }} protocol: TCP envFrom: - configMapRef: name: {{ include "gitks.fullname" . }} env: # Pod identity — used as STORAGE_NAME and for cluster addressing - name: STORAGE_NAME valueFrom: fieldRef: fieldPath: metadata.name # Advertised gRPC address for remote clients (other nodes use this) - name: GITKS_ADVERTISE_ADDR value: "http://{{ include "gitks.podDnsTemplate" . }}:{{ .Values.gitks.grpc.port }}" # Cluster hostname for ractor TCP connections - name: GITKS_CLUSTER_HOSTNAME value: {{ include "gitks.podDnsTemplate" . | quote }} {{- with .Values.extraEnv }} {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} livenessProbe: tcpSocket: port: grpc initialDelaySeconds: 10 periodSeconds: 10 failureThreshold: 3 readinessProbe: tcpSocket: port: grpc initialDelaySeconds: 5 periodSeconds: 5 failureThreshold: 3 startupProbe: tcpSocket: port: grpc initialDelaySeconds: 5 periodSeconds: 5 failureThreshold: 30 volumeMounts: - name: repo-data mountPath: {{ .Values.gitks.repoPrefixPath | quote }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.persistence.enabled }} volumeClaimTemplates: - metadata: name: repo-data labels: {{- include "gitks.labels" . | nindent 10 }} {{- with .Values.persistence.annotations }} annotations: {{- toYaml . | nindent 10 }} {{- end }} spec: accessModes: - {{ .Values.persistence.accessMode }} {{- with .Values.persistence.storageClass }} storageClassName: {{ . | quote }} {{- end }} resources: requests: storage: {{ .Values.persistence.size }} {{- end }}