336 lines
16 KiB
YAML
336 lines
16 KiB
YAML
{{- if include "prestashop.host" . -}}
|
|
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "common.names.fullname" . }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
selector:
|
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
|
{{- if .Values.updateStrategy }}
|
|
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
|
|
{{- end }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
template:
|
|
metadata:
|
|
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.podLabels }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
annotations:
|
|
{{- if .Values.podAnnotations }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.metrics.podAnnotations }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- include "prestashop.imagePullSecrets" . | nindent 6 }}
|
|
{{- if .Values.podSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.affinity }}
|
|
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
|
|
{{- else }}
|
|
affinity:
|
|
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }}
|
|
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }}
|
|
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.nodeSelector }}
|
|
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
hostAliases:
|
|
- ip: "127.0.0.1"
|
|
hostnames:
|
|
- "status.localhost"
|
|
initContainers:
|
|
{{- if .Values.initContainers }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
|
|
- name: volume-permissions
|
|
image: {{ include "prestashop.volumePermissions.image" . }}
|
|
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
mkdir -p "/bitnami/prestashop"
|
|
chown -R "{{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }}" "/bitnami/prestashop"
|
|
securityContext:
|
|
runAsUser: 0
|
|
{{- if .Values.volumePermissions.resources }}
|
|
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: prestashop-data
|
|
mountPath: /bitnami/prestashop
|
|
subPath: prestashop
|
|
{{- end }}
|
|
{{- if .Values.certificates.customCAs }}
|
|
- name: certificates
|
|
image: {{ template "certificates.image" . }}
|
|
imagePullPolicy: {{ default .Values.image.pullPolicy .Values.certificates.image.pullPolicy }}
|
|
imagePullSecrets:
|
|
{{- range (default .Values.image.pullSecrets .Values.certificates.image.pullSecrets) }}
|
|
- name: {{ . }}
|
|
{{- end }}
|
|
command:
|
|
{{- if .Values.certificates.command }}
|
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.certificates.command "context" $) | nindent 12 }}
|
|
{{- else if .Values.certificates.customCertificate.certificateSecret }}
|
|
- sh
|
|
- -c
|
|
- if command -v apk >/dev/null; then apk add --no-cache ca-certificates openssl && update-ca-certificates;
|
|
else apt-get update && apt-get install -y ca-certificates openssl; fi
|
|
{{- else }}
|
|
- sh
|
|
- -c
|
|
- if command -v apk >/dev/null; then apk add --no-cache ca-certificates openssl && update-ca-certificates;
|
|
else apt-get update && apt-get install -y ca-certificates openssl; fi
|
|
&& openssl req -new -x509 -days 3650 -nodes -sha256
|
|
-subj "/CN=$(hostname)" -addext "subjectAltName = DNS:$(hostname)"
|
|
-out {{ .Values.certificates.customCertificate.certificateLocation }}
|
|
-keyout {{ .Values.certificates.customCertificate.keyLocation }} -extensions v3_req
|
|
{{- end }}
|
|
{{- if .Values.certificates.args }}
|
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.certificates.args "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
env: {{- include "common.tplvalues.render" (dict "value" .Values.certificates.extraEnvVars "context" $) | nindent 12 }}
|
|
envFrom:
|
|
{{- if .Values.certificates.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.certificates.extraEnvVarsCM "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.certificates.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.certificates.extraEnvVarsSecret "context" $) }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: etc-ssl-certs
|
|
mountPath: /etc/ssl/certs
|
|
readOnly: false
|
|
- name: etc-ssl-private
|
|
mountPath: /etc/ssl/private
|
|
readOnly: false
|
|
- name: custom-ca-certificates
|
|
mountPath: /usr/local/share/ca-certificates
|
|
readOnly: true
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ include "common.names.fullname" . }}
|
|
image: {{ template "prestashop.image" . }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
|
{{- if .Values.command }}
|
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.args }}
|
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.containerSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
env:
|
|
- name: BITNAMI_DEBUG
|
|
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
|
- name: ALLOW_EMPTY_PASSWORD
|
|
value: {{ ternary "yes" "no" .Values.allowEmptyPassword | quote }}
|
|
- name: APACHE_HTTP_PORT_NUMBER
|
|
value: {{ .Values.containerPorts.http | quote }}
|
|
- name: APACHE_HTTPS_PORT_NUMBER
|
|
value: {{ .Values.containerPorts.https | quote }}
|
|
{{- if .Values.prestashopCookieCheckIP }}
|
|
- name: PRESTASHOP_COOKIE_CHECK_IP
|
|
value: {{ .Values.prestashopCookieCheckIP | quote }}
|
|
{{- end }}
|
|
{{- if .Values.prestashopCountry }}
|
|
- name: PRESTASHOP_COUNTRY
|
|
value: {{ .Values.prestashopCountry | quote }}
|
|
{{- end }}
|
|
{{- if .Values.prestashopLanguage }}
|
|
- name: PRESTASHOP_LANGUAGE
|
|
value: {{ .Values.prestashopLanguage | quote }}
|
|
{{- end }}
|
|
- name: PRESTASHOP_DATABASE_HOST
|
|
value: {{ include "prestashop.databaseHost" . | quote }}
|
|
- name: PRESTASHOP_DATABASE_PORT_NUMBER
|
|
value: {{ include "prestashop.databasePort" . | quote }}
|
|
- name: PRESTASHOP_DATABASE_NAME
|
|
value: {{ include "prestashop.databaseName" . | quote }}
|
|
- name: PRESTASHOP_DATABASE_USER
|
|
value: {{ include "prestashop.databaseUser" . | quote }}
|
|
- name: PRESTASHOP_DATABASE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "prestashop.databaseSecretName" . }}
|
|
key: {{ include "prestashop.databasePasswordKey" . }}
|
|
- name: PRESTASHOP_SKIP_BOOTSTRAP
|
|
value: {{ ternary "yes" "no" .Values.prestashopSkipInstall | quote }}
|
|
{{- $port:=.Values.service.port | toString }}
|
|
- name: PRESTASHOP_HOST
|
|
value: "{{ include "prestashop.host" . }}{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}"
|
|
- name: PRESTASHOP_USERNAME
|
|
value: {{ .Values.prestashopUsername | quote }}
|
|
- name: PRESTASHOP_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.names.fullname" . }}
|
|
key: prestashop-password
|
|
- name: PRESTASHOP_EMAIL
|
|
value: {{ .Values.prestashopEmail | quote }}
|
|
- name: PRESTASHOP_FIRST_NAME
|
|
value: {{ .Values.prestashopFirstName | quote }}
|
|
- name: PRESTASHOP_LAST_NAME
|
|
value: {{ .Values.prestashopLastName | quote }}
|
|
{{- if .Values.smtpHost }}
|
|
- name: SMTP_HOST
|
|
value: {{ .Values.smtpHost | quote }}
|
|
{{- end }}
|
|
{{- if .Values.smtpPort }}
|
|
- name: SMTP_PORT
|
|
value: {{ .Values.smtpPort | quote }}
|
|
{{- end }}
|
|
{{- if .Values.smtpUser }}
|
|
- name: SMTP_USER
|
|
value: {{ .Values.smtpUser | quote }}
|
|
{{- end }}
|
|
{{- if .Values.smtpPassword }}
|
|
- name: SMTP_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.names.fullname" . }}
|
|
key: smtp-password
|
|
{{- end }}
|
|
{{- if .Values.smtpProtocol }}
|
|
- name: SMTP_PROTOCOL
|
|
value: {{ .Values.smtpProtocol | quote }}
|
|
{{- end }}
|
|
{{- if .Values.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
{{- if .Values.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.lifecycleHooks }}
|
|
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.containerPorts.http }}
|
|
- name: https
|
|
containerPort: {{ .Values.containerPorts.https }}
|
|
{{- if .Values.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: {{ .Values.livenessProbe.path }}
|
|
port: http
|
|
httpHeaders:
|
|
- name: Host
|
|
value: {{ include "prestashop.host" . | quote }}
|
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
|
{{- else if .Values.customLivenessProbe }}
|
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.readinessProbe.enabled }}
|
|
readinessProbe:
|
|
httpGet:
|
|
path: {{ .Values.readinessProbe.path }}
|
|
port: http
|
|
httpHeaders:
|
|
- name: Host
|
|
value: {{ include "prestashop.host" . | quote }}
|
|
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
|
{{- else if .Values.customReadinessProbe }}
|
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.startupProbe.enabled }}
|
|
startupProbe:
|
|
httpGet:
|
|
path: {{ .Values.startupProbe.path }}
|
|
port: http
|
|
httpHeaders:
|
|
- name: Host
|
|
value: {{ include "prestashop.host" . | quote }}
|
|
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.startupProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
|
|
{{- else if .Values.customStartupProbe }}
|
|
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.resources }}
|
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: prestashop-data
|
|
mountPath: /bitnami/prestashop
|
|
subPath: prestashop
|
|
{{- if .Values.extraVolumeMounts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.metrics.enabled }}
|
|
- name: metrics
|
|
image: {{ template "prestashop.metrics.image" . }}
|
|
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
|
command: [ '/bin/apache_exporter', '--scrape_uri', 'http://status.localhost:{{ .Values.containerPorts.http }}/server-status/?auto' ]
|
|
ports:
|
|
- name: metrics
|
|
containerPort: 9117
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /metrics
|
|
port: metrics
|
|
initialDelaySeconds: 15
|
|
timeoutSeconds: 5
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /metrics
|
|
port: metrics
|
|
initialDelaySeconds: 5
|
|
timeoutSeconds: 1
|
|
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.sidecars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: prestashop-data
|
|
{{- if .Values.persistence.enabled }}
|
|
persistentVolumeClaim:
|
|
claimName: {{ .Values.persistence.existingClaim | default (printf "%s-prestashop" (include "common.names.fullname" .)) }}
|
|
{{- else }}
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- if .Values.extraVolumes }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- end -}}
|