(1.0.11) devops: migrate wordpress helm from postgresql to mysql with statefulset rename, updated images/ports, env and secret keys, services, volumes, and values references
Some checks failed
package-helm-chart / package-helm-chart (push) Failing after 7s

This commit is contained in:
Rebecca Valente 2025-09-23 12:17:33 -03:00
parent c6aaf43ec9
commit 54c422b8a5
3 changed files with 41 additions and 41 deletions

View File

@ -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

View File

@ -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 }}

View File

@ -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: