Skip to content

Commit

Permalink
[HELM]: Added namespace support in K8s deployment. (#13380)
Browse files Browse the repository at this point in the history
* Added namespace support in Helm deployment.

* Changes for namespace support in pinot helm chart.

* minor changes, as per the PR comment.
  • Loading branch information
abhioncbr authored Jun 20, 2024
1 parent 6883a4d commit 74e1a14
Show file tree
Hide file tree
Showing 32 changed files with 183 additions and 19 deletions.
11 changes: 11 additions & 0 deletions helm/pinot/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,14 @@ The name of the pinot minion stateless config.
{{- define "pinot.minionStateless.config" -}}
{{- printf "%s-config" (include "pinot.minionStateless.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Return pinot namespace to use
*/}}
{{- define "pinot.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions helm/pinot/templates/broker/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pinot.broker.config" . }}
namespace: {{ include "pinot.namespace" . }}
data:
pinot-broker.conf: |-
pinot.broker.client.queryPort={{ .Values.broker.service.port }}
Expand Down
28 changes: 24 additions & 4 deletions helm/pinot/templates/broker/ingress-v1.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
{{- if .Values.broker.ingress.v1.enabled -}}
{{- $ingressPath := .Values.broker.ingress.v1.path -}}
{{- $serviceName := include "pinot.broker.fullname" . -}}
{{- $servicePort := .Values.broker.service.port -}}
#
# 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.broker.ingress.v1.enabled }}
{{- $ingressPath := .Values.broker.ingress.v1.path }}
{{- $serviceName := include "pinot.broker.fullname" . }}
{{- $servicePort := .Values.broker.service.port }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $serviceName }}
namespace: {{ include "pinot.namespace" . }}
{{- if .Values.broker.ingress.v1.annotations }}
annotations:
{{ toYaml .Values.broker.ingress.v1.annotations | indent 4 }}
Expand Down
28 changes: 24 additions & 4 deletions helm/pinot/templates/broker/ingress-v1beta1.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
{{- if .Values.broker.ingress.v1beta1.enabled -}}
{{- $ingressPath := .Values.broker.ingress.v1beta1.path -}}
{{- $serviceName := include "pinot.broker.fullname" . -}}
{{- $servicePort := .Values.broker.service.port -}}
#
# 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.broker.ingress.v1beta1.enabled }}
{{- $ingressPath := .Values.broker.ingress.v1beta1.path }}
{{- $serviceName := include "pinot.broker.fullname" . }}
{{- $servicePort := .Values.broker.service.port }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $serviceName }}
namespace: {{ include "pinot.namespace" . }}
{{- if .Values.broker.ingress.v1beta1.annotations }}
annotations:
{{ toYaml .Values.broker.ingress.v1beta1.annotations | indent 4 }}
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/broker/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "pinot.broker.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
spec:
{{- if .Values.broker.pdb.minAvailable }}
minAvailable: {{ .Values.broker.pdb.minAvailable }}
Expand Down
2 changes: 1 addition & 1 deletion helm/pinot/templates/broker/service-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
#

