Objects required for creating a cluster:
DB credentials
apiVersion: v1
kind: Secret
metadata:
name: my-cluster-db-credentials
type: Opaque
data:
ROOT_PASSWORD: ~RANDOM
REPLICATION_USER: ~replication
REPLICATION_PASSWORD: ~RANDOM
USER: ~DATABASE
PASSWORD: ~RANDOM
DATABASE: ~if exists and not empty, fill in USER and PASSWORD if not specified
Backup credentials (the init credentials use the same format)
apiVersion: v1
kind: Secret
metadata:
name: backup-credentials
type: Opaque
data:
AWS_ACCESS_KEY_ID:
AWS_SECRET_ACCESS_KEY:
S3_STORAGE_CLASS: (if not specified STANDARD_IA)
S3_REGION: (if not specified us-east-1)
S3_ENDPOINT_URL:
GOOGLE_SERVICE_ACCOUNT_JSON_KEY:
GOOGLE_PROJECT_ID:
GCS_STORAGE_CLASS: (if not specified COLDLINE)
Mysql cluster CRD
apiVersion: titanium.presslabs.net/v1alpha1
kind: MysqlCluster
metadata:
name: my-cluster
spec:
readReplicas: 0
secretName: ^^MysqlCluster.name-db-credentials
mysqlVersion: 5.7.10
initBucketURI: gs://..., s3://
initBucketSecretName: ~
mysqlConf:
skip-character-set-client-handshake: true
...
backupBucketURI: gs://name/prefix/a/b, s3://name/prefix/a/b
backupBucketSecretName: ~
backupSchedule: ""
podSpec:
labels:
app: mysql
titanium-cluster: ^^MysqlCluster.name
annotations: {}
resources: {}
afinity: {}
nodeSelector: {}
volumeClaimTemplate:
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims
This should create/update the following resources (in this order):
- DB Credentials secret
- A secret with utility user credentials
- Headless service
- Statefull set
We should continuously sync the StatefullSet status with our CRD.