From 477897b437eea8d30d7b08380a08553f19cb6701 Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Wed, 26 Jul 2023 18:40:14 +0200 Subject: [PATCH 1/8] Added the ingress defaultBackend as an option Signed-off-by: Tobias Harnickell --- charts/common/templates/_ingress-ingress.yaml | 11 +++++++++++ charts/common/values.schema.json | 18 ++++++++++++++++++ charts/common/values.yaml | 6 ++++++ 3 files changed, 35 insertions(+) diff --git a/charts/common/templates/_ingress-ingress.yaml b/charts/common/templates/_ingress-ingress.yaml index 1834e5ba..3a831f92 100644 --- a/charts/common/templates/_ingress-ingress.yaml +++ b/charts/common/templates/_ingress-ingress.yaml @@ -16,6 +16,17 @@ metadata: {{- end }} spec: ingressClassName: {{ $ingress.ingressClassName }} + {{- if $ingress.defaultBackend }} + defaultBackend: + service: + name: {{ template "library.name" $root }}-{{ $ingress.defaultBackend.serviceNameSuffix }} + port: + {{- if kindIs "float64" $ingress.defaultBackend.servicePort }} + number: {{ $ingress.defaultBackend.servicePort }} + {{- else }} + name: {{ $ingress.defaultBackend.servicePort | quote }} + {{- end }} + {{- end }} rules: {{- range $ingress.rules }} - host: {{ .host }} diff --git a/charts/common/values.schema.json b/charts/common/values.schema.json index b6828673..fd8d84e0 100644 --- a/charts/common/values.schema.json +++ b/charts/common/values.schema.json @@ -425,6 +425,24 @@ "ingressClassName": { "type": "string" }, + "defaultBackend":{ + "type":"object", + "required": [ + "serviceNameSuffix", + "servicePort" + ], + "properties": { + "serviceNameSuffix": { + "type": "string" + }, + "servicePort": { + "type": [ + "number", + "string" + ] + } + } + }, "rules": { "type": "array", "items": { diff --git a/charts/common/values.yaml b/charts/common/values.yaml index eda49440..8c41852c 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -36,6 +36,12 @@ ingress: deploy: false # -- ingressClassName, defines the class of the ingress controller. ingressClassName: "" + # -- defaultBackend is the default backend to use, if no other can be assigned. Comment out if not needed. + defaultBackend: + # -- serviceNameSuffix describes the suffix of the serviceName + serviceNameSuffix: component-1 + # -- servicePort describes the port where the service is listening at (can be either a string or a number) + servicePort: http # rules is a list of host rules used to configure the Ingress rules: # -- host is the URL which ingress is listening From bfee6ce17e2ae3bfadd7a2358a9a8e373e644633 Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Wed, 26 Jul 2023 18:45:12 +0200 Subject: [PATCH 2/8] Bump common Chart version Signed-off-by: Tobias Harnickell --- charts/common/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 82def375..6e8a8960 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: common description: "Bedag's common Helm chart to use for creating other Helm charts" -version: 10.2.0 +version: 10.3.0 # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives From d78a693edbe4ff25ca675ae131db6601b5a8aec9 Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Wed, 26 Jul 2023 18:52:28 +0200 Subject: [PATCH 3/8] Updated common documentation Signed-off-by: Tobias Harnickell --- charts/common/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/common/README.md b/charts/common/README.md index 88a7bf22..f35d4468 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -33,6 +33,9 @@ Major Changes to functions are documented with the version affected. **Before up | ingress.annotations | object | `{"nginx.ingress.kubernetes.io/ssl-redirect":"true"}` | annotations is a dictionary for defining ingress controller specific annotations | | ingress.deploy | bool | `false` | deploy has to be set to true for rendering to be applied | | ingress.ingressClassName | string | `""` | ingressClassName, defines the class of the ingress controller. | +| ingress.defaultBackend | object | `{"serviceNameSuffix":"component-1","servicePort":"http"}` | defaultBackend is a backend to use when no other rules can be applied for this ingress | +| ingress.defaultBackend.serviceNameSuffix | string | `"component-1"` | serviceNameSuffix describes the suffix of the serviceName | +| ingress.defaultBackend.servicePort | string | `"http"` | servicePort describes the port where the service is listening at (can be either a string or a number) | | ingress.rules[0] | object | `{"host":"myapp.cluster.local","http":{"paths":[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]}}` | host is the URL which ingress is listening | | ingress.rules[0].http | object | `{"paths":[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]}` | http is a list of http selectors pointing to backends | | ingress.rules[0].http.paths | list | `[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]` | paths is a list of paths that map requests to backends | From 338132f5c43b07d443c420fae37fc965ad726dc0 Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Thu, 27 Jul 2023 08:56:35 +0200 Subject: [PATCH 4/8] Regenerated documentation Signed-off-by: Tobias Harnickell --- charts/common/README.md | 10 +++++----- charts/crowd/README.md | 2 +- charts/e2g/README.md | 2 +- charts/goblackhole/README.md | 2 +- charts/kafdrop/README.md | 2 +- charts/manifests/README.md | 2 +- charts/raw/README.md | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/charts/common/README.md b/charts/common/README.md index f35d4468..0fc11262 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 10.2.0](https://img.shields.io/badge/Version-10.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 10.3.0](https://img.shields.io/badge/Version-10.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Bedag's common Helm chart to use for creating other Helm charts @@ -31,11 +31,11 @@ Major Changes to functions are documented with the version affected. **Before up | Key | Type | Default | Description | |-----|------|---------|-------------| | ingress.annotations | object | `{"nginx.ingress.kubernetes.io/ssl-redirect":"true"}` | annotations is a dictionary for defining ingress controller specific annotations | -| ingress.deploy | bool | `false` | deploy has to be set to true for rendering to be applied | -| ingress.ingressClassName | string | `""` | ingressClassName, defines the class of the ingress controller. | -| ingress.defaultBackend | object | `{"serviceNameSuffix":"component-1","servicePort":"http"}` | defaultBackend is a backend to use when no other rules can be applied for this ingress | +| ingress.defaultBackend | object | `{"serviceNameSuffix":"component-1","servicePort":"http"}` | defaultBackend is the default backend to use, if no other can be assigned. Comment out if not needed. | | ingress.defaultBackend.serviceNameSuffix | string | `"component-1"` | serviceNameSuffix describes the suffix of the serviceName | | ingress.defaultBackend.servicePort | string | `"http"` | servicePort describes the port where the service is listening at (can be either a string or a number) | +| ingress.deploy | bool | `false` | deploy has to be set to true for rendering to be applied | +| ingress.ingressClassName | string | `""` | ingressClassName, defines the class of the ingress controller. | | ingress.rules[0] | object | `{"host":"myapp.cluster.local","http":{"paths":[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]}}` | host is the URL which ingress is listening | | ingress.rules[0].http | object | `{"paths":[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]}` | http is a list of http selectors pointing to backends | | ingress.rules[0].http.paths | list | `[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]` | paths is a list of paths that map requests to backends | @@ -64,4 +64,4 @@ Major Changes to functions are documented with the version affected. **Before up | servicemonitor.basicAuth.passwordKey | string | `"password"` | passwordKey is the default key to grab the password in the secret | | servicemonitor.basicAuth.userKey | string | `"username"` | userKey is the default key to grab the username in the secret | | servicemonitor.deploy | bool | `false` | deploy has to be set to true for rendering to be applied | -| servicemonitor.endpoints | object | `{}` | | +| servicemonitor.endpoints | object | `{}` | | \ No newline at end of file diff --git a/charts/crowd/README.md b/charts/crowd/README.md index fd2385ea..c4c9b2f5 100644 --- a/charts/crowd/README.md +++ b/charts/crowd/README.md @@ -313,4 +313,4 @@ This can happen when the livenessprobe kills crowd to early. You will find the f [liquibase] Waiting for changelog lock.... ``` -You will need to do some fixing in the database. [See the following article for more](https://confluence.atlassian.com/crowdkb/crowd-server-does-not-start-could-not-acquire-change-log-lock-1019399699.html). To prevent this, increase the `initialDelaySeconds` value for the livenessProbe. +You will need to do some fixing in the database. [See the following article for more](https://confluence.atlassian.com/crowdkb/crowd-server-does-not-start-could-not-acquire-change-log-lock-1019399699.html). To prevent this, increase the `initialDelaySeconds` value for the livenessProbe. \ No newline at end of file diff --git a/charts/e2g/README.md b/charts/e2g/README.md index 35c01850..54f74286 100644 --- a/charts/e2g/README.md +++ b/charts/e2g/README.md @@ -158,4 +158,4 @@ Major Changes to functions are documented with the version affected. **Before up | statefulset.statefulsetExtras | object | `{}` | Extra Fields for Statefulset Manifest | | statefulset.updateStrategy | string | `"RollingUpdate"` | Statefulset [Update Strategy](https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets). **Statefulset only** | | statefulset.volumeClaimTemplates | list | `[]` | Statefulset [volumeClaimTemplates](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#components). **Statefulset only** | -| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | +| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | \ No newline at end of file diff --git a/charts/goblackhole/README.md b/charts/goblackhole/README.md index 01605dac..6b3cdad0 100644 --- a/charts/goblackhole/README.md +++ b/charts/goblackhole/README.md @@ -97,4 +97,4 @@ Major Changes to functions are documented with the version affected. **Before up | overwriteLabels | object | `{}` | Overwrites default labels, but not resource specific labels and common labels | | selectorLabels | object | `{}` | Define default [selectorLabels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) | -This Chart implements the Bedag Manifest Chart. Therefor there are a lot of values for you to play around. +This Chart implements the Bedag Manifest Chart. Therefor there are a lot of values for you to play around. \ No newline at end of file diff --git a/charts/kafdrop/README.md b/charts/kafdrop/README.md index a1af06fe..09a24c47 100644 --- a/charts/kafdrop/README.md +++ b/charts/kafdrop/README.md @@ -206,4 +206,4 @@ Major Changes to functions are documented with the version affected. **Before up | service.selector | object | `{}` | | | service.targetPort | string | `""` | | | service.type | string | `"ClusterIP"` | | -| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | +| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | \ No newline at end of file diff --git a/charts/manifests/README.md b/charts/manifests/README.md index 1d0c325f..e4d2c981 100644 --- a/charts/manifests/README.md +++ b/charts/manifests/README.md @@ -76,4 +76,4 @@ We recommend looking thirst through the **Kubernetes Manifests** section. ## Quickstart -[See this page for a quickstart](./templates/Quickstart.md) +[See this page for a quickstart](./templates/Quickstart.md) \ No newline at end of file diff --git a/charts/raw/README.md b/charts/raw/README.md index 36c5d80c..273229a2 100644 --- a/charts/raw/README.md +++ b/charts/raw/README.md @@ -65,4 +65,4 @@ A very basic example. But might get you started. | commonLabels | object | `{}` | Common Labels are added to each kubernetes resource manifest. | | overwriteLabels | object | `{}` | Overwrites default labels, but not resource specific labels and common labels | | resources | list | `[]` | Define resources to be deployed by the raw chart | -| templates | list | `[]` | Define templates which will be executed using the `tpl` function | +| templates | list | `[]` | Define templates which will be executed using the `tpl` function | \ No newline at end of file From 417fe3b0e18242241c89cd49f7bffbcbdc009ee9 Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Thu, 27 Jul 2023 09:09:55 +0200 Subject: [PATCH 5/8] Corrected documentation generation Signed-off-by: Tobias Harnickell --- charts/common/README.md | 2 +- charts/crowd/README.md | 2 +- charts/e2g/README.md | 2 +- charts/goblackhole/README.md | 2 +- charts/kafdrop/README.md | 2 +- charts/manifests/README.md | 2 +- charts/raw/README.md | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/common/README.md b/charts/common/README.md index 0fc11262..21e9ab46 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -64,4 +64,4 @@ Major Changes to functions are documented with the version affected. **Before up | servicemonitor.basicAuth.passwordKey | string | `"password"` | passwordKey is the default key to grab the password in the secret | | servicemonitor.basicAuth.userKey | string | `"username"` | userKey is the default key to grab the username in the secret | | servicemonitor.deploy | bool | `false` | deploy has to be set to true for rendering to be applied | -| servicemonitor.endpoints | object | `{}` | | \ No newline at end of file +| servicemonitor.endpoints | object | `{}` | | diff --git a/charts/crowd/README.md b/charts/crowd/README.md index c4c9b2f5..fd2385ea 100644 --- a/charts/crowd/README.md +++ b/charts/crowd/README.md @@ -313,4 +313,4 @@ This can happen when the livenessprobe kills crowd to early. You will find the f [liquibase] Waiting for changelog lock.... ``` -You will need to do some fixing in the database. [See the following article for more](https://confluence.atlassian.com/crowdkb/crowd-server-does-not-start-could-not-acquire-change-log-lock-1019399699.html). To prevent this, increase the `initialDelaySeconds` value for the livenessProbe. \ No newline at end of file +You will need to do some fixing in the database. [See the following article for more](https://confluence.atlassian.com/crowdkb/crowd-server-does-not-start-could-not-acquire-change-log-lock-1019399699.html). To prevent this, increase the `initialDelaySeconds` value for the livenessProbe. diff --git a/charts/e2g/README.md b/charts/e2g/README.md index 54f74286..35c01850 100644 --- a/charts/e2g/README.md +++ b/charts/e2g/README.md @@ -158,4 +158,4 @@ Major Changes to functions are documented with the version affected. **Before up | statefulset.statefulsetExtras | object | `{}` | Extra Fields for Statefulset Manifest | | statefulset.updateStrategy | string | `"RollingUpdate"` | Statefulset [Update Strategy](https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets). **Statefulset only** | | statefulset.volumeClaimTemplates | list | `[]` | Statefulset [volumeClaimTemplates](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#components). **Statefulset only** | -| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | \ No newline at end of file +| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | diff --git a/charts/goblackhole/README.md b/charts/goblackhole/README.md index 6b3cdad0..01605dac 100644 --- a/charts/goblackhole/README.md +++ b/charts/goblackhole/README.md @@ -97,4 +97,4 @@ Major Changes to functions are documented with the version affected. **Before up | overwriteLabels | object | `{}` | Overwrites default labels, but not resource specific labels and common labels | | selectorLabels | object | `{}` | Define default [selectorLabels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) | -This Chart implements the Bedag Manifest Chart. Therefor there are a lot of values for you to play around. \ No newline at end of file +This Chart implements the Bedag Manifest Chart. Therefor there are a lot of values for you to play around. diff --git a/charts/kafdrop/README.md b/charts/kafdrop/README.md index 09a24c47..a1af06fe 100644 --- a/charts/kafdrop/README.md +++ b/charts/kafdrop/README.md @@ -206,4 +206,4 @@ Major Changes to functions are documented with the version affected. **Before up | service.selector | object | `{}` | | | service.targetPort | string | `""` | | | service.type | string | `"ClusterIP"` | | -| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | \ No newline at end of file +| timezone | string | `"Europe/Zurich"` | Define Container Timezone (Sets TZ Environment) | diff --git a/charts/manifests/README.md b/charts/manifests/README.md index e4d2c981..1d0c325f 100644 --- a/charts/manifests/README.md +++ b/charts/manifests/README.md @@ -76,4 +76,4 @@ We recommend looking thirst through the **Kubernetes Manifests** section. ## Quickstart -[See this page for a quickstart](./templates/Quickstart.md) \ No newline at end of file +[See this page for a quickstart](./templates/Quickstart.md) diff --git a/charts/raw/README.md b/charts/raw/README.md index 273229a2..36c5d80c 100644 --- a/charts/raw/README.md +++ b/charts/raw/README.md @@ -65,4 +65,4 @@ A very basic example. But might get you started. | commonLabels | object | `{}` | Common Labels are added to each kubernetes resource manifest. | | overwriteLabels | object | `{}` | Overwrites default labels, but not resource specific labels and common labels | | resources | list | `[]` | Define resources to be deployed by the raw chart | -| templates | list | `[]` | Define templates which will be executed using the `tpl` function | \ No newline at end of file +| templates | list | `[]` | Define templates which will be executed using the `tpl` function | From 736ca4909d70184d7e2eec019fbd734314eb7b83 Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Thu, 27 Jul 2023 11:45:57 +0200 Subject: [PATCH 6/8] Made defaultBackend of Ingress config exclusive The defaultBackend config of the Ingress is now exclusive and cannot be used together with Ingress rules. Signed-off-by: Tobias Harnickell --- charts/common/README.md | 4 +--- charts/common/values.schema.json | 14 +++++++++++++- charts/common/values.yaml | 14 +++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/charts/common/README.md b/charts/common/README.md index 21e9ab46..e0248f8a 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -31,11 +31,9 @@ Major Changes to functions are documented with the version affected. **Before up | Key | Type | Default | Description | |-----|------|---------|-------------| | ingress.annotations | object | `{"nginx.ingress.kubernetes.io/ssl-redirect":"true"}` | annotations is a dictionary for defining ingress controller specific annotations | -| ingress.defaultBackend | object | `{"serviceNameSuffix":"component-1","servicePort":"http"}` | defaultBackend is the default backend to use, if no other can be assigned. Comment out if not needed. | -| ingress.defaultBackend.serviceNameSuffix | string | `"component-1"` | serviceNameSuffix describes the suffix of the serviceName | -| ingress.defaultBackend.servicePort | string | `"http"` | servicePort describes the port where the service is listening at (can be either a string or a number) | | ingress.deploy | bool | `false` | deploy has to be set to true for rendering to be applied | | ingress.ingressClassName | string | `""` | ingressClassName, defines the class of the ingress controller. | +| ingress.rules | list | `[{"host":"myapp.cluster.local","http":{"paths":[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]}}]` | rules is a list of host rules used to configure the Ingress | | ingress.rules[0] | object | `{"host":"myapp.cluster.local","http":{"paths":[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]}}` | host is the URL which ingress is listening | | ingress.rules[0].http | object | `{"paths":[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]}` | http is a list of http selectors pointing to backends | | ingress.rules[0].http.paths | list | `[{"backend":{"serviceNameSuffix":"component-1","servicePort":"http"},"path":"/","pathType":"ImplementationSpecific"}]` | paths is a list of paths that map requests to backends | diff --git a/charts/common/values.schema.json b/charts/common/values.schema.json index fd8d84e0..adadd64e 100644 --- a/charts/common/values.schema.json +++ b/charts/common/values.schema.json @@ -576,7 +576,19 @@ } } } - } + }, + "oneOf": [ + { + "required": [ + "defaultBackend" + ] + }, + { + "required": [ + "rules" + ] + } + ] }, "servicemonitor": { "type": "object", diff --git a/charts/common/values.yaml b/charts/common/values.yaml index 8c41852c..2406cc8e 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -36,13 +36,16 @@ ingress: deploy: false # -- ingressClassName, defines the class of the ingress controller. ingressClassName: "" - # -- defaultBackend is the default backend to use, if no other can be assigned. Comment out if not needed. - defaultBackend: + # START ONLY FOR SINGLE-SERVICE INGRESSES AND NOT RULESETS + # -- defaultBackend may be used if only a single Service Backend with no Rulesets is needed. + # defaultBackend: # -- serviceNameSuffix describes the suffix of the serviceName - serviceNameSuffix: component-1 + # serviceNameSuffix: component-1 # -- servicePort describes the port where the service is listening at (can be either a string or a number) - servicePort: http - # rules is a list of host rules used to configure the Ingress + # servicePort: http + # END ONLY FOR SINGLE-SERVICE INGRESSES AND NOT RULESETS + # START ONLY FOR MULTI-SERVICE INGRESSES AND/OR SPECIFIC RULES + # -- rules is a list of host rules used to configure the Ingress rules: # -- host is the URL which ingress is listening - host: myapp.cluster.local @@ -60,6 +63,7 @@ ingress: path: "/" # -- pathType Each path in an Ingress is required to have a corresponding path type. Comment out for using default ("ImplementationSpecific") pathType: "ImplementationSpecific" + # END ONLY FOR MULTI-SERVICE INGRESSES AND/OR SPECIFIC RULES # -- annotations is a dictionary for defining ingress controller specific annotations annotations: From 0458d51114acceb12e23197a2cd85ce2cbea6841 Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Thu, 27 Jul 2023 12:00:31 +0200 Subject: [PATCH 7/8] Modified ingress.ingress template Added if/else conditions to either configure a defaultBackend or backends with rules. TLS is not possible when defaultBackend is set. Signed-off-by: Tobias Harnickell --- charts/common/templates/_ingress-ingress.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/charts/common/templates/_ingress-ingress.yaml b/charts/common/templates/_ingress-ingress.yaml index 3a831f92..102f2730 100644 --- a/charts/common/templates/_ingress-ingress.yaml +++ b/charts/common/templates/_ingress-ingress.yaml @@ -17,6 +17,7 @@ metadata: spec: ingressClassName: {{ $ingress.ingressClassName }} {{- if $ingress.defaultBackend }} + {{- if not $ingress.rules }} defaultBackend: service: name: {{ template "library.name" $root }}-{{ $ingress.defaultBackend.serviceNameSuffix }} @@ -27,7 +28,9 @@ spec: name: {{ $ingress.defaultBackend.servicePort | quote }} {{- end }} {{- end }} + {{- end }} rules: + {{- if not $ingress.defaultBackend }} {{- range $ingress.rules }} - host: {{ .host }} http: @@ -46,10 +49,12 @@ spec: pathType: {{ .pathType | default "ImplementationSpecific" | quote }} {{- end }} {{- end }} + {{- end }} {{- if $ingress.tls }} {{- if and (ne $ingress.tls.type "none") (ne $ingress.tls.type "") }} tls: - hosts: + {{- if $ingress.rules }} {{- range $ingress.rules }} - {{ .host }} {{- end }} @@ -58,6 +63,7 @@ spec: {{- else if eq $ingress.tls.type "existing" }} secretName: {{ $ingress.tls.existing.secret }} {{- end }} + {{- end }} {{- end }} {{- end }} {{- end }} From 2463981f661adf52fc84bc8e66befb8f63d1f70a Mon Sep 17 00:00:00 2001 From: Tobias Harnickell Date: Thu, 27 Jul 2023 12:08:22 +0200 Subject: [PATCH 8/8] Corrected ingress.ingress template conditional between `defaultBackend` and `rules` simplified. Signed-off-by: Tobias Harnickell --- charts/common/templates/_ingress-ingress.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/charts/common/templates/_ingress-ingress.yaml b/charts/common/templates/_ingress-ingress.yaml index 102f2730..51b4ea17 100644 --- a/charts/common/templates/_ingress-ingress.yaml +++ b/charts/common/templates/_ingress-ingress.yaml @@ -29,8 +29,8 @@ spec: {{- end }} {{- end }} {{- end }} + {{- if not $ingress.defaultBackend }} rules: - {{- if not $ingress.defaultBackend }} {{- range $ingress.rules }} - host: {{ .host }} http: @@ -49,12 +49,10 @@ spec: pathType: {{ .pathType | default "ImplementationSpecific" | quote }} {{- end }} {{- end }} - {{- end }} {{- if $ingress.tls }} {{- if and (ne $ingress.tls.type "none") (ne $ingress.tls.type "") }} tls: - hosts: - {{- if $ingress.rules }} {{- range $ingress.rules }} - {{ .host }} {{- end }} @@ -63,7 +61,7 @@ spec: {{- else if eq $ingress.tls.type "existing" }} secretName: {{ $ingress.tls.existing.secret }} {{- end }} - {{- end }} + {{- end }} {{- end }} {{- end }} {{- end }}