diff --git a/common/templates/calico/_networkpolicy.tpl b/common/templates/calico/_networkpolicy.tpl new file mode 100644 index 0000000000000000000000000000000000000000..6675b47d1fd8c0bf0415f8efa37e022810793709 --- /dev/null +++ b/common/templates/calico/_networkpolicy.tpl @@ -0,0 +1,29 @@ +# https://docs.tigera.io/calico/latest/network-policy/get-started/calico-policy/calico-network-policy +{{- define "common.calico.networkpolicy" -}} +apiVersion: projectcalico.org/v3 +kind: NetworkPolicy +metadata: + name: {{ .Values.name | default "network-policy" | quote }} + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "common.variables.labels" . | nindent 4 }} +spec: + {{- with .Values.selector }} + selector: + {{- toYaml . | nindent 4 }} + {{- end }} + types: + {{- .Values.types | default (list) | toYaml | nindent 4 }} + {{- with .Values.ingress }} + ingress: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.egress }} + egress: + {{- toYaml . | nindent 4 }} + {{- end }} +--- +{{- end }}