Reorganized for new stable/waypoint versioning design.
This commit is contained in:
19
mysql/versions/9/README.md
Normal file
19
mysql/versions/9/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# MySQL
|
||||
|
||||
MySQL is an open-source relational database management system. This deploys a shared MySQL instance used by apps that require MySQL (such as Ghost).
|
||||
|
||||
## Dependencies
|
||||
|
||||
None. MySQL is a standalone infrastructure service.
|
||||
|
||||
## Configuration
|
||||
|
||||
Key settings configured through your instance's `config.yaml`:
|
||||
|
||||
- **storage** - Persistent volume size (default: `20Gi`)
|
||||
- **port** - Service port (default: `3306`)
|
||||
- **timezone** - Server timezone (default: `UTC`)
|
||||
|
||||
## Usage
|
||||
|
||||
Apps that depend on MySQL will connect to it at `mysql.mysql.svc.cluster.local:3306`. Database credentials are managed automatically through the secrets system.
|
||||
40
mysql/versions/9/configmap.yaml
Normal file
40
mysql/versions/9/configmap.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: mysql
|
||||
data:
|
||||
custom.cnf: |
|
||||
[mysqld]
|
||||
# Connection settings
|
||||
bind-address=0.0.0.0
|
||||
skip-name-resolve
|
||||
max_connections=200
|
||||
max_allowed_packet=64M
|
||||
|
||||
# Character set
|
||||
character-set-server=utf8mb4
|
||||
collation-server=utf8mb4_unicode_ci
|
||||
|
||||
# Performance tuning
|
||||
innodb_buffer_pool_size=512M
|
||||
innodb_log_file_size=128M
|
||||
innodb_flush_log_at_trx_commit=2
|
||||
innodb_flush_method=O_DIRECT
|
||||
|
||||
# Query optimization
|
||||
slow_query_log=1
|
||||
long_query_time=2
|
||||
slow_query_log_file=/var/lib/mysql/slow-query.log
|
||||
|
||||
# Timeout settings
|
||||
wait_timeout=600
|
||||
interactive_timeout=600
|
||||
|
||||
# Binary logging (optional, for replication)
|
||||
# server-id=1
|
||||
# log_bin=/var/lib/mysql/mysql-bin
|
||||
# binlog_format=ROW
|
||||
|
||||
[client]
|
||||
default-character-set=utf8mb4
|
||||
15
mysql/versions/9/kustomization.yaml
Normal file
15
mysql/versions/9/kustomization.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: mysql
|
||||
labels:
|
||||
- includeSelectors: true
|
||||
pairs:
|
||||
app: mysql
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- statefulset.yaml
|
||||
- service.yaml
|
||||
- service-headless.yaml
|
||||
- configmap.yaml
|
||||
11
mysql/versions/9/manifest.yaml
Normal file
11
mysql/versions/9/manifest.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 9.1.0-1
|
||||
requires: []
|
||||
defaultConfig:
|
||||
namespace: mysql
|
||||
host: mysql.mysql.svc.cluster.local
|
||||
storage: 20Gi
|
||||
dbName: mysql
|
||||
user: mysql
|
||||
defaultSecrets:
|
||||
- key: rootPassword
|
||||
- key: password
|
||||
4
mysql/versions/9/namespace.yaml
Normal file
4
mysql/versions/9/namespace.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: "{{ .namespace }}"
|
||||
16
mysql/versions/9/service-headless.yaml
Normal file
16
mysql/versions/9/service-headless.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mysql-headless
|
||||
namespace: mysql
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
publishNotReadyAddresses: true
|
||||
ports:
|
||||
- name: mysql
|
||||
port: 3306
|
||||
protocol: TCP
|
||||
targetPort: mysql
|
||||
selector:
|
||||
component: primary
|
||||
14
mysql/versions/9/service.yaml
Normal file
14
mysql/versions/9/service.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: mysql
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: mysql
|
||||
port: 3306
|
||||
protocol: TCP
|
||||
targetPort: mysql
|
||||
selector:
|
||||
component: primary
|
||||
116
mysql/versions/9/statefulset.yaml
Normal file
116
mysql/versions/9/statefulset.yaml
Normal file
@@ -0,0 +1,116 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: mysql
|
||||
spec:
|
||||
replicas: 1
|
||||
podManagementPolicy: Parallel
|
||||
serviceName: mysql-headless
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: primary
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: primary
|
||||
spec:
|
||||
serviceAccountName: default
|
||||
automountServiceAccountToken: false
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 999
|
||||
runAsGroup: 999
|
||||
fsGroup: 999
|
||||
fsGroupChangePolicy: Always
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: mysql
|
||||
image: mysql:9.1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
readOnlyRootFilesystem: false
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mysql-secrets
|
||||
key: rootPassword
|
||||
- name: MYSQL_USER
|
||||
value: {{ .user }}
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mysql-secrets
|
||||
key: password
|
||||
- name: MYSQL_DATABASE
|
||||
value: {{ .dbName }}
|
||||
- name: TZ
|
||||
value: UTC
|
||||
ports:
|
||||
- name: mysql
|
||||
containerPort: 3306
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- mysqladmin ping -h localhost --silent
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- mysql -h localhost -u root -p${MYSQL_ROOT_PASSWORD} -e "SELECT 1"
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
startupProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- mysqladmin ping -h localhost --silent
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 40
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/mysql
|
||||
- name: config
|
||||
mountPath: /etc/mysql/conf.d/custom.cnf
|
||||
subPath: custom.cnf
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: mysql
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .storage }}
|
||||
Reference in New Issue
Block a user