exiting with an error when a capability cannot be found.

This commit is contained in:
Erik Brakkee 2025-01-03 20:40:28 +01:00
parent 852833764c
commit 144a624985
2 changed files with 25 additions and 1 deletions

View File

@ -112,7 +112,8 @@ func (t *PolicyTemplates) NamespaceTemplates(policyType string, capabilities []s
log.Printf("Found template for capability '%s'", capability) log.Printf("Found template for capability '%s'", capability)
res = append(res, tmpl) res = append(res, tmpl)
} else { } else {
log.Printf("Capability '%s' not found", capability) fmt.Fprintf(os.Stderr, "ERROR: Capability '%s' not found\n", capability)
os.Exit(1)
} }
} }
return res return res

View File

@ -0,0 +1,23 @@
{{- if not .Open }}
apiVersion: networking.k8s.io/v1
metadata:
name: allow-monitoring
namespace: {{.Name}}
spec:
podSelector:
matchLabels: {}
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app.kubernetes.io/name: prometheus
namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: monitoring
ports:
- port: prometheus
{{- end }}