[ingress-controller] Redesigned controller parameters

This PS consolidates control over ingress class name and controller
class names at one place.

Change-Id: I394ec99e0e6177c8c8553b636e3fda90c967c15b
This commit is contained in:
Sergiy Markin 2023-09-29 17:13:16 +00:00
parent 56dd4fdb84
commit db3537e56b
7 changed files with 26 additions and 42 deletions

View File

@ -15,7 +15,7 @@ apiVersion: v1
appVersion: v1.5.1
description: OpenStack-Helm Ingress Controller
name: ingress
version: 0.2.17
version: 0.2.18
home: https://github.com/kubernetes/ingress
sources:
- https://github.com/kubernetes/ingress

View File

@ -46,7 +46,9 @@ function start () {
--election-id=${RELEASE_NAME} \
--controller-class=${CONTROLLER_CLASS} \
--ingress-class=${INGRESS_CLASS} \
{{- if .Values.deployment.cluster.ingressClassByName }}
--ingress-class-by-name=${INGRESS_CLASS_BY_NAME} \
{{- end }}
--default-backend-service=${POD_NAMESPACE}/${ERROR_PAGE_SERVICE} \
{{- if .Values.conf.default_ssl_certificate.enabled }}
{{- $ns := .Values.conf.default_ssl_certificate.namespace | default .Release.Namespace }}

View File

@ -15,22 +15,6 @@ limitations under the License.
{{- if .Values.manifests.deployment_ingress }}
{{- $envAll := . }}
# Evaluate if we are deploying in cluster mode
{{- if eq .Values.deployment.mode "cluster" }}
# Check INGRESS_CLASS empty
{{- if empty .Values.conf.controller.INGRESS_CLASS -}}
{{- $_ := set .Values.conf.controller "INGRESS_CLASS" .Values.deployment.cluster.class -}}
{{- end }}
# Check CONTROLLER_CLASS empty
{{- if empty .Values.conf.controller.CONTROLLER_CLASS -}}
{{- $_ := set .Values.conf.controller "CONTROLLER_CLASS" .Values.deployment.cluster.controllerClass -}}
{{- end }}
# Set default values for INGRESS_CLASS & CONTROLLER_CLASS if deploying in namespace mode
{{- else if eq .Values.deployment.mode "namespace" }}
{{- $_ := set .Values.conf.controller "INGRESS_CLASS" "nginx" -}}
{{- $_ := set .Values.conf.controller "CONTROLLER_CLASS" "k8s.io/nginx-ingress" -}}
{{- end }}
{{- $serviceAccountName := printf "%s-%s" .Release.Name "ingress" }}
{{ tuple $envAll "ingress" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
@ -322,7 +306,14 @@ spec:
value: {{ .Release.Name | quote }}
- name: ERROR_PAGE_SERVICE
value: {{ tuple "ingress" "error_pages" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" | quote }}
{{ include "helm-toolkit.utils.to_k8s_env_vars" .Values.conf.controller | indent 12 }}
- name: INGRESS_CLASS
value: "{{ .Values.deployment.cluster.class }}"
{{- if .Values.deployment.cluster.ingressClassByName }}
- name: INGRESS_CLASS_BY_NAME
value: "{{ .Values.deployment.cluster.ingressClassByName }}"
{{- end }}
- name: CONTROLLER_CLASS
value: "{{ .Values.deployment.cluster.controllerClass }}"
ports:
- containerPort: {{ tuple "ingress" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{- if .Values.network.host_namespace }}

View File

@ -21,6 +21,7 @@ deployment:
type: Deployment
cluster:
class: "nginx-cluster"
ingressClassByName: false
controllerClass: "k8s.io/nginx-ingress"
images:
@ -308,23 +309,6 @@ secrets:
dhparam:
secret_dhparam: |
conf:
controller:
# NOTE: if left blank this is populated from
# .deployment.cluster.class in cluster mode, or set to
# "nginx" in namespace mode
# [IN DEPRECATION] Name of the ingress class this controller satisfies.
# The class of an Ingress object is set using the annotation "kubernetes.io/ingress.class" (deprecated).
# The parameter --controller-class has precedence over this. (default "nginx")
INGRESS_CLASS: null
# Define if Ingress Controller should watch for Ingress Class by Name together with Controller Class
INGRESS_CLASS_BY_NAME: true
# NOTE: if left blank this is populated from
# .deployment.cluster.controllerClass in cluster mode, or set to
# "k8s.io/nginx-ingress" in namespace mode
# Ingress Class Controller value this Ingress satisfies.
# The class of an Ingress object is set using the field IngressClassName in Kubernetes clusters version v1.19.0 or higher. The .spec.controller value of the IngressClass
# referenced in an Ingress Object should be the same value specified here to make this object be watched. (default "k8s.io/ingress-nginx")
CONTROLLER_CLASS: null
ingress:
enable-underscores-in-headers: "true"
# NOTE(portdirect): if left blank this is populated from

View File

@ -0,0 +1,7 @@
---
deployment:
mode: cluster
type: DaemonSet
network:
host_namespace: true
...

View File

@ -1,9 +1,8 @@
---
conf:
ingress:
proxy-body-size: 20m
controller:
INGRESS_CLASS: ucp-ingress
INGRESS_CLASS_BY_NAME: true
CONTROLLER_CLASS: k8s.io/ucp-ingress
deployment:
mode: namespace
type: Deployment
cluster:
class: "ucp-ingress"
controllerClass: "k8s.io/ucp-ingress"
...

View File

@ -21,4 +21,5 @@ ingress:
- 0.2.15 Update kubernetes registry to registry.k8s.io
- 0.2.16 Updated deprecated IngressClass annotation
- 0.2.17 Fixed controller parameters
- 0.2.18 Fixed some additional controller issues
...