feat(common): Release 3.5.0 (#357)

Co-authored-by: Lawrence Gil <lawrence.gil@assemblyglobal.com>
This commit is contained in:
Bernd Schorgers 2024-10-04 15:50:55 +02:00 committed by GitHub
parent 5a722abfa9
commit 90e6b9e7cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 1092 additions and 164 deletions

View file

@ -31,8 +31,12 @@ metadata:
{{- printf "%s: %s" $key (tpl $value $rootContext | toYaml ) | nindent 4 }}
{{- end }}
{{- end }}
{{- with $configMapObject.data }}
data:
{{- with $configMapObject.data }}
{{- tpl (toYaml .) $rootContext | nindent 2 }}
{{- end }}
{{- end }}
{{- with $configMapObject.binaryData }}
binaryData:
{{- tpl (toYaml .) $rootContext | nindent 2 }}
{{- end }}
{{- end -}}

View file

@ -0,0 +1,40 @@
{{/*
This template serves as a blueprint for generating Role objects in Kubernetes.
*/}}
{{- define "bjw-s.common.class.rbac.Role" -}}
{{- $rootContext := .rootContext -}}
{{- $roleObject := .object -}}
{{- $labels := merge
($roleObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($roleObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
{{- $rules := "" -}}
{{- with $roleObject.rules -}}
{{- $rules = (toYaml . ) | trim -}}
{{- end -}}
---
apiVersion: rbac.authorization.k8s.io/v1
{{ with $roleObject.type -}}
kind: {{ . }}
{{ end -}}
metadata:
name: {{ $roleObject.name }}
{{- with $labels }}
labels: {{- toYaml . | nindent 4 -}}
{{- end }}
{{- with $annotations }}
annotations: {{- toYaml . | nindent 4 -}}
{{- end }}
{{ if eq $roleObject.type "Role" -}}
namespace: {{ $rootContext.Release.Namespace }}
{{- end -}}
{{ with $rules }}
rules: {{- tpl . $rootContext | nindent 2 }}
{{- end }}
{{- end -}}

View file

@ -0,0 +1,68 @@
{{/*
This template serves as a blueprint for generating RoleBinding objects in Kubernetes.
*/}}
{{- define "bjw-s.common.class.rbac.roleBinding" -}}
{{- $rootContext := .rootContext -}}
{{- $roleBindingObject := .object -}}
{{- $labels := merge
($roleBindingObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($roleBindingObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
{{- $subjects := list -}}
{{- with $roleBindingObject.subjects -}}
{{- range $subject := . -}}
{{- if hasKey . "identifier" -}}
{{- $subject := include "bjw-s.common.lib.serviceAccount.getByIdentifier" (dict "rootContext" $rootContext "id" .identifier) | fromYaml -}}
{{- $subject = pick $subject "name" -}}
{{- $_ := set $subject "kind" "ServiceAccount" -}}
{{- $_ := set $subject "namespace" $rootContext.Release.Namespace -}}
{{- $subjects = mustAppend $subjects $subject -}}
{{- else -}}
{{- $subject := dict "name" .name "kind" .kind "namespace" .namespace -}}
{{- $subjects = mustAppend $subjects $subject -}}
{{- end -}}
{{- end -}}
{{- $subjects = $subjects | uniq | toYaml -}}
{{- end -}}
{{- $role := dict -}}
{{- with $roleBindingObject.roleRef -}}
{{- if hasKey . "identifier" -}}
{{- $role = include "bjw-s.common.lib.rbac.role.getByIdentifier" (dict "rootContext" $rootContext "id" .identifier) | fromYaml -}}
{{- else -}}
{{- $_ := set $role "name" .name -}}
{{- $_ := set $role "type" .kind -}}
{{- end -}}
{{- end -}}
---
apiVersion: rbac.authorization.k8s.io/v1
{{ with $roleBindingObject.type -}}
kind: {{ . }}
{{ end -}}
metadata:
name: {{ $roleBindingObject.name }}
{{- with $labels }}
labels: {{- toYaml . | nindent 4 -}}
{{- end }}
{{- with $annotations }}
annotations: {{- toYaml . | nindent 4 -}}
{{- end }}
{{ if eq $roleBindingObject.type "RoleBinding" -}}
namespace: {{ $rootContext.Release.Namespace }}
{{- end }}
roleRef:
kind: {{ $role.type }}
name: {{ $role.name }}
apiGroup: rbac.authorization.k8s.io
{{ with $subjects -}}
subjects: {{- tpl . $rootContext | nindent 2 }}
{{- end -}}
{{- end -}}

View file

@ -60,6 +60,9 @@ spec:
{{- else }}
type: {{ $svcType }}
{{- end }}
{{- if $serviceObject.internalTrafficPolicy }}
internalTrafficPolicy: {{ $serviceObject.internalTrafficPolicy }}
{{- end }}
{{- if $serviceObject.externalTrafficPolicy }}
externalTrafficPolicy: {{ $serviceObject.externalTrafficPolicy }}
{{- end }}

View file

@ -32,5 +32,5 @@ metadata:
{{- end }}
{{- end }}
secrets:
- name: {{ include "bjw-s.common.lib.chart.names.fullname" $rootContext }}-sa-token
- name: {{ get (include "bjw-s.common.lib.secret.getByIdentifier" (dict "rootContext" $rootContext "id" (printf "%s-sa-token" $serviceAccountObject.identifier) ) | fromYaml) "name"}}
{{- end -}}