mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
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.
44 lines
1.3 KiB
YAML
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 }}
|