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