Updates mysql to not use bitnami.

This commit is contained in:
2025-10-18 18:57:22 +00:00
parent db621755b3
commit 47c23d3f1b
3 changed files with 68 additions and 130 deletions

View File

@@ -20,46 +20,13 @@ spec:
serviceAccountName: default
automountServiceAccountToken: false
securityContext:
fsGroup: 1001
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
fsGroup: 999
fsGroupChangePolicy: Always
initContainers:
- name: preserve-logs-symlinks
image: {{ .apps.mysql.image }}
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 1001
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: RuntimeDefault
resources:
limits:
cpu: 250m
ephemeral-storage: 1Gi
memory: 256Mi
requests:
cpu: 100m
ephemeral-storage: 50Mi
memory: 128Mi
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
. /opt/bitnami/scripts/libfs.sh
# We copy the logs folder because it has symlinks to stdout and stderr
if ! is_dir_empty /opt/bitnami/mysql/logs; then
cp -r /opt/bitnami/mysql/logs /emptydir/app-logs-dir
fi
volumeMounts:
- name: empty-dir
mountPath: /emptydir
seccompProfile:
type: RuntimeDefault
containers:
- name: mysql
image: {{ .apps.mysql.image }}
@@ -69,15 +36,8 @@ spec:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 1001
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: RuntimeDefault
readOnlyRootFilesystem: false
env:
- name: BITNAMI_DEBUG
value: "false"
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
@@ -92,83 +52,59 @@ spec:
key: apps.mysql.password
- name: MYSQL_DATABASE
value: {{ .apps.mysql.dbName }}
- name: MYSQL_PORT
value: "{{ .apps.mysql.port }}"
- name: TZ
value: {{ .apps.mysql.timezone }}
ports:
- name: mysql
containerPort: {{ .apps.mysql.port }}
protocol: TCP
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
exec:
command:
- /bin/bash
- -ec
- |
password_aux="${MYSQL_ROOT_PASSWORD:-}"
mysqladmin status -uroot -p"${password_aux}"
- /bin/sh
- -c
- mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
exec:
command:
- /bin/bash
- -ec
- |
password_aux="${MYSQL_ROOT_PASSWORD:-}"
mysqladmin ping -uroot -p"${password_aux}" | grep "mysqld is alive"
- /bin/sh
- -c
- mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
startupProbe:
failureThreshold: 10
exec:
command:
- /bin/sh
- -c
- mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
exec:
command:
- /bin/bash
- -ec
- |
password_aux="${MYSQL_ROOT_PASSWORD:-}"
mysqladmin ping -uroot -p"${password_aux}" | grep "mysqld is alive"
timeoutSeconds: 5
failureThreshold: 30
resources:
limits:
cpu: 750m
ephemeral-storage: 2Gi
memory: 768Mi
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
ephemeral-storage: 50Mi
memory: 512Mi
volumeMounts:
- name: data
mountPath: /bitnami/mysql
- name: empty-dir
mountPath: /tmp
subPath: tmp-dir
- name: empty-dir
mountPath: /opt/bitnami/mysql/conf
subPath: app-conf-dir
- name: empty-dir
mountPath: /opt/bitnami/mysql/tmp
subPath: app-tmp-dir
- name: empty-dir
mountPath: /opt/bitnami/mysql/logs
subPath: app-logs-dir
mountPath: /var/lib/mysql
- name: config
mountPath: /opt/bitnami/mysql/conf/my.cnf
subPath: my.cnf
mountPath: /etc/mysql/conf.d/custom.cnf
subPath: custom.cnf
volumes:
- name: config
configMap:
name: mysql
- name: empty-dir
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: data