Initial commit
This commit is contained in:
7
Chart.yaml
Normal file
7
Chart.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
name: app-name
|
||||||
|
description: Here comes an app description
|
||||||
|
type: application
|
||||||
|
version: 0.0.1
|
||||||
|
appVersion: "0.0.0"
|
||||||
|
icon: https://upload.wikimedia.org/logo.png
|
||||||
27
templates/_helpers.tpl
Normal file
27
templates/_helpers.tpl
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{{/* Return chart name (Chart.yaml:name) */}}
|
||||||
|
{{- define "chart.name" -}}
|
||||||
|
{{- .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Return full release name (Release-ChartName) */}}
|
||||||
|
{{- define "chart.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride }}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "%s-%s" .Release.Name (include "chart.name" .) | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Standard labels */}}
|
||||||
|
{{- define "chart.labels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "chart.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | default "latest" }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Selector labels */}}
|
||||||
|
{{- define "chart.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "chart.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
60
templates/configmap.yaml
Normal file
60
templates/configmap.yaml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}-nginx-config
|
||||||
|
labels:
|
||||||
|
{{- include "{{ .Chart.Name }}.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
nginx.conf: |
|
||||||
|
user nginx;
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{- if .Values.nginx.customConfig.enabled }}
|
||||||
|
{{ .Values.nginx.customConfig.snippet | indent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
69
templates/deployment.yaml
Normal file
69
templates/deployment.yaml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "{{ .Chart.Name }}.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "{{ .Chart.Name }}.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "{{ .Chart.Name }}.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: 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
|
||||||
|
subPath: html
|
||||||
|
env:
|
||||||
|
- 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_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}-db-secret
|
||||||
|
key: {{ include "{{ .Chart.Name }}.fullname" . }}-db-key
|
||||||
|
dnsPolicy: ClusterFirst
|
||||||
|
dnsConfig:
|
||||||
|
options:
|
||||||
|
- name: ndots
|
||||||
|
value: "1"
|
||||||
|
volumes:
|
||||||
|
- name: app-storage
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ include "{{ .Chart.Name }}.fullname" . }}-pvc
|
||||||
|
{{- else }}
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
- name: nginx-config
|
||||||
|
configMap:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}-nginx-config
|
||||||
39
templates/ingress.yaml
Normal file
39
templates/ingress.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "{{ .Chart.Name }}.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml .Values.ingress.annotations | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.ingress.className }}
|
||||||
|
ingressClassName: {{ .Values.ingress.className }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
- host: {{ .host }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ .path }}
|
||||||
|
pathType: {{ .pathType }}
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" $ }}
|
||||||
|
port:
|
||||||
|
number: {{ $.Values.service.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.ingress.tls }}
|
||||||
|
- secretName: {{ .secretName }}
|
||||||
|
hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
14
templates/pvc.yaml
Normal file
14
templates/pvc.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}-pvc
|
||||||
|
labels:
|
||||||
|
{{- include "{{ .Chart.Name }}.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- {{ .Values.persistence.accessMode }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.persistence.size }}
|
||||||
|
{{- end }}
|
||||||
9
templates/secret-db.yaml
Normal file
9
templates/secret-db.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{{- if and .Values.externalDatabase.enabled .Values.externalDatabase.password }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}-db-secret
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
{{ include "{{ .Chart.Name }}.fullname" . }}-db-key: {{ .Values.externalDatabase.password | quote }}
|
||||||
|
{{- end }}
|
||||||
15
templates/service.yaml
Normal file
15
templates/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "{{ .Chart.Name }}.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "{{ .Chart.Name }}.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.service.port }}
|
||||||
|
targetPort: 80
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
{{- include "{{ .Chart.Name }}.selectorLabels" . | nindent 4 }}
|
||||||
60
values.yaml
Normal file
60
values.yaml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
image:
|
||||||
|
nginx:
|
||||||
|
registry: docker.io
|
||||||
|
repository: nginx
|
||||||
|
tag: "1.29.3-alpine-perl"
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
wordpress:
|
||||||
|
registry: docker.io
|
||||||
|
repository: repo-name
|
||||||
|
tag: "fpm-alpine"
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
service:
|
||||||
|
# type: ClusterIP
|
||||||
|
type: LoadBalancer
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
className: ""
|
||||||
|
annotations: {}
|
||||||
|
# {
|
||||||
|
# acme.cert-manager.io/http01-ingress-class: "nginx",
|
||||||
|
# cert-manager.io/cluster-issuer: "letsencrypt-issuer",
|
||||||
|
# nginx.ingress.kubernetes.io/from-to-www-redirect: "true",
|
||||||
|
# nginx.ingress.kubernetes.io/proxy-body-size: "100m"
|
||||||
|
# }
|
||||||
|
hosts:
|
||||||
|
- host: example.tld
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
tls: []
|
||||||
|
# [
|
||||||
|
# {
|
||||||
|
# hosts: [ "example.com" ],
|
||||||
|
# secretName: "example-tls"
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
accessMode: ReadWriteOnce
|
||||||
|
size: 1Gi
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
customConfig:
|
||||||
|
enabled: false
|
||||||
|
snippet: |-
|
||||||
|
|
||||||
|
externalDatabase:
|
||||||
|
host: mariadb-hostname
|
||||||
|
port: 3306
|
||||||
|
database: dbname
|
||||||
|
username: user
|
||||||
|
password: pass
|
||||||
|
|
||||||
|
resources: {}
|
||||||
Reference in New Issue
Block a user