# 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.middleManager.enabled -}} apiVersion: apps/v1 kind: StatefulSet metadata: labels: app: {{ template "druid.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: {{ .Values.middleManager.name }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ template "druid.middleManager.fullname" . }} spec: serviceName: {{ template "druid.middleManager.fullname" . }} replicas: {{ .Values.middleManager.replicaCount }} selector: matchLabels: app: {{ include "druid.name" . }} release: {{ .Release.Name }} component: {{ .Values.middleManager.name }} template: metadata: labels: app: {{ template "druid.name" . }} component: {{ .Values.middleManager.name }} release: {{ .Release.Name }} {{- if .Values.middleManager.podAnnotations }} annotations: {{ toYaml .Values.middleManager.podAnnotations | indent 8 }} {{- end }} spec: {{- if or .Values.middleManager.antiAffinity .Values.middleManager.nodeAffinity }} affinity: {{- end }} {{- if eq .Values.middleManager.antiAffinity "hard" }} podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - topologyKey: "kubernetes.io/hostname" labelSelector: matchLabels: app: "{{ template "druid.name" . }}" release: "{{ .Release.Name }}" component: "{{ .Values.middleManager.name }}" {{- else if eq .Values.middleManager.antiAffinity "soft" }} podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 1 podAffinityTerm: topologyKey: kubernetes.io/hostname labelSelector: matchLabels: app: "{{ template "druid.name" . }}" release: "{{ .Release.Name }}" component: "{{ .Values.middleManager.name }}" {{- end }} {{- with .Values.middleManager.nodeAffinity }} nodeAffinity: {{ toYaml . | indent 10 }} {{- end }} {{- if .Values.middleManager.nodeSelector }} nodeSelector: {{ toYaml .Values.middleManager.nodeSelector | indent 8 }} {{- end }} {{- if .Values.middleManager.securityContext }} securityContext: {{ toYaml .Values.middleManager.securityContext | indent 8 }} {{- end }} {{- if .Values.middleManager.tolerations }} tolerations: {{ toYaml .Values.middleManager.tolerations | indent 8 }} {{- end }} {{- if .Values.image.pullSecrets }} imagePullSecrets: {{ toYaml .Values.image.pullSecrets | indent 8 }} {{- end }} containers: - name: druid args: [ "middleManager" ] env: {{- range $key, $val := .Values.middleManager.config }} - name: {{ $key }} value: {{ $val | quote }} {{- end}} envFrom: - configMapRef: name: {{ template "druid.name" . }} resources: {{ toYaml .Values.middleManager.resources | indent 12 }} livenessProbe: initialDelaySeconds: 60 httpGet: path: /status/health port: {{ .Values.middleManager.port }} readinessProbe: initialDelaySeconds: 60 httpGet: path: /status/health port: {{ .Values.middleManager.port }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy | quote }} ports: - containerPort: {{ .Values.middleManager.port }} name: http volumeMounts: - mountPath: /opt/druid/var/druid/ name: data {{- if .Values.gCloudStorage.enabled }} - name: google-cloud-key mountPath: /var/secrets/google {{- end }} volumes: {{- if not .Values.middleManager.persistence.enabled }} - name: data emptyDir: {} {{- end }} {{- if .Values.gCloudStorage.enabled }} - name: google-cloud-key secret: secretName: {{ .Values.gCloudStorage.secretName }} {{- end }} updateStrategy: type: {{ .Values.middleManager.updateStrategy.type }} {{- if .Values.middleManager.persistence.enabled }} volumeClaimTemplates: - metadata: name: data spec: accessModes: - {{ .Values.middleManager.persistence.accessMode | quote }} {{- if .Values.middleManager.persistence.storageClass }} {{- if (eq "-" .Values.middleManager.persistence.storageClass) }} storageClassName: "" {{- else }} storageClassName: "{{ .Values.middleManager.persistence.storageClass }}" {{- end }} {{- end }} resources: requests: storage: "{{ .Values.middleManager.persistence.size }}" {{- end }} {{- end }}