github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/mysql/templates/clusterdefinition.yaml (about)

     1  apiVersion: apps.kubeblocks.io/v1alpha1
     2  kind: ClusterDefinition
     3  metadata:
     4    name: mysql
     5    labels:
     6      {{- include "mysql.labels" . | nindent 4 }}
     7  spec:
     8    type: mysql
     9    connectionCredential:
    10      username: root
    11      password: "$(RANDOM_PASSWD)"
    12      endpoint: "$(SVC_FQDN):$(SVC_PORT_mysql)"
    13      host: "$(SVC_FQDN)"
    14      port: "$(SVC_PORT_mysql)"
    15    componentDefs:
    16      - name: mysql
    17        characterType: mysql
    18        probes:
    19          roleProbe:
    20            failureThreshold: {{ .Values.roleProbe.failureThreshold }}
    21            periodSeconds: {{ .Values.roleProbe.periodSeconds }}
    22            timeoutSeconds: {{ .Values.roleProbe.timeoutSeconds }}
    23        workloadType: Replication
    24        service:
    25          ports:
    26            - name: mysql
    27              port: 3306
    28              targetPort: mysql
    29        monitor:
    30          builtIn: false
    31          exporterConfig:
    32            scrapePath: /metrics
    33            scrapePort: {{ .Values.metrics.service.port }}
    34        configSpecs:
    35          - name: mysql-replication-config
    36            templateRef: mysql8.0.33-config-template
    37            constraintRef: mysql8.0.33-config-constraints
    38            volumeName: mysql-config
    39            namespace: {{ .Release.Namespace }}
    40          - name: agamotto-configuration
    41            templateRef: mysql-agamotto-configuration
    42            namespace: {{ .Release.Namespace }}
    43            volumeName: agamotto-configuration
    44            defaultMode: 0444
    45        scriptSpecs:
    46          - name: mysql-scripts
    47            templateRef: mysql-scripts
    48            namespace: {{ .Release.Namespace }}
    49            volumeName: scripts
    50            defaultMode: 0555
    51        volumeTypes:
    52          - name: data
    53            type: data
    54        podSpec:
    55          containers:
    56            - name: mysql
    57              imagePullPolicy: IfNotPresent
    58              command:
    59                - bash 
    60                - -c
    61                - "docker-entrypoint.sh mysqld --server-id $(( ${KB_POD_NAME##*-} + 1))"
    62              volumeMounts:
    63                - mountPath: /var/lib/mysql
    64                  name: data
    65                - mountPath: /etc/mysql/conf.d
    66                  name: mysql-config
    67              ports:
    68                - containerPort: 3306
    69                  name: mysql
    70              env:
    71                - name: MYSQL_ROOT_HOST
    72                  value: {{ .Values.auth.rootHost | default "%" | quote }}
    73                - name: MYSQL_ROOT_USER
    74                  valueFrom:
    75                    secretKeyRef:
    76                      name: $(CONN_CREDENTIAL_SECRET_NAME)
    77                      key: username
    78                      optional: false
    79                - name: MYSQL_ROOT_PASSWORD
    80                  valueFrom:
    81                    secretKeyRef:
    82                      name: $(CONN_CREDENTIAL_SECRET_NAME)
    83                      key: password
    84                      optional: false
    85            - name: metrics
    86              image:  {{ .Values.metrics.image.registry | default "docker.io" }}/{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}
    87              imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
    88              securityContext:
    89                runAsNonRoot: false
    90                runAsUser: 0
    91              env:
    92                - name: DB_TYPE
    93                  value: MySQL
    94                - name: ENDPOINT
    95                  value: "localhost:3306"
    96                - name: MYSQL_USER
    97                  valueFrom:
    98                    secretKeyRef:
    99                      name: $(CONN_CREDENTIAL_SECRET_NAME)
   100                      key: username
   101                      optional: false
   102                - name: MYSQL_PASSWORD
   103                  valueFrom:
   104                    secretKeyRef:
   105                      name: $(CONN_CREDENTIAL_SECRET_NAME)
   106                      key: password
   107                      optional: false
   108              command: ["/scripts/agamotto.sh"]
   109              ports:
   110                - name: http-metrics
   111                  containerPort: {{ .Values.metrics.service.port }}
   112              volumeMounts:
   113                - name: agamotto-configuration
   114                  mountPath: /opt/agamotto
   115                - name: data
   116                  mountPath: /data/mysql
   117                - name: log-data
   118                  mountPath: /var/log/kubeblocks
   119                  readOnly: false
   120                - name: scripts
   121                  mountPath: /scripts