Ports specified at communications now override the default ports of

the application.

Also added some comments to the generated output.
This commit is contained in:
2025-01-02 22:49:47 +01:00
parent 01700876cf
commit eba04ec132
4 changed files with 75 additions and 16 deletions
+7 -4
View File
@@ -8,11 +8,12 @@
{{- end }}
{{- define "peers" }}
{{- range .Applications }}
# {{ .Application.Namespace.Name }}/{{ .Application.Name }}
- podSelector:
matchLabels: {{ .MatchLabels | toYaml | nindent 12 }}
matchLabels: {{ .Application.MatchLabels | toYaml | nindent 12 }}
namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: {{ .Namespace.Name }}
kubernetes.io/metadata.name: {{ .Application.Namespace.Name }}
{{- if .Ports }}
ports:
{{- template "ports" .Ports }}
@@ -21,10 +22,11 @@
{{- end }}
{{- define "networks" }}
{{- range .Networks }}
# {{ .Network.Name }}
- ipBlock:
cidr: {{ .CIDR}}
cidr: {{ .Network.CIDR}}
except:
{{- range $except := .Except }}
{{- range $except := .Network.Except }}
- {{ $except }}
{{- end }}
{{- if .Ports }}
@@ -43,6 +45,7 @@ metadata:
namespace: "{{.app.Namespace.Name }}"
labels: {{ .labels | toYaml | nindent 4 }}
spec:
# {{ .app.Namespace.Name }}/{{ .app.Name }}
podSelector: {{ .app.MatchLabels | toYaml | nindent 4 }}
policyTypes:
{{- if or .ingress.Applications .ingress.Networks }}