From afbc1ed7ffb520709200b5e21a2442af16c4a32c Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Thu, 9 Feb 2023 09:43:20 -0500 Subject: [PATCH 1/4] helm: Fix PDB apiVersion to allow K8s 1.25+ deployment --- helm/druid/Chart.yaml | 2 +- helm/druid/templates/_capabilities.tpl | 17 +++++++++++++++++ helm/druid/templates/historical/pdb.yaml | 2 +- helm/druid/templates/middleManager/pdb.yaml | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 helm/druid/templates/_capabilities.tpl diff --git a/helm/druid/Chart.yaml b/helm/druid/Chart.yaml index 8bbc003de34f..cc4083be290e 100644 --- a/helm/druid/Chart.yaml +++ b/helm/druid/Chart.yaml @@ -30,7 +30,7 @@ dependencies: version: 8.6.4 repository: https://charts.helm.sh/stable condition: postgresql.enabled -version: 0.3.3 +version: 0.3.4 home: https://druid.apache.org/ icon: https://druid.apache.org/img/favicon.png sources: diff --git a/helm/druid/templates/_capabilities.tpl b/helm/druid/templates/_capabilities.tpl new file mode 100644 index 000000000000..f0a0c861556f --- /dev/null +++ b/helm/druid/templates/_capabilities.tpl @@ -0,0 +1,17 @@ +{{/* +Return the target Kubernetes version +*/}} +{{- define "capabilities.kubeVersion" -}} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} diff --git a/helm/druid/templates/historical/pdb.yaml b/helm/druid/templates/historical/pdb.yaml index 13b000034c74..c921b1909da4 100644 --- a/helm/druid/templates/historical/pdb.yaml +++ b/helm/druid/templates/historical/pdb.yaml @@ -18,7 +18,7 @@ */}} {{- if .Values.historical.podDisruptionBudget.enabled }} -apiVersion: policy/v1beta1 +apiVersion: {{ include "capabilities.policy.apiVersion" . }} kind: PodDisruptionBudget metadata: labels: diff --git a/helm/druid/templates/middleManager/pdb.yaml b/helm/druid/templates/middleManager/pdb.yaml index 5e3bccf1aa78..71a592979a79 100644 --- a/helm/druid/templates/middleManager/pdb.yaml +++ b/helm/druid/templates/middleManager/pdb.yaml @@ -18,7 +18,7 @@ */}} {{- if .Values.middleManager.podDisruptionBudget.enabled }} -apiVersion: policy/v1beta1 +apiVersion: {{ include "capabilities.policy.apiVersion" . }} kind: PodDisruptionBudget metadata: labels: From f82c4f0de34ca4d144222e9287269e67f6d241d9 Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Tue, 14 Feb 2023 14:54:38 -0500 Subject: [PATCH 2/4] helm: Add updated ingress and hpa apiVersion support for modern K8s versions --- .gitignore | 1 + helm/druid/Chart.yaml | 2 +- helm/druid/README.md | 19 ++++++++ helm/druid/templates/_capabilities.tpl | 45 ++++++++++++++++--- helm/druid/templates/broker/ingress.yaml | 35 ++++++++++++--- helm/druid/templates/coordinator/ingress.yaml | 35 ++++++++++++--- helm/druid/templates/historical/ingress.yaml | 35 ++++++++++++--- helm/druid/templates/middleManager/hpa.yaml | 4 +- .../templates/middleManager/ingress.yaml | 35 ++++++++++++--- helm/druid/templates/overlord/ingress.yaml | 35 ++++++++++++--- helm/druid/templates/router/ingress.yaml | 35 ++++++++++++--- helm/druid/values.yaml | 18 ++++++++ 12 files changed, 249 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index d6ecf2b79524..15f7cf4cc2d1 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ integration-tests/gen-scripts/ /bin/ *.hprof **/.ipynb_checkpoints/ +helm/druid/charts diff --git a/helm/druid/Chart.yaml b/helm/druid/Chart.yaml index cc4083be290e..da29cded76f6 100644 --- a/helm/druid/Chart.yaml +++ b/helm/druid/Chart.yaml @@ -30,7 +30,7 @@ dependencies: version: 8.6.4 repository: https://charts.helm.sh/stable condition: postgresql.enabled -version: 0.3.4 +version: 0.3.7 home: https://druid.apache.org/ icon: https://druid.apache.org/img/favicon.png sources: diff --git a/helm/druid/README.md b/helm/druid/README.md index 64274a71d7c8..1c161e4727f7 100644 --- a/helm/druid/README.md +++ b/helm/druid/README.md @@ -110,7 +110,11 @@ The following table lists the configurable parameters of the Druid chart and the | `broker.ingress.enabled` | enable ingress | `false` | | `broker.ingress.hosts` | hosts for the broker api | `[ "chart-example.local" ]` | | `broker.ingress.path` | path of the broker api | `/` | +| `broker.ingress.pathType` | pathType of the broker api ingress | `` | | `broker.ingress.annotations` | annotations for the broker api ingress | `{}` | +| `broker.ingress.labels` | labels for the broker api ingress | `{}` | +| `broker.ingress.ingressClassName` | ingressClassName of the broker api ingress | `` | +| `broker.ingress.pathType` | pathType of the broker api ingress | `` | | `broker.ingress.tls` | TLS configuration for the ingress | `[]` | | `coordinator.enabled` | enable coordinator | `true` | | `coordinator.name` | coordinator component name | `coordinator` | @@ -127,6 +131,9 @@ The following table lists the configurable parameters of the Druid chart and the | `coordinator.ingress.hosts` | hosts for the coordinator api | `[ "chart-example.local" ]` | | `coordinator.ingress.path` | path of the coordinator api | `/` | | `coordinator.ingress.annotations` | annotations for the coordinator api ingress | `{}` | +| `coordinator.ingress.labels` | labels for the coordinator api ingress | `{}` | +| `coordinator.ingress.ingressClassName` | ingressClassName of the coordinator api ingress | `` | +| `coordinator.ingress.pathType` | pathType of the coordinator api ingress | `` | | `coordinator.ingress.tls` | TLS configuration for the ingress | `[]` | | `overlord.enabled` | enable overlord | `false` | | `overlord.name` | overlord component name | `overlord` | @@ -143,6 +150,9 @@ The following table lists the configurable parameters of the Druid chart and the | `overlord.ingress.hosts` | hosts for the overlord api | `[ "chart-example.local" ]` | | `overlord.ingress.path` | path of the overlord api | `/` | | `overlord.ingress.annotations` | annotations for the overlord api ingress | `{}` | +| `overlord.ingress.labels` | labels for the overlord api ingress | `{}` | +| `overlord.ingress.ingressClassName` | ingressClassName of the overlord api ingress | `` | +| `overlord.ingress.pathType` | pathType of the overlord api ingress | `` | | `overlord.ingress.tls` | TLS configuration for the ingress | `[]` | | `historical.enabled` | enable historical | `true` | | `historical.name` | historical component name | `historical` | @@ -167,6 +177,9 @@ The following table lists the configurable parameters of the Druid chart and the | `historical.ingress.hosts` | hosts for the historical api | `[ "chart-example.local" ]` | | `historical.ingress.path` | path of the historical api | `/` | | `historical.ingress.annotations` | annotations for the historical api ingress | `{}` | +| `historical.ingress.labels` | labels for the historical api ingress | `{}` | +| `historical.ingress.ingressClassName` | ingressClassName of the historical api ingress | `` | +| `historical.ingress.pathType` | pathType of the historical api ingress | `` | | `historical.ingress.tls` | TLS configuration for the ingress | `[]` | | `middleManager.enabled` | enable middleManager | `true` | | `middleManager.name` | middleManager component name | `middleManager` | @@ -193,6 +206,9 @@ The following table lists the configurable parameters of the Druid chart and the | `middleManager.ingress.hosts` | hosts for the middleManager api | `[ "chart-example.local" ]` | | `middleManager.ingress.path` | path of the middleManager api | `/` | | `middleManager.ingress.annotations` | annotations for the middleManager api ingress | `{}` | +| `middleManager.ingress.labels` | labels for the middleManager api ingress | `{}` | +| `middleManager.ingress.ingressClassName` | ingressClassName of the middleManager api ingress | `` | +| `middleManager.ingress.pathType` | pathType of the middleManager api ingress | `` | | `middleManager.ingress.tls` | TLS configuration for the ingress | `[]` | | `router.enabled` | enable router | `false` | | `router.name` | router component name | `router` | @@ -209,6 +225,9 @@ The following table lists the configurable parameters of the Druid chart and the | `router.ingress.hosts` | hosts for the router api | `[ "chart-example.local" ]` | | `router.ingress.path` | path of the router api | `/` | | `router.ingress.annotations` | annotations for the router api ingress | `{}` | +| `router.ingress.labels` | labels for the router api ingress | `{}` | +| `router.ingress.ingressClassName` | ingressClassName of the router api ingress | `` | +| `router.ingress.pathType` | pathType of the router api ingress | `` | | `router.ingress.tls` | TLS configuration for the ingress | `[]` | | `prometheus.enabled` | Support scraping from prometheus | `false` | | `prometheus.port` | expose prometheus port | `9090` | diff --git a/helm/druid/templates/_capabilities.tpl b/helm/druid/templates/_capabilities.tpl index f0a0c861556f..74ec55c00f07 100644 --- a/helm/druid/templates/_capabilities.tpl +++ b/helm/druid/templates/_capabilities.tpl @@ -6,12 +6,47 @@ Return the target Kubernetes version {{- end -}} {{/* -Return the appropriate apiVersion for poddisruptionbudget. +Return the appropriate apiVersion for podDisruptionBudget. */}} {{- define "capabilities.policy.apiVersion" -}} -{{- if semverCompare "<1.21-0" (include "capabilities.kubeVersion" .) -}} -{{- print "policy/v1beta1" -}} -{{- else -}} -{{- print "policy/v1" -}} + {{- if semverCompare "<1.21-0" (include "capabilities.kubeVersion" .) -}} + {{- print "policy/v1beta1" -}} + {{- else -}} + {{- print "policy/v1" -}} + {{- end -}} {{- end -}} + +{{/* +Return the appropriate apiVersion and manifest format for ingress +*/}} +{{- define "capabilities.ingress.apiVersion" -}} + {{- if semverCompare "<1.14-0" (include "capabilities.kubeVersion" .) -}} + {{- print "extensions/v1beta1" -}} + {{- else if semverCompare "<1.19-0" (include "capabilities.kubeVersion" .) -}} + {{- print "networking.k8s.io/v1beta1" -}} + {{- else -}} + {{- print "networking.k8s.io/v1" -}} + {{- end }} +{{- end -}} + +{{/* Check Ingress stability */}} +{{- define "capabilities.ingress.isStable" -}} + {{- eq (include "capabilities.ingress.apiVersion" .) "networking.k8s.io/v1" -}} +{{- end -}} + +{{/* Check Ingress supports pathType */}} +{{/* pathType was added to networking.k8s.io/v1beta1 in Kubernetes 1.18 */}} +{{- define "capabilities.ingress.supportsPathType" -}} + {{- or (eq (include "capabilities.ingress.isStable" .) "true") (and (eq (include "capabilities.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" (include "capabilities.kubeVersion" .))) -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "capabilities.hpa.apiVersion" -}} + {{- if semverCompare "<1.23-0" (include "capabilities.kubeVersion" .) -}} + {{- print "autoscaling/v2beta2" -}} + {{- else -}} + {{- print "autoscaling/v2" -}} + {{- end -}} {{- end -}} diff --git a/helm/druid/templates/broker/ingress.yaml b/helm/druid/templates/broker/ingress.yaml index df27d7e35c59..b540a2ea7186 100644 --- a/helm/druid/templates/broker/ingress.yaml +++ b/helm/druid/templates/broker/ingress.yaml @@ -20,7 +20,10 @@ {{- if .Values.broker.ingress.enabled -}} {{- $fullName := include "druid.broker.fullname" . -}} {{- $ingressPath := .Values.broker.ingress.path -}} -apiVersion: extensions/v1beta1 +{{- $ingressPathType := .Values.broker.ingress.pathType | default "ImplementationSpecific" -}} +{{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} +{{- $ingressSupportsPathType := eq (include "capabilities.ingress.supportsPathType" .) "true" -}} +apiVersion: {{ include "capabilities.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ $fullName }} @@ -30,29 +33,47 @@ metadata: component: {{ .Values.broker.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} -{{- with .Values.broker.ingress.annotations }} + {{- with .Values.broker.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.broker.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.broker.ingress.tls }} + {{- if $apiIsStable }} + {{- if .Values.broker.ingress.ingressClassName }} + ingressClassName: {{ .Values.broker.ingress.ingressClassName }} + {{- end }} + {{- end }} + {{- if .Values.broker.ingress.tls }} tls: - {{- range .Values.broker.ingress.tls }} + {{- range .Values.broker.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: {{- range .Values.broker.ingress.hosts }} - host: {{ . | quote }} http: paths: - path: {{ $ingressPath }} + {{- if and $ingressPathType $ingressSupportsPathType }} + pathType: {{ $ingressPathType }} + {{- end }} backend: + {{- if $apiIsStable }} + service: + name: {{ $fullName }} + port: + number: 80 + {{- else }} serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/coordinator/ingress.yaml b/helm/druid/templates/coordinator/ingress.yaml index 8d64ea77de17..85a3edf2d078 100644 --- a/helm/druid/templates/coordinator/ingress.yaml +++ b/helm/druid/templates/coordinator/ingress.yaml @@ -20,7 +20,10 @@ {{- if .Values.coordinator.ingress.enabled -}} {{- $fullName := include "druid.coordinator.fullname" . -}} {{- $ingressPath := .Values.coordinator.ingress.path -}} -apiVersion: extensions/v1beta1 +{{- $ingressPathType := .Values.coordinator.ingress.pathType | default "ImplementationSpecific" -}} +{{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} +{{- $ingressSupportsPathType := eq (include "capabilities.ingress.supportsPathType" .) "true" -}} +apiVersion: {{ include "capabilities.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ $fullName }} @@ -30,29 +33,47 @@ metadata: component: {{ .Values.coordinator.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} -{{- with .Values.coordinator.ingress.annotations }} + {{- with .Values.coordinator.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.coordinator.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.coordinator.ingress.tls }} + {{- if $apiIsStable }} + {{- if .Values.coordinator.ingress.ingressClassName }} + ingressClassName: {{ .Values.coordinator.ingress.ingressClassName }} + {{- end }} + {{- end }} + {{- if .Values.coordinator.ingress.tls }} tls: - {{- range .Values.coordinator.ingress.tls }} + {{- range .Values.coordinator.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: {{- range .Values.coordinator.ingress.hosts }} - host: {{ . | quote }} http: paths: - path: {{ $ingressPath }} + {{- if and $ingressPathType $ingressSupportsPathType }} + pathType: {{ $ingressPathType }} + {{- end }} backend: + {{- if $apiIsStable }} + service: + name: {{ $fullName }} + port: + number: 80 + {{- else }} serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/historical/ingress.yaml b/helm/druid/templates/historical/ingress.yaml index 466e3c5ae594..c6610fd68903 100644 --- a/helm/druid/templates/historical/ingress.yaml +++ b/helm/druid/templates/historical/ingress.yaml @@ -20,7 +20,10 @@ {{- if .Values.historical.ingress.enabled -}} {{- $fullName := include "druid.historical.fullname" . -}} {{- $ingressPath := .Values.historical.ingress.path -}} -apiVersion: extensions/v1beta1 +{{- $ingressPathType := .Values.historical.ingress.pathType | default "ImplementationSpecific" -}} +{{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} +{{- $ingressSupportsPathType := eq (include "capabilities.ingress.supportsPathType" .) "true" -}} +apiVersion: {{ include "capabilities.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ $fullName }} @@ -30,29 +33,47 @@ metadata: component: {{ .Values.historical.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} -{{- with .Values.historical.ingress.annotations }} + {{- with .Values.historical.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.historical.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.historical.ingress.tls }} + {{- if $apiIsStable }} + {{- if .Values.historical.ingress.ingressClassName }} + ingressClassName: {{ .Values.historical.ingress.ingressClassName }} + {{- end }} + {{- end }} + {{- if .Values.historical.ingress.tls }} tls: - {{- range .Values.historical.ingress.tls }} + {{- range .Values.historical.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: {{- range .Values.historical.ingress.hosts }} - host: {{ . | quote }} http: paths: - path: {{ $ingressPath }} + {{- if and $ingressPathType $ingressSupportsPathType }} + pathType: {{ $ingressPathType }} + {{- end }} backend: + {{- if $apiIsStable }} + service: + name: {{ $fullName }} + port: + number: 80 + {{- else }} serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/middleManager/hpa.yaml b/helm/druid/templates/middleManager/hpa.yaml index fcda2f2f1b2f..1837675b05aa 100644 --- a/helm/druid/templates/middleManager/hpa.yaml +++ b/helm/druid/templates/middleManager/hpa.yaml @@ -18,7 +18,7 @@ */}} {{- if .Values.middleManager.autoscaling.enabled }} -apiVersion: autoscaling/v2beta2 +apiVersion: {{ include "capabilities.hpa.apiVersion" . }} kind: HorizontalPodAutoscaler metadata: name: {{ include "druid.middleManager.fullname" . }} @@ -36,5 +36,5 @@ spec: minReplicas: {{ .Values.middleManager.autoscaling.minReplicas }} maxReplicas: {{ .Values.middleManager.autoscaling.maxReplicas }} metrics: -{{ toYaml .Values.middleManager.autoscaling.metrics | indent 4 }} + {{- toYaml .Values.middleManager.autoscaling.metrics | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/helm/druid/templates/middleManager/ingress.yaml b/helm/druid/templates/middleManager/ingress.yaml index 672580a2e7fc..f454ee33d695 100644 --- a/helm/druid/templates/middleManager/ingress.yaml +++ b/helm/druid/templates/middleManager/ingress.yaml @@ -20,7 +20,10 @@ {{- if .Values.middleManager.ingress.enabled -}} {{- $fullName := include "druid.middleManager.fullname" . -}} {{- $ingressPath := .Values.middleManager.ingress.path -}} -apiVersion: extensions/v1beta1 +{{- $ingressPathType := .Values.middleManager.ingress.pathType | default "ImplementationSpecific" -}} +{{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} +{{- $ingressSupportsPathType := eq (include "capabilities.ingress.supportsPathType" .) "true" -}} +apiVersion: {{ include "capabilities.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ $fullName }} @@ -30,29 +33,47 @@ metadata: component: {{ .Values.middleManager.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} -{{- with .Values.middleManager.ingress.annotations }} + {{- with .Values.middleManager.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.middleManager.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.middleManager.ingress.tls }} + {{- if $apiIsStable }} + {{- if .Values.middleManager.ingress.ingressClassName }} + ingressClassName: {{ .Values.middleManager.ingress.ingressClassName }} + {{- end }} + {{- end }} + {{- if .Values.middleManager.ingress.tls }} tls: - {{- range .Values.middleManager.ingress.tls }} + {{- range .Values.middleManager.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: {{- range .Values.middleManager.ingress.hosts }} - host: {{ . | quote }} http: paths: - path: {{ $ingressPath }} + {{- if and $ingressPathType $ingressSupportsPathType }} + pathType: {{ $ingressPathType }} + {{- end }} backend: + {{- if $apiIsStable }} + service: + name: {{ $fullName }} + port: + number: 80 + {{- else }} serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/overlord/ingress.yaml b/helm/druid/templates/overlord/ingress.yaml index f1f3051dbf42..64fe8ae8f568 100644 --- a/helm/druid/templates/overlord/ingress.yaml +++ b/helm/druid/templates/overlord/ingress.yaml @@ -20,7 +20,10 @@ {{- if .Values.overlord.ingress.enabled -}} {{- $fullName := include "druid.overlord.fullname" . -}} {{- $ingressPath := .Values.overlord.ingress.path -}} -apiVersion: extensions/v1beta1 +{{- $ingressPathType := .Values.overlord.ingress.pathType | default "ImplementationSpecific" -}} +{{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} +{{- $ingressSupportsPathType := eq (include "capabilities.ingress.supportsPathType" .) "true" -}} +apiVersion: {{ include "capabilities.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ $fullName }} @@ -30,29 +33,47 @@ metadata: component: {{ .Values.overlord.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} -{{- with .Values.overlord.ingress.annotations }} + {{- with .Values.overlord.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.overlord.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.overlord.ingress.tls }} + {{- if $apiIsStable }} + {{- if .Values.overlord.ingress.ingressClassName }} + ingressClassName: {{ .Values.overlord.ingress.ingressClassName }} + {{- end }} + {{- end }} + {{- if .Values.overlord.ingress.tls }} tls: - {{- range .Values.overlord.ingress.tls }} + {{- range .Values.overlord.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: {{- range .Values.overlord.ingress.hosts }} - host: {{ . | quote }} http: paths: - path: {{ $ingressPath }} + {{- if and $ingressPathType $ingressSupportsPathType }} + pathType: {{ $ingressPathType }} + {{- end }} backend: + {{- if $apiIsStable }} + service: + name: {{ $fullName }} + port: + number: 80 + {{- else }} serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/router/ingress.yaml b/helm/druid/templates/router/ingress.yaml index aab27fc79b68..05bd3f741d95 100644 --- a/helm/druid/templates/router/ingress.yaml +++ b/helm/druid/templates/router/ingress.yaml @@ -20,7 +20,10 @@ {{- if .Values.router.ingress.enabled -}} {{- $fullName := include "druid.router.fullname" . -}} {{- $ingressPath := .Values.router.ingress.path -}} -apiVersion: extensions/v1beta1 +{{- $ingressPathType := .Values.router.ingress.pathType | default "ImplementationSpecific" -}} +{{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} +{{- $ingressSupportsPathType := eq (include "capabilities.ingress.supportsPathType" .) "true" -}} +apiVersion: {{ include "capabilities.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ $fullName }} @@ -30,29 +33,47 @@ metadata: component: {{ .Values.router.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} -{{- with .Values.router.ingress.annotations }} + {{- with .Values.router.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.router.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: -{{- if .Values.router.ingress.tls }} + {{- if $apiIsStable }} + {{- if .Values.router.ingress.ingressClassName }} + ingressClassName: {{ .Values.router.ingress.ingressClassName }} + {{- end }} + {{- end }} + {{- if .Values.router.ingress.tls }} tls: - {{- range .Values.router.ingress.tls }} + {{- range .Values.router.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: {{- range .Values.router.ingress.hosts }} - host: {{ . | quote }} http: paths: - path: {{ $ingressPath }} + {{- if and $ingressPathType $ingressSupportsPathType }} + pathType: {{ $ingressPathType }} + {{- end }} backend: + {{- if $apiIsStable }} + service: + name: {{ $fullName }} + port: + number: 80 + {{- else }} serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/values.yaml b/helm/druid/values.yaml index f7dc218bd43c..1ae17ba68774 100644 --- a/helm/druid/values.yaml +++ b/helm/druid/values.yaml @@ -75,7 +75,10 @@ broker: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" + labels: {} + ingressClassName: "" path: / + pathType: "" hosts: - chart-example.local tls: [] @@ -118,7 +121,10 @@ coordinator: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" + labels: {} + ingressClassName: "" path: / + pathType: "" hosts: - chart-example.local tls: [] @@ -158,7 +164,10 @@ overlord: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" + labels: {} + ingressClassName: "" path: / + pathType: "" hosts: - chart-example.local tls: [] @@ -200,7 +209,10 @@ historical: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" + labels: {} + ingressClassName: "" path: / + pathType: "" hosts: - chart-example.local tls: [] @@ -285,7 +297,10 @@ middleManager: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" + labels: {} + ingressClassName: "" path: / + pathType: "" hosts: - chart-example.local tls: [] @@ -348,7 +363,10 @@ router: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" + labels: {} + ingressClassName: "" path: / + pathType: "" hosts: - chart-example.local tls: [] From 4933be9f574b9dc0fa3698f86769a162e79b9a55 Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Wed, 15 Feb 2023 00:59:24 -0500 Subject: [PATCH 3/4] Remove duplicate README entry for broker ingress pathType --- helm/druid/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/helm/druid/README.md b/helm/druid/README.md index 1c161e4727f7..b0a9b2cd984d 100644 --- a/helm/druid/README.md +++ b/helm/druid/README.md @@ -110,7 +110,6 @@ The following table lists the configurable parameters of the Druid chart and the | `broker.ingress.enabled` | enable ingress | `false` | | `broker.ingress.hosts` | hosts for the broker api | `[ "chart-example.local" ]` | | `broker.ingress.path` | path of the broker api | `/` | -| `broker.ingress.pathType` | pathType of the broker api ingress | `` | | `broker.ingress.annotations` | annotations for the broker api ingress | `{}` | | `broker.ingress.labels` | labels for the broker api ingress | `{}` | | `broker.ingress.ingressClassName` | ingressClassName of the broker api ingress | `` | From 5a82e39c8df5a845edf95983c4820d11af4ba625 Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Thu, 9 Mar 2023 16:53:49 -0500 Subject: [PATCH 4/4] Fix ingresses to point at service ports --- helm/druid/templates/broker/ingress.yaml | 5 +++-- helm/druid/templates/coordinator/ingress.yaml | 5 +++-- helm/druid/templates/historical/ingress.yaml | 5 +++-- helm/druid/templates/middleManager/ingress.yaml | 5 +++-- helm/druid/templates/overlord/ingress.yaml | 5 +++-- helm/druid/templates/router/ingress.yaml | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/helm/druid/templates/broker/ingress.yaml b/helm/druid/templates/broker/ingress.yaml index b540a2ea7186..3008b308a014 100644 --- a/helm/druid/templates/broker/ingress.yaml +++ b/helm/druid/templates/broker/ingress.yaml @@ -19,6 +19,7 @@ {{- if .Values.broker.ingress.enabled -}} {{- $fullName := include "druid.broker.fullname" . -}} +{{- $svcPort := .Values.broker.port -}} {{- $ingressPath := .Values.broker.ingress.path -}} {{- $ingressPathType := .Values.broker.ingress.pathType | default "ImplementationSpecific" -}} {{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} @@ -70,10 +71,10 @@ spec: service: name: {{ $fullName }} port: - number: 80 + number: {{ $svcPort }} {{- else }} serviceName: {{ $fullName }} - servicePort: http + servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/coordinator/ingress.yaml b/helm/druid/templates/coordinator/ingress.yaml index 85a3edf2d078..e03b40529567 100644 --- a/helm/druid/templates/coordinator/ingress.yaml +++ b/helm/druid/templates/coordinator/ingress.yaml @@ -19,6 +19,7 @@ {{- if .Values.coordinator.ingress.enabled -}} {{- $fullName := include "druid.coordinator.fullname" . -}} +{{- $svcPort := .Values.coordinator.port -}} {{- $ingressPath := .Values.coordinator.ingress.path -}} {{- $ingressPathType := .Values.coordinator.ingress.pathType | default "ImplementationSpecific" -}} {{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} @@ -70,10 +71,10 @@ spec: service: name: {{ $fullName }} port: - number: 80 + number: {{ $svcPort }} {{- else }} serviceName: {{ $fullName }} - servicePort: http + servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/historical/ingress.yaml b/helm/druid/templates/historical/ingress.yaml index c6610fd68903..d1b5e24091fb 100644 --- a/helm/druid/templates/historical/ingress.yaml +++ b/helm/druid/templates/historical/ingress.yaml @@ -19,6 +19,7 @@ {{- if .Values.historical.ingress.enabled -}} {{- $fullName := include "druid.historical.fullname" . -}} +{{- $svcPort := .Values.historical.port -}} {{- $ingressPath := .Values.historical.ingress.path -}} {{- $ingressPathType := .Values.historical.ingress.pathType | default "ImplementationSpecific" -}} {{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} @@ -70,10 +71,10 @@ spec: service: name: {{ $fullName }} port: - number: 80 + number: {{ $svcPort }} {{- else }} serviceName: {{ $fullName }} - servicePort: http + servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/middleManager/ingress.yaml b/helm/druid/templates/middleManager/ingress.yaml index f454ee33d695..3b07784288ec 100644 --- a/helm/druid/templates/middleManager/ingress.yaml +++ b/helm/druid/templates/middleManager/ingress.yaml @@ -19,6 +19,7 @@ {{- if .Values.middleManager.ingress.enabled -}} {{- $fullName := include "druid.middleManager.fullname" . -}} +{{- $svcPort := .Values.middleManager.port -}} {{- $ingressPath := .Values.middleManager.ingress.path -}} {{- $ingressPathType := .Values.middleManager.ingress.pathType | default "ImplementationSpecific" -}} {{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} @@ -70,10 +71,10 @@ spec: service: name: {{ $fullName }} port: - number: 80 + number: {{ $svcPort }} {{- else }} serviceName: {{ $fullName }} - servicePort: http + servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/overlord/ingress.yaml b/helm/druid/templates/overlord/ingress.yaml index 64fe8ae8f568..1a24c46e653e 100644 --- a/helm/druid/templates/overlord/ingress.yaml +++ b/helm/druid/templates/overlord/ingress.yaml @@ -19,6 +19,7 @@ {{- if .Values.overlord.ingress.enabled -}} {{- $fullName := include "druid.overlord.fullname" . -}} +{{- $svcPort := .Values.overlord.port -}} {{- $ingressPath := .Values.overlord.ingress.path -}} {{- $ingressPathType := .Values.overlord.ingress.pathType | default "ImplementationSpecific" -}} {{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} @@ -70,10 +71,10 @@ spec: service: name: {{ $fullName }} port: - number: 80 + number: {{ $svcPort }} {{- else }} serviceName: {{ $fullName }} - servicePort: http + servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }} diff --git a/helm/druid/templates/router/ingress.yaml b/helm/druid/templates/router/ingress.yaml index 05bd3f741d95..a60740ec671e 100644 --- a/helm/druid/templates/router/ingress.yaml +++ b/helm/druid/templates/router/ingress.yaml @@ -19,6 +19,7 @@ {{- if .Values.router.ingress.enabled -}} {{- $fullName := include "druid.router.fullname" . -}} +{{- $svcPort := .Values.router.port -}} {{- $ingressPath := .Values.router.ingress.path -}} {{- $ingressPathType := .Values.router.ingress.pathType | default "ImplementationSpecific" -}} {{- $apiIsStable := eq (include "capabilities.ingress.isStable" .) "true" -}} @@ -70,10 +71,10 @@ spec: service: name: {{ $fullName }} port: - number: 80 + number: {{ $svcPort }} {{- else }} serviceName: {{ $fullName }} - servicePort: http + servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }}