Set default clusterID labels only on machine#659
Set default clusterID labels only on machine#659openshift-merge-robot merged 3 commits intoopenshift:masterfrom
Conversation
This tries to fix the following scenario: We set ms.Spec.Selector.MatchLabels[MachineClusterIDLabel] if it's not present. It's not present and we set it to the correct value. If there happens to be a bad label in `ms.Spec.Template.Labels` this would result in a miss match. Follow for openshift#608, openshift#644 and openshift#653.
| @@ -124,24 +124,6 @@ func (h *machineSetDefaulterHandler) defaultMachineSet(ms *MachineSet) (bool, ut | |||
| if ok, err := h.webhookOperations(m, h.clusterID); !ok { | |||
| errs = append(errs, err.Errors()...) | |||
| } else { | |||
There was a problem hiding this comment.
Do we need this else statement anymore?
There was a problem hiding this comment.
yes, this is the original logic to set the defaulted spec regardless the labels.
There was a problem hiding this comment.
We're only appending errors in one place. It seems we should just exit early there and get rid of the else statement.
| } | ||
|
|
||
| // Restore the defaulted template | ||
| ms.Spec.Template.Spec = m.Spec |
There was a problem hiding this comment.
Is this line doing anything useful now?
There was a problem hiding this comment.
yes, this is the original logic to set the defaulted spec regardless the labels.
There was a problem hiding this comment.
Okay, the comment for this code doesn't really make sense. It seems like it should say
"Update the template to the defaulted one" or similar. "Restore" implies we're undoing something.
|
/retest |
2 similar comments
|
/retest |
|
/retest |
| if tc.presetClusterID { | ||
| gs.Expect(ms.Spec.Selector.MatchLabels[MachineClusterIDLabel]).To(BeIdenticalTo(presetClusterID)) | ||
| gs.Expect(ms.Spec.Template.Labels[MachineClusterIDLabel]).To(BeIdenticalTo(presetClusterID)) | ||
|
|
||
| } else { | ||
| gs.Expect(ms.Spec.Selector.MatchLabels[MachineClusterIDLabel]).To(BeIdenticalTo(tc.clusterID)) | ||
| gs.Expect(ms.Spec.Template.Labels[MachineClusterIDLabel]).To(BeIdenticalTo(tc.clusterID)) | ||
| } |
There was a problem hiding this comment.
I think it needs to test the opposite is true - the ClusterID label didn't change.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Danil-Grigorev 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 |
|
/retest |
| @@ -124,24 +124,6 @@ func (h *machineSetDefaulterHandler) defaultMachineSet(ms *MachineSet) (bool, ut | |||
| if ok, err := h.webhookOperations(m, h.clusterID); !ok { | |||
| errs = append(errs, err.Errors()...) | |||
| } else { | |||
There was a problem hiding this comment.
We're only appending errors in one place. It seems we should just exit early there and get rid of the else statement.
| } | ||
|
|
||
| // Restore the defaulted template | ||
| ms.Spec.Template.Spec = m.Spec |
There was a problem hiding this comment.
Okay, the comment for this code doesn't really make sense. It seems like it should say
"Update the template to the defaulted one" or similar. "Restore" implies we're undoing something.
|
/test e2e-aws-operator |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
10 similar comments
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
5 similar comments
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
@enxebre: The following test 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. |
This tries to fix the following scenario:
We set ms.Spec.Selector.MatchLabels[MachineClusterIDLabel] if it's not present. It's not present and we set it to the correct value. If there happens to be a bad label in
ms.Spec.Template.Labelsthis would result in a miss match.Follow up for
#608,
#644 and
#653.