templates/deployment.yaml を更新
This commit is contained in:
@@ -1,102 +1,102 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "phpfpm.fullname" . }}
|
name: {{ include "phpfpm.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "phpfpm.labels" . | nindent 4 }}
|
{{- include "phpfpm.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
replicas: {{ .Values.replicaCount }}
|
replicas: {{ .Values.replicaCount }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
{{- include "phpfpm.selectorLabels" . | nindent 6 }}
|
{{- include "phpfpm.selectorLabels" . | nindent 6 }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{- include "phpfpm.selectorLabels" . | nindent 8 }}
|
{{- include "phpfpm.selectorLabels" . | nindent 8 }}
|
||||||
spec:
|
spec:
|
||||||
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 }}"
|
||||||
imagePullPolicy: {{ .Values.image.nginx.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.nginx.pullPolicy }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: app-storage
|
- name: app-storage
|
||||||
mountPath: /var/www/html
|
mountPath: /var/www/html
|
||||||
subPath: html
|
subPath: html
|
||||||
- name: nginx-config
|
- name: nginx-config
|
||||||
mountPath: /etc/nginx/nginx.conf
|
mountPath: /etc/nginx/nginx.conf
|
||||||
subPath: nginx.conf
|
subPath: nginx.conf
|
||||||
- name: php-fpm
|
- name: php-fpm
|
||||||
image: "{{ .Values.image.php.registry }}/{{ .Values.image.php.repository }}:{{ .Values.image.php.tag }}"
|
image: "{{ .Values.image.php.registry }}/{{ .Values.image.php.repository }}:{{ .Values.image.php.tag }}"
|
||||||
imagePullPolicy: {{ .Values.image.php.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.php.pullPolicy }}
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
echo "Starting PHP-FPM with conditional logic..."
|
echo "Starting PHP-FPM with conditional logic..."
|
||||||
{{- if or .Values.selenium.enabled .Values.externalDatabase.enabled }}
|
{{- if or .Values.selenium.enabled .Values.externalDatabase.enabled }}
|
||||||
(
|
(
|
||||||
{{- if .Values.selenium.enabled }}
|
{{- if .Values.selenium.enabled }}
|
||||||
echo "Installing selenium dependencies..."
|
echo "Installing selenium dependencies..."
|
||||||
apk add --no-cache curl zip libzip-dev && \
|
apk add --no-cache curl zip libzip-dev && \
|
||||||
docker-php-ext-install zip && \
|
docker-php-ext-install zip && \
|
||||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
||||||
composer require php-webdriver/webdriver
|
composer require php-webdriver/webdriver
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.externalDatabase.enabled }}
|
{{- if .Values.externalDatabase.enabled }}
|
||||||
echo "Installing pdo_mysql for PHP 8.3 Alpine..."
|
echo "Installing pdo_mysql for PHP 8.4 Alpine..."
|
||||||
apk add --no-cache php83 php83-pdo_mysql
|
apk add --no-cache php84-pdo_mysql
|
||||||
{{- end }}
|
{{- end }}
|
||||||
)
|
)
|
||||||
{{- end }}
|
{{- end }}
|
||||||
php-fpm
|
php-fpm
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9000 # PHP-FPMは9000ポートでリッスン
|
- containerPort: 9000 # PHP-FPMは9000ポートでリッスン
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: app-storage
|
- name: app-storage
|
||||||
mountPath: /var/www/html
|
mountPath: /var/www/html
|
||||||
subPath: html
|
subPath: html
|
||||||
env:
|
env:
|
||||||
{{- if .Values.externalDatabase.enabled }}
|
{{- if .Values.externalDatabase.enabled }}
|
||||||
- name: DB_HOST
|
- name: DB_HOST
|
||||||
value: {{ .Values.externalDatabase.host | quote }}
|
value: {{ .Values.externalDatabase.host | quote }}
|
||||||
- name: DB_PORT
|
- name: DB_PORT
|
||||||
value: {{ .Values.externalDatabase.port | quote }}
|
value: {{ .Values.externalDatabase.port | quote }}
|
||||||
- name: DB_NAME
|
- name: DB_NAME
|
||||||
value: {{ .Values.externalDatabase.database | quote }}
|
value: {{ .Values.externalDatabase.database | quote }}
|
||||||
- name: DB_USER
|
- name: DB_USER
|
||||||
value: {{ .Values.externalDatabase.username | quote }}
|
value: {{ .Values.externalDatabase.username | quote }}
|
||||||
- name: DB_PASS
|
- name: DB_PASS
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ include "phpfpm.fullname" . }}-db-secret
|
name: {{ include "phpfpm.fullname" . }}-db-secret
|
||||||
key: {{ include "phpfpm.fullname" . }}-db-key
|
key: {{ include "phpfpm.fullname" . }}-db-key
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.selenium.enabled }}
|
{{- if .Values.selenium.enabled }}
|
||||||
- name: selenium
|
- name: selenium
|
||||||
image: "{{ .Values.image.selenium.registry }}/{{ .Values.image.selenium.repository }}:{{ .Values.image.selenium.tag }}"
|
image: "{{ .Values.image.selenium.registry }}/{{ .Values.image.selenium.repository }}:{{ .Values.image.selenium.tag }}"
|
||||||
imagePullPolicy: {{ .Values.image.selenium.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.selenium.pullPolicy }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 4444 # Selenium用ポート
|
- containerPort: 4444 # Selenium用ポート
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: app-storage
|
- name: app-storage
|
||||||
mountPath: /var/www/html
|
mountPath: /var/www/html
|
||||||
subPath: html
|
subPath: html
|
||||||
{{- end }}
|
{{- end }}
|
||||||
dnsPolicy: ClusterFirst
|
dnsPolicy: ClusterFirst
|
||||||
dnsConfig:
|
dnsConfig:
|
||||||
options:
|
options:
|
||||||
- name: ndots
|
- name: ndots
|
||||||
value: "1"
|
value: "1"
|
||||||
volumes:
|
volumes:
|
||||||
- name: app-storage
|
- name: app-storage
|
||||||
{{- if .Values.persistence.enabled }}
|
{{- if .Values.persistence.enabled }}
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ include "phpfpm.fullname" . }}-pvc
|
claimName: {{ include "phpfpm.fullname" . }}-pvc
|
||||||
{{- else }}
|
{{- else }}
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
- name: nginx-config
|
- name: nginx-config
|
||||||
configMap:
|
configMap:
|
||||||
name: {{ include "phpfpm.fullname" . }}-nginx-config
|
name: {{ include "phpfpm.fullname" . }}-nginx-config
|
||||||
|
|||||||
Reference in New Issue
Block a user