Files
charts/upstreamed/opencart/templates/deployment.yaml
2019-03-15 12:37:34 +00:00

168 lines
5.6 KiB
YAML

{{- if include "opencart.host" . -}}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "opencart.fullname" . }}
labels:
app: {{ template "opencart.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
selector:
matchLabels:
app: {{ template "opencart.fullname" . }}
release: "{{ .Release.Name }}"
template:
metadata:
labels:
app: {{ template "opencart.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
{{- if or .Values.podAnnotations .Values.metrics.enabled }}
annotations:
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.metrics.podAnnotations }}
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
{{- end }}
spec:
{{- include "opencart.imagePullSecrets" . | indent 6 }}
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "status.localhost"
containers:
- name: {{ template "opencart.fullname" . }}
image: {{ template "opencart.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
env:
- name: ALLOW_EMPTY_PASSWORD
value: {{ .Values.allowEmptyPassword | quote }}
{{- if .Values.mariadb.enabled }}
- name: MARIADB_HOST
value: {{ template "opencart.mariadb.fullname" . }}
- name: MARIADB_PORT_NUMBER
value: "3306"
- name: OPENCART_DATABASE_NAME
value: {{ .Values.mariadb.db.name | quote }}
- name: OPENCART_DATABASE_USER
value: {{ .Values.mariadb.db.user | quote }}
- name: OPENCART_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "opencart.mariadb.fullname" . }}
key: mariadb-password
{{- else }}
- name: MARIADB_HOST
value: {{ .Values.externalDatabase.host | quote }}
- name: MARIADB_PORT_NUMBER
value: {{ .Values.externalDatabase.port | quote }}
- name: OPENCART_DATABASE_NAME
value: {{ .Values.externalDatabase.database | quote }}
- name: OPENCART_DATABASE_USER
value: {{ .Values.externalDatabase.user | quote }}
- name: OPENCART_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
key: db-password
{{- end }}
- name: OPENCART_HOST
value: {{ include "opencart.host" . | quote }}
- name: OPENCART_USERNAME
value: {{ default "" .Values.opencartUsername | quote }}
- name: OPENCART_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "opencart.fullname" . }}
key: opencart-password
- name: OPENCART_EMAIL
value: {{ default "" .Values.opencartEmail | quote }}
- name: SMTP_HOST
value: {{ default "" .Values.smtpHost | quote }}
- name: SMTP_PORT
value: {{ default "" .Values.smtpPort | quote }}
- name: SMTP_USER
value: {{ default "" .Values.smtpUser | quote }}
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "opencart.fullname" . }}
key: smtp-password
- name: SMTP_PROTOCOL
value: {{ default "" .Values.smtpProtocol | quote }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
livenessProbe:
httpGet:
path: /admin/
port: http
httpHeaders:
- name: Host
value: {{ include "opencart.host" . | quote }}
initialDelaySeconds: 120
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /admin/
port: http
httpHeaders:
- name: Host
value: {{ include "opencart.host" . | quote }}
initialDelaySeconds: 30
timeoutSeconds: 3
periodSeconds: 5
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: opencart-data
mountPath: /bitnami/opencart
- name: apache-data
mountPath: /bitnami/apache
{{- if .Values.metrics.enabled }}
- name: metrics
image: {{ template "opencart.metrics.image" . }}
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
command: [ '/bin/apache_exporter', '-scrape_uri', 'http://status.localhost:80/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 | indent 10 }}
{{- end }}
volumes:
- name: opencart-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "opencart.fullname" . }}-opencart
{{- else }}
emptyDir: {}
{{- end }}
- name: apache-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "opencart.fullname" . }}-apache
{{- else }}
emptyDir: {}
{{- end }}
{{- end -}}