feat(common)!: Release v3.0.0-beta2 (#280)

This commit is contained in:
Bernd Schorgers 2024-03-08 08:51:40 +01:00 committed by GitHub
parent 23ae8131da
commit 21e751bc16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 419 additions and 368 deletions

View file

@ -0,0 +1,23 @@
{{/*
Return the enabled NetworkPolicies.
*/}}
{{- define "bjw-s.common.lib.networkPolicy.enabledNetworkPolicies" -}}
{{- $rootContext := .rootContext -}}
{{- $enabledNetworkPolicies := dict -}}
{{- range $name, $networkPolicy := $rootContext.Values.networkPolicy -}}
{{- if kindIs "map" $networkPolicy -}}
{{- /* Enable by default, but allow override */ -}}
{{- $networkPolicyEnabled := true -}}
{{- if hasKey $networkPolicy "enabled" -}}
{{- $networkPolicyEnabled = $networkPolicy.enabled -}}
{{- end -}}
{{- if $networkPolicyEnabled -}}
{{- $_ := set $enabledNetworkPolicies $name . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $enabledNetworkPolicies | toYaml -}}
{{- end -}}

View file

@ -12,7 +12,8 @@ Convert networkPolicy values to an object
{{- if $objectValues.nameOverride -}}
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
{{- else -}}
{{- if ne $identifier "main" -}}
{{- $enabledNetworkPolicies := (include "bjw-s.common.lib.networkPolicy.enabledNetworkPolicies" (dict "rootContext" $rootContext) | fromYaml ) }}
{{- if gt (len $enabledNetworkPolicies) 1 -}}
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
{{- end -}}
{{- end -}}