Skip to content

Commit

Permalink
Adding minion stateless k8s deployment for minion and by default turn…
Browse files Browse the repository at this point in the history
… off minion statefulset deployment. (#8936)
  • Loading branch information
xiangfu0 authored Jun 20, 2022
1 parent c77c731 commit 5b2b4aa
Show file tree
Hide file tree
Showing 11 changed files with 309 additions and 5 deletions.
6 changes: 3 additions & 3 deletions kubernetes/helm/pinot/requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
dependencies:
- name: zookeeper
repository: https://charts.bitnami.com/bitnami
version: 7.0.0
digest: sha256:db1ecacbb7016e8c0d9c6642c917461d6190ef88fb9a2a5147b2230e94c64eab
generated: "2021-12-22T12:04:57.707437-08:00"
version: 9.2.7
digest: sha256:a5da7ddd352d63b0a0e1e5bd85e90e304ae5d0fa7759d5cb7ffb39f61adef1e9
generated: "2022-06-20T14:57:34.981883-07:00"
2 changes: 1 addition & 1 deletion kubernetes/helm/pinot/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@

dependencies:
- name: zookeeper
version: 7.0.0
version: 9.x.x
repository: https://charts.bitnami.com/bitnami
condition: pinot.zookeeper.enabled,zookeeper.enabled
33 changes: 33 additions & 0 deletions kubernetes/helm/pinot/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ Minion labels
component: {{ .Values.minion.name }}
{{- end }}

{{/*
minionStateless labels
*/}}
{{- define "pinot.minionStatelessLabels" -}}
{{- include "pinot.labels" . }}
component: {{ .Values.minionStateless.name }}
{{- end }}

{{/*
Server labels
*/}}
Expand Down Expand Up @@ -135,6 +143,15 @@ component: {{ .Values.minion.name }}
{{- end }}


{{/*
MinionStateless Match Selector labels
*/}}
{{- define "pinot.minionStatelessMatchLabels" -}}
{{- include "pinot.matchLabels" . }}
component: {{ .Values.minionStateless.name }}
{{- end }}


{{/*
Server Match Selector labels
*/}}
Expand Down Expand Up @@ -217,6 +234,15 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{ template "pinot.fullname" . }}-{{ .Values.minion.name }}
{{- end -}}


