From fd96a3c24e251179daa17adace4a2e593981f5a5 Mon Sep 17 00:00:00 2001 From: John Mazzitelli Date: Fri, 29 Oct 2021 17:35:11 -0400 Subject: [PATCH] support ingress class_name customization part of: https://github.com/kiali/kiali/issues/4342 --- kiali-server/templates/_helpers.tpl | 15 +++++++++++++++ kiali-server/templates/ingress.yaml | 13 ++++++++----- kiali-server/values.yaml | 8 +++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/kiali-server/templates/_helpers.tpl b/kiali-server/templates/_helpers.tpl index 409c158..0ade3e7 100644 --- a/kiali-server/templates/_helpers.tpl +++ b/kiali-server/templates/_helpers.tpl @@ -114,6 +114,21 @@ Determine the default identity private key file. There is no default if on k8s; {{- end }} {{- end }} +{{/* +Determine the default deployment.ingress.enabled. Disable it on k8s; enable it on OpenShift. +*/}} +{{- define "kiali-server.deployment.ingress.enabled" -}} +{{- if hasKey .Values.deployment.ingress "enabled" }} + {{- .Values.deployment.ingress.enabled }} +{{- else }} + {{- if .Capabilities.APIVersions.Has "route.openshift.io/v1" }} + {{- true }} + {{- else }} + {{- false }} + {{- end }} +{{- end }} +{{- end }} + {{/* Determine the istio namespace - default is where Kiali is installed. */}} diff --git a/kiali-server/templates/ingress.yaml b/kiali-server/templates/ingress.yaml index 5cc9aa2..0ef603b 100644 --- a/kiali-server/templates/ingress.yaml +++ b/kiali-server/templates/ingress.yaml @@ -1,5 +1,5 @@ {{- if not (.Capabilities.APIVersions.Has "route.openshift.io/v1") }} -{{- if .Values.deployment.ingress_enabled }} +{{- if eq "true" (include "kiali-server.deployment.ingress.enabled" .) }} --- {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }} apiVersion: networking.k8s.io/v1 @@ -13,8 +13,8 @@ metadata: labels: {{- include "kiali-server.labels" . | nindent 4 }} annotations: - {{- if hasKey .Values.deployment.override_ingress_yaml.metadata "annotations" }} - {{- toYaml .Values.deployment.override_ingress_yaml.metadata.annotations | nindent 4 }} + {{- if hasKey .Values.deployment.ingress.override_yaml.metadata "annotations" }} + {{- toYaml .Values.deployment.ingress.override_yaml.metadata.annotations | nindent 4 }} {{- else }} # For ingress-nginx versions older than 0.20.0 use secure-backends. # (see: https://github.com/kubernetes/ingress-nginx/issues/3416#issuecomment-438247948) @@ -28,9 +28,12 @@ metadata: {{- end }} {{- end }} spec: - {{- if hasKey .Values.deployment.override_ingress_yaml "spec" }} - {{- toYaml .Values.deployment.override_ingress_yaml.spec | nindent 2 }} + {{- if hasKey .Values.deployment.ingress.override_yaml "spec" }} + {{- toYaml .Values.deployment.ingress.override_yaml.spec | nindent 2 }} {{- else }} + {{- if .Values.deployment.ingress.class_name }} + ingressClassName: {{ .Values.deployment.ingress.class_name }} + {{- end }} rules: - http: paths: diff --git a/kiali-server/values.yaml b/kiali-server/values.yaml index db002fa..ebb7312 100644 --- a/kiali-server/values.yaml +++ b/kiali-server/values.yaml @@ -44,7 +44,11 @@ deployment: image_pull_policy: "Always" image_pull_secrets: [] image_version: ${HELM_IMAGE_TAG} # version like "v1.39" (see: https://quay.io/repository/kiali/kiali?tab=tags) or a digest hash - ingress_enabled: true + ingress: + class_name: "nginx" + #enabled: + override_yaml: + metadata: {} instance_name: "kiali" logger: log_format: "text" @@ -52,8 +56,6 @@ deployment: time_field_format: "2006-01-02T15:04:05Z07:00" sampler_rate: "1" node_selector: {} - override_ingress_yaml: - metadata: {} pod_annotations: {} pod_labels: {} priority_class_name: ""