fix(common): ensure no loadbalancer reservation is made and ingress is not connected to ingresscontroller with Stop-All set

This commit is contained in:
Kjeld Schouten
2023-12-24 20:37:12 +01:00
parent 276e87447e
commit edf4b7f96c
3 changed files with 14 additions and 2 deletions

View File

@@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 16.2.21
version: 16.2.22

View File

@@ -24,6 +24,12 @@ objectData: The object data to be used to render the Ingress.
{{- include "tc.v1.common.lib.ingress.integration.certManager" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
{{- include "tc.v1.common.lib.ingress.integration.traefik" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
{{- include "tc.v1.common.lib.ingress.integration.homepage" (dict "rootCtx" $rootCtx "objectData" $objectData) }}
{{/* When Stop All is set, force ingressClass "stopped" to yeet ingress from the ingresscontroller */}}
{{- $ingressClassName := (tpl $objectData.ingressClassName $rootCtx) -}}
{{- if (include "tc.v1.common.lib.util.stopAll" $rootCtx) -}}
{{- $ingressClassName = "stopped" -}}
{{- end -}}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
@@ -42,7 +48,7 @@ metadata:
{{- end }}
spec:
{{- if $objectData.ingressClassName }}
ingressClassName: {{ tpl $objectData.ingressClassName $rootCtx }}
ingressClassName: {{ $ingressClassName }}
{{- end }}
rules:
{{- range $h := $objectData.hosts }}

View File

@@ -51,7 +51,13 @@ objectData: The service data, that will be used to render the Service object.
{{- $svcType = "ClusterIP" -}}
{{- end -}}
{{- end -}}
{{/* When Stop All is set, force ClusterIP as well */}}
{{- if (include "tc.v1.common.lib.util.stopAll" $rootCtx) -}}
{{- $svcType = "ClusterIP" -}}
{{- end -}}
{{- $_ := set $objectData "type" $svcType }}
---
apiVersion: v1