apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "vhaudiquet-fr.fullname" . }} labels: {{- include "vhaudiquet-fr.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "vhaudiquet-fr.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "vhaudiquet-fr.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "vhaudiquet-fr.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: {{- if and .Values.nfs.enabled .Values.nfs.softFail }} - name: nfs-mounter image: alpine:3.20 securityContext: privileged: true command: - /bin/sh - -c - | apk add --no-cache nfs-utils 2>/dev/null || { echo "Cannot install nfs-utils, skipping NFS mount."; exec sleep infinity; } echo "Attempting NFS mount {{ .Values.nfs.server }}:{{ .Values.nfs.path }}..." if timeout 30 mount -t nfs -o timeo=10,soft,retrans=2 {{ .Values.nfs.server }}:{{ .Values.nfs.path }} /mnt/shared; then echo "NFS mounted successfully. Files are served directly from NFS." else echo "NFS mount failed or timed out, continuing with empty directory." fi exec sleep infinity volumeMounts: - name: public-files mountPath: /mnt/shared mountPropagation: Bidirectional {{- end }} - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: {{- range $key, $value := .Values.env }} - name: {{ $key }} value: {{ $value | quote }} {{- end }} ports: - name: http containerPort: 80 protocol: TCP livenessProbe: httpGet: path: / port: http initialDelaySeconds: 10 periodSeconds: 10 readinessProbe: httpGet: path: / port: http initialDelaySeconds: 5 periodSeconds: 10 resources: {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.nfs.enabled }} volumeMounts: - name: public-files mountPath: {{ .Values.nfs.mountPath }} {{- if .Values.nfs.softFail }} mountPropagation: HostToContainer {{- end }} {{- end }} {{- if and .Values.nfs.enabled (not .Values.nfs.softFail) }} volumes: - name: public-files persistentVolumeClaim: claimName: {{ include "vhaudiquet-fr.fullname" . }}-public {{- else if and .Values.nfs.enabled .Values.nfs.softFail }} volumes: - name: public-files emptyDir: {} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}