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

     1  apiVersion: apps.kubeblocks.io/v1alpha1
     2  kind: ClusterDefinition
     3  metadata:
     4    name: zookeeper
     5    labels:
     6      {{- include "zookeeper.labels" . | nindent 4 }}
     7  spec:
     8    type: zookeeper
     9    connectionCredential:
    10      username: ""
    11      password: ""
    12      endpoint: "$(SVC_FQDN):$(SVC_PORT_client)"
    13      host: "$(SVC_FQDN)"
    14      port: "$(SVC_PORT_client)"
    15    componentDefs:
    16      - name: zookeeper
    17        workloadType: Stateful
    18        characterType: zookeeper
    19        statefulSpec:
    20          updateStrategy: BestEffortParallel
    21        logConfigs:
    22          {{- range $name,$pattern := .Values.logConfigs }}
    23          - name: {{ $name }}
    24            filePathPattern: {{ $pattern }}
    25          {{- end }}
    26        configSpecs:
    27          - name: zookeeper-config
    28            namespace: {{ .Release.Namespace }}
    29            templateRef: {{ include "zookeeper.name" . }}-config-template
    30            constraintRef: {{ include "zookeeper.name" . }}-config-constraints
    31            volumeName: configs
    32            defaultMode: 0755
    33        service:
    34          ports:
    35            - name: client
    36              port: 2181
    37              targetPort: client
    38        podSpec:
    39          securityContext:
    40            fsGroup: 0
    41            runAsGroup: 0
    42            runAsNonRoot: true
    43            runAsUser: 10000
    44          containers:
    45            - name: zookeeper
    46              env:
    47                - name: K8S_REPLICAS
    48                  value: "$(KB_REPLICA_COUNT)"
    49                - name: STANDALONE_ENABLE
    50                  value: "false"
    51                - name: RE_CONFIG_ENABLE
    52                  value: "true"
    53                - name: ZOO_4LW_COMMANDS_WHITELIST
    54                  value: "srvr, mntr, ruok"
    55                - name: ZOO_LOG_DIR
    56                  value: "/opt/zookeeper/logs"
    57                - name: ZOO_LOG4J_PROP
    58                  value: "INFO,ROLLINGFILE"
    59                - name: DEBUG_MODEL
    60                  value: "true"
    61              ports:
    62                - name: client
    63                  containerPort: {{ .Values.containerPorts.client }}
    64                - name: tcp-quorum
    65                  containerPort: {{ .Values.containerPorts.quorum }}
    66                - name: tcp-election
    67                  containerPort: {{ .Values.containerPorts.election }}
    68                - name: http
    69                  containerPort: {{ .Values.containerPorts.http }}
    70              livenessProbe:
    71                failureThreshold: 6
    72                initialDelaySeconds: 30
    73                periodSeconds: 10
    74                successThreshold: 1
    75                timeoutSeconds: 5
    76                exec:
    77                  command: [ '/bin/bash', '-c', 'echo "ruok" | timeout 2 nc -w 2 localhost {{ .Values.containerPorts.client }} | grep imok' ]
    78              readinessProbe:
    79                failureThreshold: 6
    80                initialDelaySeconds: 5
    81                periodSeconds: 10
    82                successThreshold: 1
    83                timeoutSeconds: 5
    84                exec:
    85                  command: [ '/bin/bash', '-c', 'echo "ruok" | timeout 2 nc -w 2 localhost {{ .Values.containerPorts.client }} | grep imok' ]
    86              resources:
    87                requests:
    88                  cpu: 50m
    89                  memory: 256Mi
    90              securityContext:
    91                allowPrivilegeEscalation: false
    92                capabilities:
    93                  drop:
    94                    - ALL
    95                privileged: false
    96                runAsGroup: 0
    97                runAsNonRoot: true
    98                runAsUser: 10000
    99              volumeMounts:
   100                - mountPath: /zookeeper/data
   101                  name: data
   102                - mountPath: /zookeeper/log
   103                  name: data-log
   104                - name: configs
   105                  mountPath: /opt/zookeeper/conf/zoo.cfg
   106                  subPath: zoo.cfg