Skip to content

Commit d5c2e8e

Browse files
committed
fix(helm): preserve STS serviceName + networkPolicy.egress back-compat
Greptile flagged two real upgrade-breaking changes vs the prior chart: 1. statefulset-postgresql spec.serviceName flipped from <name>-postgresql to <name>-postgresql-headless. spec.serviceName is immutable, so any existing install would hit 'Forbidden: updates to statefulset spec ...' on helm upgrade. Revert to the original name (the headless Service in services.yaml is added alongside, not as a swap). 2. networkPolicy.egress changed from a list to a map ({extraRules, exceptCidrs}), silently dropping any custom egress list set by existing users. Restore the original list semantics for networkPolicy.egress and move cloud-metadata blocking to a sibling top-level field networkPolicy.egressExceptCidrs. Adds NOTES.txt upgrade-notes entry covering both + the ESO v1→v1beta1 default flip (functionally a no-op, but worth surfacing).
1 parent 05892f7 commit d5c2e8e

5 files changed

Lines changed: 36 additions & 20 deletions

File tree

helm/sim/templates/NOTES.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,16 @@ Your release is named {{ .Release.Name }} in namespace {{ .Release.Namespace }}.
8181
# Upgrade after changing values
8282
helm upgrade {{ .Release.Name }} ./helm/sim --namespace {{ .Release.Namespace }} -f your-values.yaml
8383

84-
5. Where to go next:
84+
5. Upgrade notes (read before upgrading from a chart version released before this one):
85+
86+
* externalSecrets.apiVersion default is "v1beta1" (was "v1"). v1beta1 is
87+
supported by every ESO release from v0.7+ through current. If you're on
88+
ESO v0.17+ and want the graduated v1 API, set externalSecrets.apiVersion: "v1".
89+
* networkPolicy.egress remains a list of custom egress rules (unchanged).
90+
Cloud-metadata CIDR blocking is now configured via networkPolicy.egressExceptCidrs
91+
(defaults to AWS/GCP/Azure IMDS + ECS task metadata).
92+
93+
6. Where to go next:
8594

8695
* Production checklist: helm/sim/README.md (search "Production checklist")
8796
* Troubleshooting: helm/sim/README.md (search "Troubleshooting")

helm/sim/templates/networkpolicy.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ spec:
107107
- ipBlock:
108108
cidr: 0.0.0.0/0
109109
except:
110-
{{- range (default (list "169.254.169.254/32" "169.254.170.2/32") .Values.networkPolicy.egress.exceptCidrs) }}
110+
{{- range (default (list "169.254.169.254/32" "169.254.170.2/32") .Values.networkPolicy.egressExceptCidrs) }}
111111
- {{ . | quote }}
112112
{{- end }}
113113
ports:
114114
- protocol: TCP
115115
port: 443
116116
# Allow custom egress rules
117-
{{- with .Values.networkPolicy.egress.extraRules }}
117+
{{- with .Values.networkPolicy.egress }}
118118
{{- toYaml . | nindent 2 }}
119119
{{- end }}
120120

@@ -189,14 +189,14 @@ spec:
189189
- ipBlock:
190190
cidr: 0.0.0.0/0
191191
except:
192-
{{- range (default (list "169.254.169.254/32" "169.254.170.2/32") .Values.networkPolicy.egress.exceptCidrs) }}
192+
{{- range (default (list "169.254.169.254/32" "169.254.170.2/32") .Values.networkPolicy.egressExceptCidrs) }}
193193
- {{ . | quote }}
194194
{{- end }}
195195
ports:
196196
- protocol: TCP
197197
port: 443
198198
# Allow custom egress rules
199-
{{- with .Values.networkPolicy.egress.extraRules }}
199+
{{- with .Values.networkPolicy.egress }}
200200
{{- toYaml . | nindent 2 }}
201201
{{- end }}
202202
{{- end }}
@@ -296,7 +296,7 @@ spec:
296296
- ipBlock:
297297
cidr: 0.0.0.0/0
298298
except:
299-
{{- range (default (list "169.254.169.254/32" "169.254.170.2/32") .Values.networkPolicy.egress.exceptCidrs) }}
299+
{{- range (default (list "169.254.169.254/32" "169.254.170.2/32") .Values.networkPolicy.egressExceptCidrs) }}
300300
- {{ . | quote }}
301301
{{- end }}
302302
ports:

helm/sim/templates/statefulset-postgresql.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ metadata:
9090
labels:
9191
{{- include "sim.postgresql.labels" . | nindent 4 }}
9292
spec:
93-
serviceName: {{ include "sim.fullname" . }}-postgresql-headless
93+
# Must remain {{ include "sim.fullname" . }}-postgresql (not the -headless
94+
# name) — spec.serviceName is immutable on a StatefulSet, and the prior
95+
# chart shipped with this value. Changing it would break `helm upgrade` for
96+
# every existing install with `Forbidden: updates to statefulset spec ...`.
97+
# The headless Service in services.yaml is added alongside, not as a swap.
98+
serviceName: {{ include "sim.fullname" . }}-postgresql
9499
replicas: 1
95100
minReadySeconds: 10
96101
podManagementPolicy: OrderedReady

helm/sim/tests/networkpolicy_test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ tests:
128128
- protocol: TCP
129129
port: 3000
130130

131-
- it: egress.extraRules are appended to both app and realtime NetworkPolicies
131+
- it: networkPolicy.egress (custom rules) are appended to both app and realtime NetworkPolicies
132132
set:
133133
<<: *defaults
134-
networkPolicy.egress.extraRules:
134+
networkPolicy.egress:
135135
- to: []
136136
ports:
137137
- protocol: TCP

helm/sim/values.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ monitoring:
954954
# to each other and to required external services (DNS, HTTPS) while blocking
955955
# everything else. The egress block additionally blacklists cloud metadata
956956
# endpoints (169.254.169.254/32, 169.254.170.2/32) by default — extend
957-
# egress.exceptCidrs with your cluster's API server CIDR for tighter isolation.
957+
# egressExceptCidrs with your cluster's API server CIDR for tighter isolation.
958958
# Your CNI must support NetworkPolicy (Calico, Cilium, GKE Dataplane V2, etc.).
959959
networkPolicy:
960960
enabled: false
@@ -973,16 +973,18 @@ networkPolicy:
973973
# Custom ingress rules appended to the policy
974974
ingress: []
975975

976-
# Egress configuration
977-
egress:
978-
# CIDRs excluded from broad HTTPS (443) egress.
979-
# Defaults block AWS/GCP/Azure IMDS (169.254.169.254/32) and ECS task metadata
980-
# (169.254.170.2/32). Add your cluster's API server CIDR for stronger isolation.
981-
exceptCidrs:
982-
- "169.254.169.254/32"
983-
- "169.254.170.2/32"
984-
# Custom egress rules appended to the policy
985-
extraRules: []
976+
# Custom egress rules appended to the policy.
977+
# Kept as a top-level list (not a map) for backward compatibility with the
978+
# pre-1.0 chart that shipped `networkPolicy.egress: []`. Existing values
979+
# files continue to work without changes.
980+
egress: []
981+
982+
# CIDRs excluded from broad HTTPS (443) egress.
983+
# Defaults block AWS/GCP/Azure IMDS (169.254.169.254/32) and ECS task metadata
984+
# (169.254.170.2/32). Add your cluster's API server CIDR for stronger isolation.
985+
egressExceptCidrs:
986+
- "169.254.169.254/32"
987+
- "169.254.170.2/32"
986988

987989
# Shared storage for enterprise workflows requiring data sharing between pods
988990
sharedStorage:

0 commit comments

Comments
 (0)