(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 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: {{ .Values.fullname }}-postgresql name: {{ .Values.fullname }}-mysql
labels: labels:
{{- include "wordpress-website.labels" . | nindent 4 }} {{- include "wordpress-website.labels" . | nindent 4 }}
app.kubernetes.io/component: database app.kubernetes.io/component: database
spec: spec:
serviceName: {{ .Values.fullname }}-postgresql serviceName: {{ .Values.fullname }}-mysql
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
@ -19,37 +19,36 @@ spec:
app.kubernetes.io/component: database app.kubernetes.io/component: database
spec: spec:
securityContext: securityContext:
{{- toYaml .Values.postgresql.podSecurityContext | nindent 8 }} {{- toYaml .Values.mysql.podSecurityContext | nindent 8 }}
containers: containers:
- name: postgresql - name: mysql
image: "{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}" image: "{{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}"
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }} imagePullPolicy: {{ .Values.mysql.image.pullPolicy }}
ports: ports:
- name: postgresql - name: mysql
containerPort: 5432 containerPort: 3306
protocol: TCP protocol: TCP
env: env:
- name: POSTGRES_DB - name: MYSQL_DATABASE
value: {{ .Values.postgresql.database }} value: {{ .Values.mysql.database }}
- name: POSTGRES_USER - name: MYSQL_USER
value: {{ .Values.postgresql.username }} value: {{ .Values.mysql.username }}
- name: POSTGRES_PASSWORD - name: MYSQL_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ .Values.fullname }}-postgresql name: {{ .Values.fullname }}-mysql
key: postgresql-password key: mysql-password
- name: PGDATA - name: MYSQL_ROOT_PASSWORD
value: /var/lib/postgresql/data/pgdata valueFrom:
- name: PGUSER secretKeyRef:
value: {{ .Values.postgresql.username }} name: {{ .Values.fullname }}-mysql
- name: PGDATABASE key: mysql-root-password
value: {{ .Values.postgresql.database }}
livenessProbe: livenessProbe:
exec: exec:
command: command:
- /bin/sh - /bin/sh
- -c - -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 initialDelaySeconds: 30
periodSeconds: 10 periodSeconds: 10
timeoutSeconds: 5 timeoutSeconds: 5
@ -60,36 +59,36 @@ spec:
command: command:
- /bin/sh - /bin/sh
- -c - -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 initialDelaySeconds: 5
periodSeconds: 10 periodSeconds: 10
timeoutSeconds: 5 timeoutSeconds: 5
successThreshold: 1 successThreshold: 1
failureThreshold: 6 failureThreshold: 6
resources: resources:
{{- toYaml .Values.postgresql.resources | nindent 12 }} {{- toYaml .Values.mysql.resources | nindent 12 }}
volumeMounts: volumeMounts:
- name: postgresql-data - name: mysql-data
mountPath: /var/lib/postgresql/data mountPath: /var/lib/mysql
volumes: volumes:
- name: postgresql-data - name: mysql-data
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ .Values.fullname }}-postgresql-data claimName: {{ .Values.fullname }}-mysql-data
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ .Values.fullname }}-postgresql name: {{ .Values.fullname }}-mysql
labels: labels:
{{- include "wordpress-website.labels" . | nindent 4 }} {{- include "wordpress-website.labels" . | nindent 4 }}
app.kubernetes.io/component: database app.kubernetes.io/component: database
spec: spec:
type: ClusterIP type: ClusterIP
ports: ports:
- port: 5432 - port: 3306
targetPort: postgresql targetPort: mysql
protocol: TCP protocol: TCP
name: postgresql name: mysql
selector: selector:
{{- include "wordpress-website.selectorLabels" . | nindent 4 }} {{- include "wordpress-website.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: database app.kubernetes.io/component: database

View File

@ -42,16 +42,16 @@ spec:
protocol: TCP protocol: TCP
env: env:
- name: WORDPRESS_DB_HOST - name: WORDPRESS_DB_HOST
value: {{ .Values.postgresql.host }} value: {{ .Values.mysql.host }}
- name: WORDPRESS_DB_NAME - name: WORDPRESS_DB_NAME
value: {{ .Values.postgresql.database }} value: {{ .Values.mysql.database }}
- name: WORDPRESS_DB_USER - name: WORDPRESS_DB_USER
value: {{ .Values.postgresql.username }} value: {{ .Values.mysql.username }}
- name: WORDPRESS_DB_PASSWORD - name: WORDPRESS_DB_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ .Values.fullname }}-postgresql name: {{ .Values.fullname }}-mysql
key: postgresql-password key: mysql-password
- name: WORDPRESS_TABLE_PREFIX - name: WORDPRESS_TABLE_PREFIX
value: {{ .Values.wordpress.tablePrefix }} value: {{ .Values.wordpress.tablePrefix }}
{{- if .Values.wordpress.authKey }} {{- if .Values.wordpress.authKey }}

View File

@ -61,14 +61,15 @@ wordpress:
loggedInSalt: "" loggedInSalt: ""
nonceSalt: "" nonceSalt: ""
postgresql: mysql:
host: "wordpress-website-postgresql" host: "wordpress-mysql"
database: "wordpress" database: "wordpress"
username: "wordpress" username: "wordpress"
password: "changeme" password: "changeme"
rootPassword: "rootpassword"
image: image:
repository: postgres repository: mysql
tag: "15-alpine" tag: "8.0"
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
resources: resources:
limits: limits: