Files
wordyne/Chart/templates/deployment.yaml

132 lines
4.7 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "..fullname" . }}
labels:
{{- include "..labels" . | nindent 4 }}
cloudyne.systems/component: site
spec:
{{- if .Values.site.resources }}
replicas: {{ .Values.site.resources.replicas | default 1 }}
{{- else }}
replicas: 1
{{- end }}
selector:
matchLabels:
cloudyne.systems/customer: {{ .Values.customer.legalName | replace " " "-" | lower | trunc 63 }}
cloudyne.systems/customer-legal-id: {{ .Values.customer.legalId }}
cloudyne.systems/site: {{ .Values.site.domain }}
template:
metadata:
labels:
cloudyne.systems/customer: {{ .Values.customer.legalName | replace " " "-" | lower | trunc 63 }}
cloudyne.systems/customer-legal-id: {{ .Values.customer.legalId }}
cloudyne.systems/site: {{ .Values.site.domain }}
spec:
securityContext:
fsGroup: 101
volumes:
- name: cloud
persistentVolumeClaim:
claimName: pvc-{{ include "..fullname" . }}
- name: cloud-local
persistentVolumeClaim:
claimName: pvc-{{ include "..fullname" . }}-local
- name: serverconfig
configMap:
name: {{ include "..fullname" . }}-cfg
imagePullSecrets:
- name: pull-secret
initContainers:
- name: init-storage
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
image: cloudyne/ubuntu-ci:latest
command: ["python3"]
args: ["/usr/local/bin/storage-clone", "/full-cloud", "/full-cloud-local"]
imagePullPolicy: Always
volumeMounts:
- name: cloud
mountPath: /full-cloud
- name: cloud-local
mountPath: /full-cloud-local
- name: deploy
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
image: "cloudyne.azurecr.io/buildahome/{{ .Values.site.name | default ( .Values.site.domain | replace "." "-" ) }}:{{ .Values.site.imageTag | default "latest" }}"
imagePullPolicy: Always
volumeMounts:
- name: cloud
mountPath: /full-cloud
- name: serverconfig
mountPath: /init-go/config.json
subPath: init.json
{{- if .Values.storage.wpContent }}
{{- range $v := .Values.storage.wpContent }}
- name: cloud-local
mountPath: "/app/web/app/{{ $v }}"
subPath: "{{ $v }}"
{{- end }}
{{- end }}
{{- if .Values.storage.additionalMounts }}
{{- range $v := .Values.storage.additionalMounts }}
- name: cloud-local
mountPath: {{ $v.localPath }}
subPath: {{ $v.cloudPath }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "..fullname" . }}-env
- secretRef:
name: {{ include "..fullname" . }}-db-auth
- secretRef:
name: global-secrets
{{- if eq (.Values.site.container_base | default "debian" ) "debian" }}
command: [ "/init-go/init-go" ]
{{- else }}
command: ["sh"]
args: ["-c", "/init-go/init-go"]
{{- end }}
containers:
- name: wordpress
securityContext:
runAsUser: 101
image: "cloudyne.azurecr.io/buildahome/{{ .Values.site.name | default ( .Values.site.domain | replace "." "-" ) }}:{{ .Values.site.imageTag | default "latest" }}"
imagePullPolicy: Always
volumeMounts:
- name: serverconfig
mountPath: /docker-entrypoint.d/unit.json
subPath: unit.json
- name: cloud
mountPath: /var/cloud
{{- if .Values.storage.wpContent }}
{{- range $v := .Values.storage.wpContent }}
- name: cloud-local
mountPath: "/app/web/app/{{ $v }}"
subPath: "{{ $v }}"
{{- end }}
{{- end }}
{{- if .Values.storage.additionalMounts }}
{{- range $v := .Values.storage.additionalMounts }}
- name: cloud-local
mountPath: {{ $v.localPath }}
subPath: {{ $v.cloudPath }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "..fullname" . }}-env
- secretRef:
name: {{ include "..fullname" . }}-db-auth
- secretRef:
name: global-secrets
{{- include "..resourcelimits" . | nindent 10 }}
ports:
- containerPort: 8080
name: http
protocol: TCP