{{/*
Create a default fully qualified pinot minion stateless name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "pinot.minionStateless.fullname" -}}
{{ template "pinot.fullname" . }}-{{ .Values.minionStateless.name }}
{{- end -}}

{{/*
The name of the pinot controller headless service.
*/}}
Expand Down Expand Up @@ -286,3 +312,10 @@ The name of the pinot minion config.
{{- define "pinot.minion.config" -}}
{{- printf "%s-config" (include "pinot.minion.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
The name of the pinot minion stateless config.
*/}}
{{- define "pinot.minionStateless.config" -}}
{{- printf "%s-config" (include "pinot.minionStateless.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
32 changes: 32 additions & 0 deletions kubernetes/helm/pinot/templates/minion-stateless/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# 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.minionStateless.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pinot.minionStateless.config" . }}
data:
pinot-minion-stateless.conf: |-
pinot.minion.port={{ .Values.minionStateless.service.port }}
{{- if .Values.minionStateless.dataDir }}
dataDir={{ .Values.minionStateless.dataDir }}
{{- end }}
{{ .Values.minionStateless.extra.configs | indent 4 }}
{{- end }}
121 changes: 121 additions & 0 deletions kubernetes/helm/pinot/templates/minion-stateless/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#
# 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.minionStateless.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "pinot.minionStateless.fullname" . }}
labels:
{{- include "pinot.minionStatelessLabels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "pinot.minionStatelessMatchLabels" . | nindent 6 }}
replicas: {{ .Values.minionStateless.replicaCount }}
template:
metadata:
labels:
{{- include "pinot.minionStatelessLabels" . | nindent 8 }}
annotations:
{{ toYaml .Values.minionStateless.podAnnotations | indent 8 }}
spec:
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
securityContext:
{{- toYaml .Values.minionStateless.podSecurityContext | nindent 8 }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
nodeSelector:
{{ toYaml .Values.minionStateless.nodeSelector | indent 8 }}
affinity:
{{ toYaml .Values.minionStateless.affinity | indent 8 }}
tolerations:
{{ toYaml .Values.minionStateless.tolerations | indent 8 }}
containers:
- name: minion-stateless
securityContext:
{{- toYaml .Values.minionStateless.securityContext | nindent 10 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: [
"StartMinion",
"-clusterName", "{{ .Values.cluster.name }}",
"-zkAddress", {{ include "zookeeper.url" . | quote }},
"-configFileName", "/var/pinot/minion/config/pinot-minion-stateless.conf"
]
env:
- name: JAVA_OPTS
value: "{{ .Values.minionStateless.jvmOpts }} -Dlog4j2.configurationFile={{ .Values.minionStateless.log4j2ConfFile }} -Dplugins.dir={{ .Values.minionStateless.pluginsDir }}"
{{- if .Values.minionStateless.extraEnv }}
{{ toYaml .Values.minionStateless.extraEnv | indent 10 }}
{{- end }}
envFrom:
{{ toYaml .Values.minionStateless.envFrom | indent 10 }}
ports:
- containerPort: {{ .Values.minionStateless.service.port }}
protocol: {{ .Values.minionStateless.service.protocol }}
name: {{ .Values.minionStateless.service.name }}
{{- if .Values.minionStateless.probes.livenessEnabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.probes.initialDelaySeconds }}
periodSeconds: {{ .Values.probes.periodSeconds }}
httpGet:
path: {{ .Values.minionStateless.probes.endpoint }}
port: {{ .Values.minionStateless.service.port }}
{{- end }}
{{- if .Values.minionStateless.probes.readinessEnabled }}
readinessProbe:
initialDelaySeconds: {{ .Values.probes.initialDelaySeconds }}
periodSeconds: {{ .Values.probes.periodSeconds }}
httpGet:
path: {{ .Values.minionStateless.probes.endpoint }}
port: {{ .Values.minionStateless.service.port }}
{{- end }}
volumeMounts:
- name: config
mountPath: /var/pinot/minion/config
{{- if .Values.minionStateless.persistence.enabled }}
- name: data
mountPath: "{{ .Values.minionStateless.persistence.mountPath }}"
{{- end }}
{{- if ne (len .Values.minionStateless.persistence.extraVolumeMounts) 0 }}
{{ toYaml .Values.minionStateless.persistence.extraVolumeMounts | indent 10 }}
{{- end }}
resources:
{{ toYaml .Values.minionStateless.resources | indent 12 }}
restartPolicy: Always
volumes:
- name: config
configMap:
name: {{ include "pinot.minionStateless.config" . }}
{{- if not .Values.minionStateless.persistence.enabled }}
- name: data
emptyDir: {}
{{- end }}
{{- if .Values.minionStateless.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ .Values.minionStateless.persistence.pvcName }}
{{- end }}
{{- if ne (len .Values.minionStateless.persistence.extraVolumes) 0 }}
{{ toYaml .Values.minionStateless.persistence.extraVolumes | indent 8 }}
{{- end }}
{{- end }}
40 changes: 40 additions & 0 deletions kubernetes/helm/pinot/templates/minion-stateless/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# 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.minionStateless.enabled }}
{{- if .Values.minionStateless.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Values.minionStateless.persistence.pvcName }}
spec:
accessModes:
- {{ .Values.minionStateless.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.minionStateless.persistence.size }}
{{- if .Values.minionStateless.persistence.storageClass }}
{{- if (eq "-" .Values.minionStateless.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.minionStateless.persistence.storageClass }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions kubernetes/helm/pinot/templates/minion/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# under the License.
#

{{- if .Values.minion.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -28,3 +29,4 @@ data:
dataDir={{ .Values.minion.dataDir }}
{{- end }}
{{ .Values.minion.extra.configs | indent 4 }}
{{- end }}
2 changes: 2 additions & 0 deletions kubernetes/helm/pinot/templates/minion/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# under the License.
#

{{- if .Values.minion.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -31,3 +32,4 @@ spec:
port: {{ .Values.minion.service.port }}
selector:
{{- include "pinot.minionMatchLabels" . | nindent 4 }}
{{- end }}
2 changes: 2 additions & 0 deletions kubernetes/helm/pinot/templates/minion/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# under the License.
#

{{- if .Values.minion.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -33,3 +34,4 @@ spec:
port: {{ .Values.minion.service.port }}
selector:
{{- include "pinot.minionMatchLabels" . | nindent 4 }}
{{- end }}
2 changes: 2 additions & 0 deletions kubernetes/helm/pinot/templates/minion/statefulset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# under the License.
#

{{- if .Values.minion.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand Down Expand Up @@ -135,3 +136,4 @@ spec:
requests:
storage: {{ .Values.minion.persistence.size }}
{{ end }}
{{- end }}
Loading

0 comments on commit 5b2b4aa

Please sign in to comment.