mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
feat(common): Release 2.0.0-beta.2 (#176)
This commit is contained in:
parent
ed407c00df
commit
9928235b84
80 changed files with 1306 additions and 161 deletions
49
charts/library/common/templates/classes/_networkpolicy.tpl
Normal file
49
charts/library/common/templates/classes/_networkpolicy.tpl
Normal 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 -}}
|
Loading…
Add table
Add a link
Reference in a new issue