Commit 02bb9ba
committed
lib/resourcemerge/core: Clear env and envFrom if unset in manifest
Even if the manifest authors state no opinions, these are not
properties that we want to allow cluster admins to manipulate. For
example, a customer cluster recently stuck a Deployment by inserting a
reference to a non-existent secret [1]:
$ yaml2json <namespaces/openshift-marketplace/apps/deployments.yaml | jq -r '.items[].spec.template.spec.containers[].envFrom[]'
{
"secretRef": {
"name": "openshift-reg"
}
}
$ yaml2json <namespaces/openshift-marketplace/pods/marketplace-operator-f7cc88d59-hhh75/marketplace-operator-f7cc88d59-hhh75.yaml | jq -r '.status.containerStatuses[].state'
{
"waiting": {
"message": "secret \"openshift-reg\" not found",
"reason": "CreateContainerConfigError"
}
}
The outgoing logic dates back to the beginning of reconciling these
properties in 14fab0b (add generic 2-way merge handler for random
types, 2018-09-27, openshift#26), and this commit's tightening follows on a
number of reconciliation tightenings like 29b92d2
(lib/resourcemerge/core: Clear livenessProbe and readinessProbe if nil
in required, 2020-01-16, openshift#298).
[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1951339#c01 parent 8132d6a commit 02bb9ba
1 file changed
+0
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | 144 | | |
148 | 145 | | |
149 | 146 | | |
150 | 147 | | |
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | 151 | | |
158 | 152 | | |
159 | 153 | | |
| |||
0 commit comments