pkg/asset/ignition/bootstrap/cvoignore: Add group/kind/name(space) collision detection#6247
Conversation
…llision detection docs/design/resource_dep.svg shows the complicated hierarchy of installer assets, and it is likely that not all users are familiar with all the manifests that the installer generates. It's also possible that there is a complicated hierarchy on the caller's side, and not just a single actor, creating additional manifests to feed into a create-manifests flow. With all of these inputs, it seems possible that folks occasionally call the installer with directory contents that result in multiple manifests for a single resource, as determined by the (group, kind, namespace, name) tuples. This commit adds a check at the slightly-before-Ignition-serialization overrides asset, which was already in the business of iterating over the content and building ClusterVersion spec.overrides. Failing fast before we build Ignition configs should allow for relatively cheap recovery, vs. a user's cluster failing to come up, or coming up with a config that diverges from their intention because some other manifest ended up taking precedence over the resource that they'd been trying to control. Not covered in this commit is deduping between manifests generated on the bootstrap machine (e.g. by the various 'render' calls to operator containers). But that can happen orthogonally, or not, and I think it's still worth having this cheap, pre-Ignition-config sanity check.
|
Lots of /retest |
patrickdillon
left a comment
There was a problem hiding this comment.
/lgtm
/assign @jhixson74
/retest
| namespace := u.GetNamespace() | ||
| name := u.GetName() | ||
|
|
||
| key := fmt.Sprintf("%s |! %s |! %s |! %s", group, kind, namespace, name) |
There was a problem hiding this comment.
Out of curiosity, why the |! separator?
There was a problem hiding this comment.
I didn't spend much time poking around in allowed-characters for the four entries, and I wanted a delimiter that was unlikely to show up in any of them.
There was a problem hiding this comment.
it would perhaps be more robust to just use %q%q%q%q?
|
This looks straight forward to me, I just want to see the tests pass first ;-) |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhixson74 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/skip |
|
/skip |
|
@wking: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
/hold Revision 1c9e68d was retested 3 times: holding |
|
/retest |
…nflict Try to confirm openshift/installer#6247 works as expected
|
Confirmed that this works as expected, with an error message that could be polished further, but which is already good enough to satisfy me ;) |
When generating the Ignition files, the installer already sets schdulableMasters to true when there are no worker nodes (i.e. in the SNO and compact cluster topologies. (See openshift/installer#2004) Therefore it is unnecessary to override it here (though it may be preferred to avoid a warning log from the installer). Since openshift/installer#6247, attempting to override the schedulableMasters setting causes installation to fail, because there are two manifests of the same type and name that conflict. Since we don't need to set this override when the installer would already do it, avoid doing so and triggering the error when the value is determined by the number of hosts rather than explicitly set by the user. The conflict still needs to be resolved so that the user can enable schedulableMasters, but this at least allows the SNO and compact topologies to install OpenShift 4.12 again. This partially reverts commit c45f369.
When generating the Ignition files, the installer already sets schdulableMasters to true when there are no worker nodes (i.e. in the SNO and compact cluster topologies. (See openshift/installer#2004) Therefore it is unnecessary to override it here (though it may be preferred to avoid a warning log from the installer). Since openshift/installer#6247, attempting to override the schedulableMasters setting causes installation to fail, because there are two manifests of the same type and name that conflict. Since we don't need to set this override when the installer would already do it, avoid doing so and triggering the error when the value is determined by the number of hosts rather than explicitly set by the user. The conflict still needs to be resolved so that the user can enable schedulableMasters, but this at least allows the SNO and compact topologies to install OpenShift 4.12 again. This partially reverts commit c45f369.
When generating the Ignition files, the installer already sets schdulableMasters to true when there are no worker nodes (i.e. in the SNO and compact cluster topologies. (See openshift/installer#2004) Therefore it is unnecessary to override it here (though it may be preferred to avoid a warning log from the installer). Since openshift/installer#6247, attempting to override the schedulableMasters setting causes installation to fail, because there are two manifests of the same type and name that conflict. Since we don't need to set this override when the installer would already do it, avoid doing so and triggering the error when the value is determined by the number of hosts rather than explicitly set by the user. The conflict still needs to be resolved so that the user can enable schedulableMasters, but this at least allows the SNO and compact topologies to install OpenShift 4.12 again. This partially reverts commit c45f369.
When generating the Ignition files, the installer already sets schdulableMasters to true when there are no worker nodes (i.e. in the SNO and compact cluster topologies. (See openshift/installer#2004) Therefore it is unnecessary to override it here (though it may be preferred to avoid a warning log from the installer). Since openshift/installer#6247, attempting to override the schedulableMasters setting causes installation to fail, because there are two manifests of the same type and name that conflict. Since we don't need to set this override when the installer would already do it, avoid doing so and triggering the error when the value is determined by the number of hosts rather than explicitly set by the user. The conflict still needs to be resolved so that the user can enable schedulableMasters, but this at least allows the SNO and compact topologies to install OpenShift 4.12 again. This partially reverts commit c45f369. Co-authored-by: Zane Bitter <zbitter@redhat.com>
docs/design/resource_dep.svgshows the complicated hierarchy of installer assets, and it is likely that not all users are familiar with all the manifests that the installer generates. It's also possible that there is a complicated hierarchy on the caller's side, and not just a single actor, creating additional manifests to feed into a create-manifests flow. With all of these inputs, it seems possible that folks occasionally call the installer with directory contents that result in multiple manifests for a single resource, as determined by the (group, kind, namespace, name) tuples. This commit adds a check at the slightly-before-Ignition-serialization overrides asset, which was already in the business of iterating over the content and building ClusterVersion spec.overrides. Failing fast before we build Ignition configs should allow for relatively cheap recovery, vs. a user's cluster failing to come up, or coming up with a config that diverges from their intention because some other manifest ended up taking precedence over the resource that they'd been trying to control.Not covered in this commit is deduping between manifests generated on the bootstrap machine (e.g. by the various 'render' calls to operator containers). But that can happen orthogonally, or not, and I think it's still worth having this cheap, pre-Ignition-config sanity check.