feat(common): Release common 4.0.0 (#398)

Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
This commit is contained in:
Bernd Schorgers 2025-05-16 08:40:39 +02:00
parent 1e210f43e3
commit a01a89cb13
No known key found for this signature in database
327 changed files with 11181 additions and 7330 deletions

View file

@ -0,0 +1,23 @@
{{/*
Return the enabled PVCs.
*/}}
{{- define "bjw-s.common.lib.pvc.enabledPVCs" -}}
{{- $rootContext := .rootContext -}}
{{- $enabledPVCs := dict -}}
{{- range $identifier, $persistenceItem := $rootContext.Values.persistence -}}
{{- if kindIs "map" $persistenceItem -}}
{{- /* Enable PVC by default, but allow override */ -}}
{{- $pvcEnabled := true -}}
{{- if hasKey $persistenceItem "enabled" -}}
{{- $pvcEnabled = $persistenceItem.enabled -}}
{{- end -}}
{{- if and $pvcEnabled (eq (default "persistentVolumeClaim" $persistenceItem.type) "persistentVolumeClaim") (not $persistenceItem.existingClaim) -}}
{{- $_ := set $enabledPVCs $identifier . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $enabledPVCs | toYaml -}}
{{- end -}}

View file

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

View file

@ -0,0 +1,13 @@
{{/*
Return a PVC object by its Identifier.
*/}}
{{- define "bjw-s.common.lib.pvc.getByIdentifier" -}}
{{- $rootContext := .rootContext -}}
{{- $identifier := .id -}}
{{- $enabledPVCs := (include "bjw-s.common.lib.pvc.enabledPVCs" (dict "rootContext" $rootContext) | fromYaml ) }}
{{- if (hasKey $enabledPVCs $identifier) -}}
{{- $objectValues := get $enabledPVCs $identifier -}}
{{- include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $objectValues "itemCount" (len $enabledPVCs)) -}}
{{- end -}}
{{- end -}}

View file

@ -1,7 +0,0 @@
{{/*
Validate PVC values
*/}}
{{- define "bjw-s.common.lib.pvc.validate" -}}
{{- $rootContext := .rootContext -}}
{{- $pvcObject := .object -}}
{{- end -}}

View file

@ -1,26 +0,0 @@
{{/*
Convert PVC values to an object
*/}}
{{- define "bjw-s.common.lib.pvc.valuesToObject" -}}
{{- $rootContext := .rootContext -}}
{{- $identifier := .id -}}
{{- $objectValues := .values -}}
{{- /* Determine and inject the PVC name */ -}}
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
{{- if $objectValues.nameOverride -}}
{{- if ne $objectValues.nameOverride "-" -}}
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
{{- end -}}
{{- else -}}
{{- if not (eq $objectName $identifier) -}}
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
{{- end -}}
{{- end -}}
{{- $_ := set $objectValues "name" $objectName -}}
{{- $_ := set $objectValues "identifier" $identifier -}}
{{- /* Return the PVC object */ -}}
{{- $objectValues | toYaml -}}
{{- end -}}