templates/deployment.yaml を更新
This commit is contained in:
@@ -1,69 +1,130 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "{{ .Chart.Name }}.fullname" . }}
|
name: {{ include "yourls-nginx.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "{{ .Chart.Name }}.labels" . | nindent 4 }}
|
{{- include "yourls-nginx.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
replicas: {{ .Values.replicaCount }}
|
replicas: {{ .Values.replicaCount }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
{{- include "{{ .Chart.Name }}.selectorLabels" . | nindent 6 }}
|
{{- include "yourls-nginx.selectorLabels" . | nindent 6 }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{- include "{{ .Chart.Name }}.selectorLabels" . | nindent 8 }}
|
{{- include "yourls-nginx.selectorLabels" . | nindent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: wait-for-mysql
|
||||||
|
image: busybox:1.36
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
until nc -z {{ include "yourls-nginx.fullname" . }}-mysql 3306; do
|
||||||
|
echo "Waiting for MySQL..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
containers:
|
containers:
|
||||||
|
# NGINX Container
|
||||||
- name: nginx
|
- name: nginx
|
||||||
image: "{{ .Values.image.nginx.registry }}/{{ .Values.image.nginx.repository }}:{{ .Values.image.nginx.tag }}"
|
image: "{{ .Values.image.nginx.registry }}/{{ .Values.image.nginx.repository }}:{{ .Values.image.nginx.tag }}"
|
||||||
imagePullPolicy: {{ .Values.image.nginx.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.nginx.pullPolicy }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- name: http
|
||||||
|
containerPort: 80
|
||||||
|
protocol: TCP
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: app-storage
|
|
||||||
mountPath: /var/www/html
|
|
||||||
subPath: html
|
|
||||||
- name: nginx-config
|
- name: nginx-config
|
||||||
mountPath: /etc/nginx/nginx.conf
|
mountPath: /etc/nginx/conf.d
|
||||||
subPath: nginx.conf
|
- name: yourls-data
|
||||||
- name: app-fpm
|
|
||||||
image: "{{ .Values.image.php.registry }}/{{ .Values.image.php.repository }}:{{ .Values.image.php.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.image.php.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- name: fpm
|
|
||||||
containerPort: 9000 # PHP-FPMは9000ポートでリッスン
|
|
||||||
volumeMounts:
|
|
||||||
- name: app-storage
|
|
||||||
mountPath: /var/www/html
|
mountPath: /var/www/html
|
||||||
subPath: html
|
resources:
|
||||||
|
{{- toYaml .Values.resources.nginx | nindent 12 }}
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
|
||||||
|
# YOURLS PHP-FPM Container
|
||||||
|
- name: yourls
|
||||||
|
image: "{{ .Values.image.yourls.registry }}/{{ .Values.image.yourls.repository }}:{{ .Values.image.yourls.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.yourls.pullPolicy }}
|
||||||
env:
|
env:
|
||||||
- name: DB_HOST
|
- name: YOURLS_DB_HOST
|
||||||
value: {{ .Values.externalDatabase.host | quote }}
|
value: "{{ include "yourls-nginx.fullname" . }}-mysql"
|
||||||
- name: DB_PORT
|
- name: YOURLS_DB_USER
|
||||||
value: {{ .Values.externalDatabase.port | quote }}
|
value: {{ .Values.mysql.auth.username | quote }}
|
||||||
- name: DB_NAME
|
- name: YOURLS_DB_PASS
|
||||||
value: {{ .Values.externalDatabase.database | quote }}
|
|
||||||
- name: DB_USER
|
|
||||||
value: {{ .Values.externalDatabase.username | quote }}
|
|
||||||
- name: DB_PASSWORD
|
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ include "{{ .Chart.Name }}.fullname" . }}-db-secret
|
name: {{ include "yourls-nginx.fullname" . }}-mysql
|
||||||
key: {{ include "{{ .Chart.Name }}.fullname" . }}-db-key
|
key: mysql-password
|
||||||
dnsPolicy: ClusterFirst
|
- name: YOURLS_DB_NAME
|
||||||
dnsConfig:
|
value: {{ .Values.mysql.auth.database | quote }}
|
||||||
options:
|
- name: YOURLS_SITE
|
||||||
- name: ndots
|
value: {{ .Values.yourls.config.site | quote }}
|
||||||
value: "1"
|
- name: YOURLS_USER
|
||||||
|
value: {{ .Values.yourls.config.username | quote }}
|
||||||
|
- name: YOURLS_PASS
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "yourls-nginx.fullname" . }}-secret
|
||||||
|
key: yourls-password
|
||||||
|
- name: YOURLS_COOKIEKEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "yourls-nginx.fullname" . }}-secret
|
||||||
|
key: yourls-cookiekey
|
||||||
|
- name: YOURLS_HOURS_OFFSET
|
||||||
|
value: {{ .Values.yourls.config.hours_offset | quote }}
|
||||||
|
- name: YOURLS_LANG
|
||||||
|
value: {{ .Values.yourls.config.lang | quote }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: yourls-data
|
||||||
|
mountPath: /var/www/html
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources.yourls | nindent 12 }}
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 9000
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 9000
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: app-storage
|
- name: nginx-config
|
||||||
{{- if .Values.persistence.enabled }}
|
configMap:
|
||||||
|
name: {{ include "yourls-nginx.fullname" . }}-nginx-config
|
||||||
|
- name: yourls-data
|
||||||
|
{{- if .Values.yourls.persistence.enabled }}
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ include "{{ .Chart.Name }}.fullname" . }}-pvc
|
claimName: {{ include "yourls-nginx.fullname" . }}-pvc
|
||||||
{{- else }}
|
{{- else }}
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
- name: nginx-config
|
|
||||||
configMap:
|
{{- with .Values.nodeSelector }}
|
||||||
name: {{ include "{{ .Chart.Name }}.fullname" . }}-nginx-config
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
Reference in New Issue
Block a user