First wordpress chart effort

This commit is contained in:
Jonathan Ervine 2020-07-31 09:41:26 +08:00
parent 1035267691
commit 273abf1919
7 changed files with 149 additions and 62 deletions

BIN
wordpress/.values.yaml.swo Normal file

Binary file not shown.

BIN
wordpress/.values.yaml.swp Normal file

Binary file not shown.

View File

@ -18,4 +18,6 @@ version: 0.1.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. # incremented each time you make changes to the application.
appVersion: 1.16.0 appVersion: v7.4
icon:

Binary file not shown.

View File

@ -1,55 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "wordpress.fullname" . }}
labels:
{{- include "wordpress.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "wordpress.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "wordpress.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "wordpress.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,118 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "wordpress.fullname" . }}
labels:
{{- include "wordpress.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ .Chart.name }}
selector:
matchLabels:
{{- include "wordpress.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "wordpress.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "wordpress.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Values.nginx.name }}
securityContext:
{{- toYaml .Values.nginx.securityContext | nindent 12 }}
image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}"
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
tcpSocket:
port: http
readinessProbe:
tcpSocket:
port: http
resources:
{{- toYaml .Values.nginx.resources | nindent 12 }}
volumeMounts:
- mountPath: /var/www/html
name: wordpress-pv
- mountPath: /etc/nginx/nginx.conf
name: nginx-conf
subPath: nginx.conf
- mountPath: /etc/nginx/conf.d/default.conf
name: nginx-conf
subPath: default.conf
- name: {{ .Values.wordpress.name }}
securityContext:
{{- toYaml .Values.wordpress.securityContext | nindent 12 }}
image: "{{ .Values.wordpress.image.repository }}:{{ .Values.wordpress.image.tag }}"
imagePullPolicy: {{ .Values.wordpress.image.pullPolicy }}
env:
- name: WORDPRESS_DB_HOST
valueFrom:
secretKeyRef:
name: wp-db
key: db-host
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: wp-db
key: wp-db-pass
- name: WORDPRESS_DB_NAME
valueFrom:
secretKeyRef:
name: wp-db
key: wp-db
- name: WORDPRESS_DB_USER
valueFrom:
secretKeyRef:
name: wp-db
key: wp-db-user
ports:
- name: php
containerPort: 9000
protocol: TCP
livenessProbe:
tcpSocket:
port: 9000
readinessProbe:
tcpSocket:
port: 9000
resources:
{{- toYaml .Values.wordpress.resources | nindent 12 }}
volumeMounts:
- mountPath: /var/www/html
name: wordpress-pv
volumes:
- name: nginx-conf
secret:
defaultMode: 420
secretName: nginx.conf
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: wordpress-pv
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.config.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.config.storageSize }}

View File

@ -3,14 +3,36 @@
# Declare variables to be passed into your templates. # Declare variables to be passed into your templates.
replicaCount: 1 replicaCount: 1
nginx:
name: NGINX
image:
repository: harbor.ervine.dev/library/x86_64/alpine/nginx
tag: alpine
pullPolicy: Always
image: imagePullSecrets: []
repository: nginx nameOverride: ""
pullPolicy: IfNotPresent fullnameOverride: ""
imagePullSecrets: [] securityContext: {}
nameOverride: "" # capabilities:
fullnameOverride: "" # drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
serviceAccount: serviceAccount:
# Specifies whether a service account should be created # Specifies whether a service account should be created