[bitnami/contour] Add IngressClass resource creation support (#7668)

This commit is contained in:
Sunghoon Kang
2021-10-06 15:31:16 +09:00
committed by GitHub
parent bfe34d4502
commit 176f1891ca
7 changed files with 47 additions and 13 deletions

View File

@@ -27,4 +27,4 @@ sources:
- https://github.com/envoyproxy/envoy
- https://github.com/bitnami/bitnami-docker-contour
- https://projectcontour.io
version: 5.6.1
version: 5.7.0

View File

@@ -125,8 +125,9 @@ $ helm uninstall my-release
| `contour.extraEnvVars` | Array containing extra env vars to be added to all Contour containers | `[]` |
| `contour.extraEnvVarsConfigMap` | ConfigMap containing extra env vars to be added to all Contour containers | `""` |
| `contour.extraEnvVarsSecret` | Secret containing extra env vars to be added to all Contour containers | `""` |
| `contour.ingressClass` | Name of the ingress class to route through this controller | `contour` |
| `contour.ingressClass.name` | Name of the ingress class to route through this controller | `contour` |
| `contour.ingressClass.create` | Whether to create or not the IngressClass resource | `false` |
| `contour.ingressClass.default` | Mark IngressClass resource as default for cluster | `false` |
### Envoy parameters

View File

@@ -93,3 +93,15 @@ contour: envoy.kind
"deployment". Please set a valid kind (--set envoy.kind="xxxx")
{{- end -}}
{{- end -}}
{{/* Create the name of the IngressClass to use. */}}
{{- define "contour.ingressClassName" -}}
{{- $ingressClass := .Values.contour.ingressClass }}
{{- if kindIs "string" $ingressClass -}}
{{ default "contour" $ingressClass }}
{{- else if kindIs "map" $ingressClass -}}
{{ default "contour" $ingressClass.name }}
{{- else -}}
contour
{{- end -}}
{{- end -}}

View File

@@ -68,9 +68,7 @@ spec:
- --contour-cert-file=/certs/tls.crt
- --contour-key-file=/certs/tls.key
- --config-path=/config/contour.yaml
{{- if .Values.contour.ingressClass }}
- --ingress-class-name={{ .Values.contour.ingressClass }}
{{- end }}
- --ingress-class-name={{ include "contour.ingressClassName" . }}
{{- if .Values.contour.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.contour.extraArgs "context" $) | nindent 12 }}
{{- end }}

View File

@@ -0,0 +1,16 @@
{{ $ingressClass := .Values.contour.ingressClass }}
{{- if kindIs "map" $ingressClass }}
{{- if $ingressClass.create }}
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: {{ include "contour.ingressClassName" . }}
annotations:
ingressclass.kubernetes.io/is-default-class: {{ $ingressClass.default | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: contour
spec:
controller: {{ printf "projectcontour.io/%s/%s-contour" .Release.Namespace (include "common.names.fullname" .) }}
{{- end }}
{{- end }}

View File

@@ -10,11 +10,7 @@ metadata:
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.ingressClass }}
kubernetes.io/ingress.class: {{ .Values.ingressClass }}
{{- else }}
kubernetes.io/ingress.class: contour
{{- end }}
kubernetes.io/ingress.class: {{ include "contour.ingressClassName" . }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}

View File

@@ -259,9 +259,20 @@ contour:
## @param contour.extraEnvVarsSecret Secret containing extra env vars to be added to all Contour containers
##
extraEnvVarsSecret: ""
## @param contour.ingressClass Name of the ingress class to route through this controller
## @param contour.ingressClass.name Name of the ingress class to route through this controller
## @param contour.ingressClass.create Whether to create or not the IngressClass resource
## @param contour.ingressClass.default Mark IngressClass resource as default for cluster
##
ingressClass: contour
## DEPRECATED: Use a map instead
## You can use the the 'contour.ingressClass' as a string to indicate the ingress
## class name. This will skip the creation of an IngressClass resource.
## e.g:
## ingressClass: contour
##
ingressClass:
name: contour
create: true
default: true
## @section Envoy parameters