templates/deployment.yaml を更新
This commit is contained in:
@@ -14,6 +14,9 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
{{- include "wordpress-nginx.selectorLabels" . | nindent 8 }}
|
{{- include "wordpress-nginx.selectorLabels" . | nindent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 82
|
||||||
|
fsGroupChangePolicy: "OnRootMismatch"
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: wordpress-init
|
- name: wordpress-init
|
||||||
image: "{{ .Values.image.wordpress.registry }}/{{ .Values.image.wordpress.repository }}:{{ .Values.image.wordpress.tag }}"
|
image: "{{ .Values.image.wordpress.registry }}/{{ .Values.image.wordpress.repository }}:{{ .Values.image.wordpress.tag }}"
|
||||||
@@ -22,12 +25,19 @@ spec:
|
|||||||
args:
|
args:
|
||||||
- |
|
- |
|
||||||
if [ ! -f /var/www/html/wp-config.php ]; then
|
if [ ! -f /var/www/html/wp-config.php ]; then
|
||||||
cp -r /usr/src/wordpress/* /var/www/html/
|
echo "Initializing WordPress files..."
|
||||||
chown -R www-data:www-data /var/www/html
|
cp -rp /usr/src/wordpress/* /var/www/html/ 2>/dev/null || true
|
||||||
|
echo "WordPress files copied successfully"
|
||||||
|
else
|
||||||
|
echo "WordPress already initialized"
|
||||||
fi
|
fi
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: wordpress-data
|
- name: wordpress-data
|
||||||
mountPath: /var/www/html
|
mountPath: /var/www/html
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 82
|
||||||
|
runAsGroup: 82
|
||||||
|
fsGroup: 82
|
||||||
containers:
|
containers:
|
||||||
- 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 }}"
|
||||||
@@ -53,6 +63,9 @@ spec:
|
|||||||
- name: wordpress
|
- name: wordpress
|
||||||
image: "{{ .Values.image.wordpress.registry }}/{{ .Values.image.wordpress.repository }}:{{ .Values.image.wordpress.tag }}"
|
image: "{{ .Values.image.wordpress.registry }}/{{ .Values.image.wordpress.repository }}:{{ .Values.image.wordpress.tag }}"
|
||||||
imagePullPolicy: {{ .Values.image.wordpress.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.wordpress.pullPolicy }}
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 82
|
||||||
|
runAsGroup: 82
|
||||||
env:
|
env:
|
||||||
- name: WORDPRESS_DB_HOST
|
- name: WORDPRESS_DB_HOST
|
||||||
value: {{ .Values.wordpress.dbHost | quote }}
|
value: {{ .Values.wordpress.dbHost | quote }}
|
||||||
|
|||||||
Reference in New Issue
Block a user