From e87286fbfc0913dbe7dcc65f3d00f4349967c2ea Mon Sep 17 00:00:00 2001 From: pieter Date: Sat, 5 Jul 2025 12:25:06 +0000 Subject: [PATCH] =?UTF-8?q?templates/deployment.yaml=20=E3=82=92=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/deployment.yaml | 204 +++++++++++++++++++------------------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 6fb38bb..16f0a59 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -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