feat(common): Release 2.0.0-beta.2 (#176)

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2023-09-14 15:40:49 +02:00 committed by GitHub
parent ed407c00df
commit 9928235b84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
80 changed files with 1306 additions and 161 deletions

View file

@ -0,0 +1,49 @@
{{/*
This template serves as a blueprint for all networkPolicy objects that are created
within the common library.
*/}}
{{- define "bjw-s.common.class.networkpolicy" -}}
{{- $rootContext := .rootContext -}}
{{- $networkPolicyObject := .object -}}
{{- $labels := merge
($networkPolicyObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($networkPolicyObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
{{- $podSelector := dict -}}
{{- if (hasKey $networkPolicyObject "podSelector") -}}
{{- $podSelector = $networkPolicyObject.podSelector -}}
{{- else -}}
{{- $podSelector = dict "matchLabels" (merge
($networkPolicyObject.extraSelectorLabels | default dict)
(dict "app.kubernetes.io/component" $networkPolicyObject.controller)
(include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | fromYaml)
) -}}
{{- end -}}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ $networkPolicyObject.name }}
{{- with $labels }}
labels: {{- toYaml . | nindent 4 -}}
{{- end }}
{{- with $annotations }}
annotations: {{- toYaml . | nindent 4 -}}
{{- end }}
spec:
podSelector: {{- toYaml $podSelector | nindent 4 }}
{{- with $networkPolicyObject.policyTypes }}
policyTypes: {{- toYaml . | nindent 4 -}}
{{- end }}
{{- with $networkPolicyObject.rules.ingress }}
ingress: {{- tpl (toYaml .) $rootContext | nindent 4 -}}
{{- end }}
{{- with $networkPolicyObject.rules.egress }}
egress: {{- tpl (toYaml .) $rootContext | nindent 4 -}}
{{- end }}
{{- end -}}