Skip to content

Commit 33a45a0

Browse files
committed
polish(helm): configurable NetworkPolicy ingress peers + clearer API_ENCRYPTION_KEY comment
- networkPolicy.ingressFrom lets operators scope the ingress-controller rule to a specific namespace/podSelector. Defaults to a single empty peer (`- {}`), which is the explicit form of "any source" — same effective behavior as the old `from: []` but unambiguous across CNIs. To restrict, override with e.g.: networkPolicy: ingressFrom: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: ingress-nginx - API_ENCRYPTION_KEY comment: drop the "must be exactly 64 hex characters" phrasing that sat awkwardly next to `openssl rand -hex 32`. The generation command already produces the required length.
1 parent 468dad1 commit 33a45a0

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

helm/sim/templates/networkpolicy.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ spec:
2626
- protocol: TCP
2727
port: {{ .Values.app.service.targetPort }}
2828
{{- end }}
29-
# Allow ingress from ingress controller
29+
# Allow ingress from ingress controller (configurable peers; defaults to any)
3030
{{- if .Values.ingress.enabled }}
31-
- from: []
31+
- from:
32+
{{- toYaml (default (list (dict)) .Values.networkPolicy.ingressFrom) | nindent 6 }}
3233
ports:
3334
- protocol: TCP
3435
port: {{ .Values.app.service.targetPort }}
@@ -131,9 +132,10 @@ spec:
131132
ports:
132133
- protocol: TCP
133134
port: {{ .Values.realtime.service.targetPort }}
134-
# Allow ingress from ingress controller
135+
# Allow ingress from ingress controller (configurable peers; defaults to any)
135136
{{- if .Values.ingress.enabled }}
136-
- from: []
137+
- from:
138+
{{- toYaml (default (list (dict)) .Values.networkPolicy.ingressFrom) | nindent 6 }}
137139
ports:
138140
- protocol: TCP
139141
port: {{ .Values.realtime.service.targetPort }}

helm/sim/values.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ app:
101101
CRON_SECRET: "" # OPTIONAL - required only if cronjobs.enabled=true, authenticates scheduled job requests
102102

103103
# Optional: API Key Encryption (RECOMMENDED for production)
104-
# Generate 64-character hex string using: openssl rand -hex 32 (outputs 64 hex chars = 32 bytes)
105-
API_ENCRYPTION_KEY: "" # OPTIONAL - encrypts API keys at rest, must be exactly 64 hex characters, if not set keys stored in plain text
104+
# Generate with: openssl rand -hex 32 (produces the required 64-hex-char / 32-byte value).
105+
API_ENCRYPTION_KEY: "" # OPTIONAL - encrypts API keys at rest; if unset, keys are stored in plain text
106106
REDIS_URL: "" # OPTIONAL - Redis connection string for caching/sessions; can also come from app secret or External Secrets
107107

108108
# Email & Communication
@@ -951,7 +951,18 @@ monitoring:
951951
networkPolicy:
952952
enabled: false
953953

954-
# Custom ingress rules
954+
# NetworkPolicyPeers allowed to reach the app/realtime pods on the
955+
# ingress-controller path. Defaults to `- {}` (any source), which matches the
956+
# common case where the ingress controller is the only thing routing to these
957+
# ports. To restrict ingress to a specific controller namespace, replace with:
958+
# ingressFrom:
959+
# - namespaceSelector:
960+
# matchLabels:
961+
# kubernetes.io/metadata.name: ingress-nginx
962+
ingressFrom:
963+
- {}
964+
965+
# Custom ingress rules appended to the policy
955966
ingress: []
956967

957968
# Egress configuration

0 commit comments

Comments
 (0)