apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "ai-git-bot.fullname" . }} labels: {{- include "ai-git-bot.labels" . | nindent 4 }} {{- include "ai-git-bot.selectorLabels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} # Recreate: agent sessions run in-process and Flyway migrations must not race # between an old and a new pod. strategy: type: Recreate selector: matchLabels: {{- include "ai-git-bot.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "ai-git-bot.selectorLabels" . | nindent 8 }} {{- if .Values.prometheus.enabled }} annotations: prometheus.io/scrape: "true" prometheus.io/port: "8080" prometheus.io/path: /actuator/prometheus {{- end }} spec: securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- if .Values.postgresql.enabled }} initContainers: - name: wait-for-postgresql image: {{ .Values.postgresql.image }} command: - sh - -c - until pg_isready -h {{ include "ai-git-bot.postgresql.fullname" . }} -p 5432; do echo waiting for postgresql; sleep 2; done securityContext: {{- toYaml .Values.securityContext | nindent 10 }} resources: requests: cpu: 10m memory: 16Mi limits: cpu: 100m memory: 64Mi {{- end }} containers: - name: ai-git-bot image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} securityContext: {{- toYaml .Values.securityContext | nindent 10 }} ports: - name: http containerPort: 8080 envFrom: - secretRef: name: {{ .Values.existingSecret }} env: - name: SPRING_PROFILES_ACTIVE value: docker {{- if .Values.postgresql.enabled }} - name: DATABASE_URL value: jdbc:postgresql://{{ include "ai-git-bot.postgresql.fullname" . }}:5432/{{ .Values.postgresql.database }} {{- end }} - name: APP_PUBLIC_URL value: {{ include "ai-git-bot.publicUrl" . | quote }} - name: PROMETHEUS_ENABLED value: {{ .Values.prometheus.enabled | quote }} - name: GITEABOT_SECURITY_LOGIN_METHOD value: {{ .Values.loginMethod | quote }} {{- if eq .Values.loginMethod "oauth" }} - name: GITEABOT_SECURITY_OAUTH_ISSUER_URI value: {{ .Values.oauth.issuerUri | quote }} - name: GITEABOT_SECURITY_OAUTH_SCOPE value: {{ .Values.oauth.scope | quote }} - name: GITEABOT_SECURITY_OAUTH_USER_NAME_ATTRIBUTE value: {{ .Values.oauth.userNameAttribute | quote }} {{- end }} {{- range $name, $value := .Values.env }} - name: {{ $name }} value: {{ $value | quote }} {{- end }} startupProbe: httpGet: path: /actuator/health port: http periodSeconds: 10 failureThreshold: 30 livenessProbe: httpGet: path: /actuator/health port: http periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 3 readinessProbe: httpGet: path: /actuator/health port: http periodSeconds: 10 timeoutSeconds: 5 resources: {{- toYaml .Values.resources | nindent 10 }} volumeMounts: - name: tmp mountPath: /tmp volumes: - name: tmp emptyDir: sizeLimit: {{ .Values.tmpVolume.sizeLimit }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }}