Files
semantica/deploy/helm/knowledge-explorer/templates/networkpolicy.yaml
T
KaifAhmad1 445c487fcc fix(helm): add namespace: .Release.Namespace to all Helm templates
Without an explicit namespace in metadata, checkov (CKV_K8S_21) flags
every resource as using the default namespace. Using .Release.Namespace
lets helm install --namespace semantica --create-namespace correctly
scope all resources to the target namespace.
2026-06-24 23:09:10 +05:30

44 lines
1.3 KiB
YAML

{{- if .Values.networkPolicy.enabled -}}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "knowledge-explorer.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "knowledge-explorer.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "knowledge-explorer.selectorLabels" . | nindent 6 }}
policyTypes:
- Ingress
- Egress
ingress:
# Allow traffic from the ingress controller namespace.
# Override networkPolicy.ingressNamespace in values if your controller uses a different namespace.
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingressNamespace }}
ports:
- protocol: TCP
port: {{ .Values.service.targetPort }}
# Allow traffic from pods within the same namespace (e.g. monitoring sidecars).
- from:
- podSelector: {}
ports:
- protocol: TCP
port: {{ .Values.service.targetPort }}
egress:
# FalkorDB
- ports:
- protocol: TCP
port: {{ .Values.networkPolicy.falkordbPort | default 6379 }}
# DNS resolution
- ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53
{{- end }}