rules appear to be working.

This commit is contained in:
Erik Brakkee 2025-01-04 00:16:25 +01:00
parent 144a624985
commit 93a743765d
6 changed files with 40 additions and 14 deletions

View File

@ -76,5 +76,8 @@ func main() {
},
}
cmd.Execute()
err = cmd.Execute()
if err != nil {
os.Exit(1)
}
}

View File

@ -0,0 +1,17 @@
{{- if not .Open }}
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-jaeger # required for OCSP
namespace: {{ .Name }}
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: observability
{{- end }}

View File

@ -24,7 +24,6 @@ spec:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: monitoring
# podSelector prometheus
egress:
- to:
- namespaceSelector:

View File

@ -1,5 +1,6 @@
{{- if not .Open }}
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-monitoring

View File

@ -1,6 +1,6 @@
{{- if not .Open }}
---
{{- if not .Open }}
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:

View File

@ -24,6 +24,7 @@
{{- end }}
{{- define "networks" }}
{{- range .Networks }}
{{- if .Network.CIDR }}
- {{.Rule}}:
# {{ .Network.Name }}
- ipBlock:
@ -32,8 +33,13 @@
{{- range $except := .Network.Except }}
- {{ $except }}
{{- end }}
{{- end }}
{{- if .Ports }}
{{- if .Network.CIDR }}
ports:
{{- else }}
- ports:
{{- end }}
{{- template "ports" .Ports }}
{{- end }}
{{- end }}