{{- if .Values.broker.external.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "pinot.broker.external" . }}
namespace: {{ include "pinot.namespace" . }}
annotations:
{{ toYaml .Values.broker.external.annotations | indent 4 }}
labels:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/broker/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "pinot.broker.headless" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.brokerLabels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/broker/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "pinot.broker.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
annotations:
{{ toYaml .Values.broker.service.annotations | indent 4 }}
labels:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/broker/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "pinot.broker.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.brokerLabels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/controller/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pinot.controller.config" . }}
namespace: {{ include "pinot.namespace" . }}
data:
pinot-controller.conf: |-
controller.helix.cluster.name={{ .Values.cluster.name }}
Expand Down
28 changes: 24 additions & 4 deletions helm/pinot/templates/controller/ingress-v1.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
{{- if .Values.controller.ingress.v1.enabled -}}
{{- $ingressPath := .Values.controller.ingress.v1.path -}}
{{- $serviceName := include "pinot.controller.fullname" . -}}
{{- $servicePort := .Values.controller.service.port -}}
#
# 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.controller.ingress.v1.enabled }}
{{- $ingressPath := .Values.controller.ingress.v1.path }}
{{- $serviceName := include "pinot.controller.fullname" . }}
{{- $servicePort := .Values.controller.service.port }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $serviceName }}
namespace: {{ include "pinot.namespace" . }}
{{- if .Values.controller.ingress.v1.annotations }}
annotations:
{{ toYaml .Values.controller.ingress.v1.annotations | indent 4 }}
Expand Down
28 changes: 24 additions & 4 deletions helm/pinot/templates/controller/ingress-v1beta1.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
{{- if .Values.controller.ingress.v1beta1.enabled -}}
{{- $ingressPath := .Values.controller.ingress.v1beta1.path -}}
{{- $serviceName := include "pinot.controller.fullname" . -}}
{{- $servicePort := .Values.controller.service.port -}}
#
# 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.controller.ingress.v1beta1.enabled }}
{{- $ingressPath := .Values.controller.ingress.v1beta1.path }}
{{- $serviceName := include "pinot.controller.fullname" . }}
{{- $servicePort := .Values.controller.service.port }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $serviceName }}
namespace: {{ include "pinot.namespace" . }}
{{- if .Values.controller.ingress.v1beta1.annotations }}
annotations:
{{ toYaml .Values.controller.ingress.v1beta1.annotations | indent 4 }}
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/controller/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "pinot.controller.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
spec:
{{- if .Values.controller.pdb.minAvailable }}
minAvailable: {{ .Values.controller.pdb.minAvailable }}
Expand Down
2 changes: 1 addition & 1 deletion helm/pinot/templates/controller/service-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
#

{{- if .Values.controller.external.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "pinot.controller.external" . }}
namespace: {{ include "pinot.namespace" . }}
annotations:
{{ toYaml .Values.controller.external.annotations | indent 4 }}
labels:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/controller/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "pinot.controller.headless" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.controllerLabels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/controller/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "pinot.controller.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
annotations:
{{ toYaml .Values.controller.service.annotations | indent 4 }}
labels:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/controller/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "pinot.controller.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.controllerLabels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/minion-stateless/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pinot.minionStateless.config" . }}
namespace: {{ include "pinot.namespace" . }}
data:
pinot-minion-stateless.conf: |-
pinot.minion.port={{ .Values.minionStateless.service.port }}
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/minion-stateless/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "pinot.minionStateless.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.minionStatelessLabels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/minion-stateless/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Values.minionStateless.persistence.pvcName }}
namespace: {{ include "pinot.namespace" . }}
spec:
accessModes:
- {{ .Values.minionStateless.persistence.accessMode | quote }}
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/minion/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pinot.minion.config" . }}
namespace: {{ include "pinot.namespace" . }}
data:
pinot-minion.conf: |-
pinot.minion.port={{ .Values.minion.service.port }}
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/minion/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "pinot.minion.headless" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.minionLabels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/minion/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "pinot.minion.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
annotations:
{{ toYaml .Values.minion.service.annotations | indent 4 }}
labels:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/minion/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "pinot.minion.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.minionLabels" . | nindent 4 }}
spec:
Expand Down
29 changes: 29 additions & 0 deletions helm/pinot/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# 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.
#

apiVersion: v1
kind: Namespace
metadata:
name: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.labels" . | nindent 4 }}
{{- with .Values.namespaceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
1 change: 1 addition & 0 deletions helm/pinot/templates/server/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pinot.server.config" . }}
namespace: {{ include "pinot.namespace" . }}
data:
pinot-server.conf: |-
pinot.server.netty.port={{ .Values.server.service.nettyPort }}
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/server/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "pinot.server.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
spec:
{{- if .Values.server.pdb.minAvailable }}
minAvailable: {{ .Values.server.pdb.minAvailable }}
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/server/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "pinot.server.headless" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.serverLabels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/server/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "pinot.server.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
annotations:
{{ toYaml .Values.server.service.annotations | indent 4 }}
labels:
Expand Down
1 change: 1 addition & 0 deletions helm/pinot/templates/server/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "pinot.server.fullname" . }}
namespace: {{ include "pinot.namespace" . }}
labels:
{{- include "pinot.serverLabels" . | nindent 4 }}
spec:
Expand Down
Loading

0 comments on commit 74e1a14

Please sign in to comment.