github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/foxlake/templates/clusterdefinition.yaml (about) 1 apiVersion: apps.kubeblocks.io/v1alpha1 2 kind: ClusterDefinition 3 metadata: 4 name: foxlake 5 labels: 6 {{- include "foxlake.labels" . | nindent 4 }} 7 spec: 8 connectionCredential: 9 username: "foxlake_root" 10 password: "$(RANDOM_PASSWD)" 11 endpoint: "$(SVC_FQDN):$(SVC_PORT_foxlake)" 12 host: "$(SVC_FQDN)" 13 port: "$(SVC_PORT_foxlake)" 14 metaDbPasswd: "$(RANDOM_PASSWD)" 15 componentDefs: 16 - name: foxlake-server 17 workloadType: Stateless 18 characterType: foxlake 19 service: 20 ports: 21 - name: foxlake 22 targetPort: foxlake 23 port: 11288 24 - name: foxlake-coordinator 25 targetPort: mpp 26 port: 10030 27 podSpec: 28 securityContext: 29 fsGroup: 1001 30 seccompProfile: 31 type: RuntimeDefault 32 initContainers: 33 - name: wait-mysql-ready 34 image: busybox:1.35 35 command: [ "sh" ] 36 args: [ "-c", 'echo -e "Checking for the availability of MySQL Server deployment"; while ! nc -z $(MYSQL_SERVICE_NAME) 3306; do sleep 1; printf "-"; done; echo -e " >> MySQL Server has started";' ] 37 env: 38 - name: MYSQL_SERVICE_NAME 39 value: "{{ include "foxlake.metadb.fqdn" . }}" 40 resources: 41 limits: 42 cpu: "10m" 43 memory: "64Mi" 44 - name: foxlake-gms-initializer 45 env: 46 - name: initializeGms 47 value: "true" 48 {{- include "foxlake.env" . | nindent 14 }} 49 resources: 50 limits: 51 cpu: "100m" 52 memory: "1Gi" 53 containers: 54 - name: foxlake 55 ports: 56 - containerPort: 10030 57 name: mpp 58 - containerPort: 11288 59 name: foxlake 60 env: 61 {{- include "foxlake.env" . | nindent 14 }} 62 systemAccounts: 63 cmdExecutorConfig: 64 image: {{ .Values.images.mysql.repository }}:{{ .Values.images.mysql.tag }} 65 command: 66 - mysql 67 args: 68 - -u$(MYSQL_ROOT_USER) 69 - -p$(MYSQL_ROOT_PASSWORD) 70 - -h$(KB_ACCOUNT_ENDPOINT) 71 - -P$(SVC_PORT) 72 - -e 73 - "$(KB_ACCOUNT_STATEMENT)" 74 env: 75 - name: MYSQL_ROOT_USER 76 valueFrom: 77 secretKeyRef: 78 name: $(CONN_CREDENTIAL_SECRET_NAME) 79 key: username 80 - name: MYSQL_ROOT_PASSWORD 81 valueFrom: 82 secretKeyRef: 83 name: $(CONN_CREDENTIAL_SECRET_NAME) 84 key: password 85 - name: SVC_PORT 86 valueFrom: 87 secretKeyRef: 88 name: $(CONN_CREDENTIAL_SECRET_NAME) 89 key: port 90 passwordConfig: 91 length: 10 92 numDigits: 5 93 numSymbols: 0 94 letterCase: MixedCases 95 accounts: 96 - name: kbadmin 97 provisionPolicy: 98 type: CreateByStmt 99 scope: AnyPods 100 statements: 101 creation: CREATE USER IF NOT EXISTS $(USERNAME) IDENTIFIED BY '$(PASSWD)'; GRANT ALL PRIVILEGES ON *.* TO $(USERNAME); 102 update: ALTER USER $(USERNAME) IDENTIFIED BY '$(PASSWD)'; 103 deletion: DROP USER IF EXISTS $(USERNAME); 104 - name: foxlake-metadb 105 workloadType: Stateful 106 characterType: mysql 107 service: 108 ports: 109 - name: mysql 110 port: 3306 111 targetPort: mysql 112 podSpec: 113 containers: 114 - name: mysql 115 env: 116 - name: MYSQL_ROOT_PASSWORD 117 valueFrom: 118 secretKeyRef: 119 name: $(CONN_CREDENTIAL_SECRET_NAME) 120 key: metaDbPasswd 121 args: 122 - "--max_connections=2048" 123 - "--max_allowed_packet=1G" 124 - "--transaction-isolation=READ-COMMITTED" 125 ports: 126 - containerPort: 3306 127 name: mysql 128 volumeMounts: 129 - name: data 130 mountPath: /var/lib/mysql