diff --git a/charts/wordpress-helm/templates/postgresql-statefulset.yaml b/charts/wordpress-helm/templates/database-statefulset.yaml similarity index 51% rename from charts/wordpress-helm/templates/postgresql-statefulset.yaml rename to charts/wordpress-helm/templates/database-statefulset.yaml index b413a9d..97fe8c8 100644 --- a/charts/wordpress-helm/templates/postgresql-statefulset.yaml +++ b/charts/wordpress-helm/templates/database-statefulset.yaml @@ -1,12 +1,12 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: {{ .Values.fullname }}-postgresql + name: {{ .Values.fullname }}-mysql labels: {{- include "wordpress-website.labels" . | nindent 4 }} app.kubernetes.io/component: database spec: - serviceName: {{ .Values.fullname }}-postgresql + serviceName: {{ .Values.fullname }}-mysql replicas: 1 selector: matchLabels: @@ -19,37 +19,36 @@ spec: app.kubernetes.io/component: database spec: securityContext: - {{- toYaml .Values.postgresql.podSecurityContext | nindent 8 }} + {{- toYaml .Values.mysql.podSecurityContext | nindent 8 }} containers: - - name: postgresql - image: "{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}" - imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }} + - name: mysql + image: "{{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}" + imagePullPolicy: {{ .Values.mysql.image.pullPolicy }} ports: - - name: postgresql - containerPort: 5432 + - name: mysql + containerPort: 3306 protocol: TCP env: - - name: POSTGRES_DB - value: {{ .Values.postgresql.database }} - - name: POSTGRES_USER - value: {{ .Values.postgresql.username }} - - name: POSTGRES_PASSWORD + - name: MYSQL_DATABASE + value: {{ .Values.mysql.database }} + - name: MYSQL_USER + value: {{ .Values.mysql.username }} + - name: MYSQL_PASSWORD valueFrom: secretKeyRef: - name: {{ .Values.fullname }}-postgresql - key: postgresql-password - - name: PGDATA - value: /var/lib/postgresql/data/pgdata - - name: PGUSER - value: {{ .Values.postgresql.username }} - - name: PGDATABASE - value: {{ .Values.postgresql.database }} + name: {{ .Values.fullname }}-mysql + key: mysql-password + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.fullname }}-mysql + key: mysql-root-password livenessProbe: exec: command: - /bin/sh - -c - - exec pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" -h 127.0.0.1 -p 5432 + - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}" initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 @@ -60,36 +59,36 @@ spec: command: - /bin/sh - -c - - exec pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" -h 127.0.0.1 -p 5432 + - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}" initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 5 successThreshold: 1 failureThreshold: 6 resources: - {{- toYaml .Values.postgresql.resources | nindent 12 }} + {{- toYaml .Values.mysql.resources | nindent 12 }} volumeMounts: - - name: postgresql-data - mountPath: /var/lib/postgresql/data + - name: mysql-data + mountPath: /var/lib/mysql volumes: - - name: postgresql-data + - name: mysql-data persistentVolumeClaim: - claimName: {{ .Values.fullname }}-postgresql-data + claimName: {{ .Values.fullname }}-mysql-data --- apiVersion: v1 kind: Service metadata: - name: {{ .Values.fullname }}-postgresql + name: {{ .Values.fullname }}-mysql labels: {{- include "wordpress-website.labels" . | nindent 4 }} app.kubernetes.io/component: database spec: type: ClusterIP ports: - - port: 5432 - targetPort: postgresql + - port: 3306 + targetPort: mysql protocol: TCP - name: postgresql + name: mysql selector: {{- include "wordpress-website.selectorLabels" . | nindent 4 }} app.kubernetes.io/component: database diff --git a/charts/wordpress-helm/templates/deployment.yaml b/charts/wordpress-helm/templates/deployment.yaml index 916f440..a121f83 100644 --- a/charts/wordpress-helm/templates/deployment.yaml +++ b/charts/wordpress-helm/templates/deployment.yaml @@ -42,16 +42,16 @@ spec: protocol: TCP env: - name: WORDPRESS_DB_HOST - value: {{ .Values.postgresql.host }} + value: {{ .Values.mysql.host }} - name: WORDPRESS_DB_NAME - value: {{ .Values.postgresql.database }} + value: {{ .Values.mysql.database }} - name: WORDPRESS_DB_USER - value: {{ .Values.postgresql.username }} + value: {{ .Values.mysql.username }} - name: WORDPRESS_DB_PASSWORD valueFrom: secretKeyRef: - name: {{ .Values.fullname }}-postgresql - key: postgresql-password + name: {{ .Values.fullname }}-mysql + key: mysql-password - name: WORDPRESS_TABLE_PREFIX value: {{ .Values.wordpress.tablePrefix }} {{- if .Values.wordpress.authKey }} diff --git a/charts/wordpress-helm/values.yaml b/charts/wordpress-helm/values.yaml index cd488de..a36fd07 100644 --- a/charts/wordpress-helm/values.yaml +++ b/charts/wordpress-helm/values.yaml @@ -61,14 +61,15 @@ wordpress: loggedInSalt: "" nonceSalt: "" -postgresql: - host: "wordpress-website-postgresql" +mysql: + host: "wordpress-mysql" database: "wordpress" username: "wordpress" password: "changeme" + rootPassword: "rootpassword" image: - repository: postgres - tag: "15-alpine" + repository: mysql + tag: "8.0" pullPolicy: IfNotPresent resources: limits: