| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| {{- if .Values.components.zookeeper }} |
| apiVersion: apps/v1 |
| kind: StatefulSet |
| metadata: |
| name: {{ template "inlong.fullname" . }}-{{ .Values.zookeeper.component }} |
| namespace: {{ .Release.Namespace }} |
| labels: |
| {{- include "inlong.commonLabels" . | nindent 4 }} |
| component: {{ .Values.zookeeper.component }} |
| spec: |
| serviceName: {{ template "inlong.fullname" . }}-{{ .Values.zookeeper.component }} |
| replicas: {{ .Values.zookeeper.replicas }} |
| selector: |
| matchLabels: |
| {{- include "inlong.matchLabels" . | nindent 6 }} |
| component: {{ .Values.zookeeper.component }} |
| updateStrategy: |
| type: {{ .Values.zookeeper.updateStrategy.type | quote }} |
| podManagementPolicy: {{ .Values.zookeeper.podManagementPolicy | quote }} |
| template: |
| metadata: |
| labels: |
| {{- include "inlong.template.labels" . | nindent 8 }} |
| component: {{ .Values.zookeeper.component }} |
| {{- if .Values.zookeeper.annotations }} |
| annotations: |
| {{- toYaml .Values.zookeeper.annotations | nindent 8 }} |
| {{- end }} |
| spec: |
| {{- if .Values.zookeeper.tolerations }} |
| tolerations: |
| {{- toYaml .Values.zookeeper.tolerations | nindent 8 }} |
| {{- end }} |
| {{- if .Values.zookeeper.nodeSelector }} |
| nodeSelector: |
| {{- toYaml .Values.zookeeper.nodeSelector | nindent 8 }} |
| {{- end }} |
| {{- if .Values.zookeeper.affinity }} |
| affinity: |
| {{- if .Values.zookeeper.affinity.antiAffinity }} |
| podAntiAffinity: |
| requiredDuringSchedulingIgnoredDuringExecution: |
| - labelSelector: |
| matchExpressions: |
| - key: "app" |
| operator: In |
| values: |
| - "{{ template "inlong.name" . }}-{{ .Values.zookeeper.component }}" |
| - key: "release" |
| operator: In |
| values: |
| - {{ .Release.Name }} |
| - key: "component" |
| operator: In |
| values: |
| - {{ .Values.zookeeper.component }} |
| topologyKey: "kubernetes.io/hostname" |
| {{- end }} |
| {{- end }} |
| terminationGracePeriodSeconds: {{ .Values.zookeeper.terminationGracePeriodSeconds }} |
| containers: |
| - name: {{ template "inlong.fullname" . }}-{{ .Values.zookeeper.component }} |
| image: {{ .Values.images.tubemqServer.repository }}:{{ .Values.images.tubemqServer.tag }} |
| imagePullPolicy: {{ .Values.images.pullPolicy }} |
| {{- if .Values.zookeeper.resources }} |
| resources: |
| {{- toYaml .Values.zookeeper.resources | nindent 12 }} |
| {{- end }} |
| command: [ "/bin/sh", "-c" ] |
| args: |
| - > |
| /config-scripts/run |
| ports: |
| - name: zk-client-port |
| containerPort: 2181 |
| - name: zk-comm-port |
| containerPort: 2888 |
| - name: zk-elect-port |
| containerPort: 3888 |
| env: |
| - name: ZOOKEEPER_SERVERS |
| value: |
| {{- $global := . }} |
| {{ range $i, $e := until (.Values.zookeeper.replicas | int) }}{{ if ne $i 0 }},{{ end }}{{ template "inlong.fullname" $global }}-{{ $global.Values.zookeeper.component }}-{{ printf "%d" $i }}{{ end }} |
| - name: TZ |
| value: {{ .Values.timezone }} |
| {{- if .Values.zookeeper.probe.readiness.enabled }} |
| readinessProbe: |
| exec: |
| command: |
| - /config-scripts/ready |
| initialDelaySeconds: {{ .Values.zookeeper.probe.readiness.initialDelaySeconds }} |
| periodSeconds: {{ .Values.zookeeper.probe.readiness.periodSeconds }} |
| failureThreshold: {{ .Values.zookeeper.probe.readiness.failureThreshold }} |
| {{- end }} |
| {{- if .Values.zookeeper.probe.liveness.enabled }} |
| livenessProbe: |
| exec: |
| command: |
| - /config-scripts/ok |
| initialDelaySeconds: {{ .Values.zookeeper.probe.liveness.initialDelaySeconds }} |
| periodSeconds: {{ .Values.zookeeper.probe.liveness.periodSeconds }} |
| failureThreshold: {{ .Values.zookeeper.probe.liveness.failureThreshold }} |
| {{- end }} |
| volumeMounts: |
| - name: {{ template "inlong.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.volumes.name }} |
| mountPath: /data |
| - name: config |
| mountPath: /config-scripts |
| volumes: |
| - name: config |
| configMap: |
| name: |
| {{ template "inlong.fullname" . }}-{{ .Values.zookeeper.component }} |
| defaultMode: 0755 |
| {{- if not .Values.zookeeper.volumes.persistence }} |
| - name: {{ template "inlong.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.volumes.name }} |
| emptyDir: {} |
| {{- end }} |
| {{- if .Values.zookeeper.volumes.persistence }} |
| volumeClaimTemplates: |
| - metadata: |
| name: {{ template "inlong.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.volumes.name }} |
| spec: |
| accessModes: [ "ReadWriteOnce" ] |
| resources: |
| requests: |
| storage: {{ .Values.zookeeper.volumes.size }} |
| {{- if .Values.zookeeper.volumes.storageClassName }} |
| storageClassName: "{{ .Values.zookeeper.volumes.storageClassName }}" |
| {{- end }} |
| {{- end }} |
| {{- end }} |