Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport MHC pause feature from cluster API #887

Merged
merged 1 commit into from
Jul 24, 2021

Conversation

slintes
Copy link
Member

@slintes slintes commented Jul 12, 2021

With this PR we backport the pause annotation for MachineHealthCheck resources from upstream SIG Cluster API. It can be used for e.g. pausing remediation during cluster upgrades. See openshift/enhancements#827

Upstream code:
https://github.com/kubernetes-sigs/cluster-api/blob/87270011c60fdd336949ad22dd1b3c59498b8480/controllers/machinehealthcheck_controller.go#L134
https://github.com/kubernetes-sigs/cluster-api/blob/a5e1b5fe003a29ec09a433cc5f6118e76993caa2/api/v1alpha4/common_types.go#L54

Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, seems we have some surplus method in here though, any motivation behind that?

Comment on lines 20 to 38
// AddAnnotations sets the desired annotations on the object and returns true if the annotations have changed.
func AddAnnotations(o metav1.Object, desired map[string]string) bool {
if len(desired) == 0 {
return false
}
annotations := o.GetAnnotations()
if annotations == nil {
annotations = make(map[string]string)
o.SetAnnotations(annotations)
}
hasChanged := false
for k, v := range desired {
if cur, ok := annotations[k]; !ok || cur != v {
annotations[k] = v
hasChanged = true
}
}
return hasChanged
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere? Couldn't see it being used in the implementation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this package from upstream and removed everything unused. This one is used by the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests appear to be explicitly testing this function and not using any of the other functions we care about, right now I'd be tempted to delete those tests and this function as neither add anything from our use case as far as I can tell, do you agree?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I should look more carefully at the test code I copy. You're right. I remove the test file and the function

See openshift/enhancements#827

Signed-off-by: Marc Sluiter <msluiter@redhat.com>
Comment on lines -12 to -20
"github.com/openshift/machine-api-operator/pkg/util/external"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/klog/v2"

mapiv1 "github.com/openshift/machine-api-operator/pkg/apis/machine/v1beta1"
"github.com/openshift/machine-api-operator/pkg/metrics"
"github.com/openshift/machine-api-operator/pkg/util/conditions"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoelSpeed when is the best time to do cleanups like this? As we go, separate commit, or separate PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for the record, this is not a cleanup only, I needed to add new import, and there was no clear place where to add it because of the mix of mapi and k8s imports in 2 sections 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd normally prefer separate commits, especially when it's larger stuff.
As this one is pretty small, and not too difficult to review, I'm happy with it as is.

My general preference in situations like this is to "prefactor", make all the changes to the existing code that are needed as the first few commits, then add the new stuff later, makes the review process as a whole a lot easier in my experience

@slintes
Copy link
Member Author

slintes commented Jul 19, 2021

/retest

1 similar comment
@slintes
Copy link
Member Author

slintes commented Jul 20, 2021

/retest

@JoelSpeed
Copy link
Contributor

/approve
/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 22, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2021
@slintes
Copy link
Member Author

slintes commented Jul 23, 2021

/retest

@beekhof
Copy link
Contributor

beekhof commented Jul 23, 2021

Failing tests seem unrelated to the changes here and are failing for other PRs

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2021
@slintes
Copy link
Member Author

slintes commented Jul 23, 2021

/override e2e-aws-operator

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 23, 2021

@slintes: slintes unauthorized: /override is restricted to Repo administrators, approvers in top level OWNERS file.

In response to this:

/override e2e-aws-operator

Instructions 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.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@JoelSpeed
Copy link
Contributor

/override ci/prow/e2e-aws-operator

The test suite is permafailing on a broken test, we are working on a fix for this, I don't think there are any explicit problems presented by this PR

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 23, 2021

@JoelSpeed: Overrode contexts on behalf of JoelSpeed: ci/prow/e2e-aws-operator

In response to this:

/override ci/prow/e2e-aws-operator

The test suite is permafailing on a broken test, we are working on a fix for this, I don't think there are any explicit problems presented by this PR

Instructions 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.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@JoelSpeed
Copy link
Contributor

/override ci/prow/e2e-aws-operator

The test suite is permafailing on a broken test, we are working on a fix for this, I don't think there are any explicit problems presented by this PR

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 23, 2021

@JoelSpeed: Overrode contexts on behalf of JoelSpeed: ci/prow/e2e-aws-operator

In response to this:

/override ci/prow/e2e-aws-operator

The test suite is permafailing on a broken test, we are working on a fix for this, I don't think there are any explicit problems presented by this PR

Instructions 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.

@slintes
Copy link
Member Author

slintes commented Jul 23, 2021

/test ci/prow/e2e-aws-upgrade

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 23, 2021

@slintes: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test e2e-aws
  • /test e2e-aws-disruptive
  • /test e2e-aws-operator
  • /test e2e-aws-operator-tech-preview
  • /test e2e-aws-upgrade
  • /test e2e-azure
  • /test e2e-azure-operator
  • /test e2e-gcp
  • /test e2e-gcp-operator
  • /test e2e-libvirt
  • /test e2e-metal-ipi
  • /test e2e-metal-ipi-ovn-dualstack
  • /test e2e-metal-ipi-ovn-ipv6
  • /test e2e-metal-ipi-upgrade
  • /test e2e-metal-ipi-virtualmedia
  • /test e2e-openstack
  • /test e2e-vsphere
  • /test e2e-vsphere-operator
  • /test e2e-vsphere-serial
  • /test e2e-vsphere-upgrade
  • /test generate
  • /test goimports
  • /test golint
  • /test govet
  • /test images
  • /test unit
  • /test yaml-lint

Use /test all to run the following jobs:

  • pull-ci-openshift-machine-api-operator-master-e2e-aws
  • pull-ci-openshift-machine-api-operator-master-e2e-aws-disruptive
  • pull-ci-openshift-machine-api-operator-master-e2e-aws-operator
  • pull-ci-openshift-machine-api-operator-master-e2e-aws-upgrade
  • pull-ci-openshift-machine-api-operator-master-e2e-azure
  • pull-ci-openshift-machine-api-operator-master-e2e-azure-operator
  • pull-ci-openshift-machine-api-operator-master-e2e-gcp
  • pull-ci-openshift-machine-api-operator-master-e2e-gcp-operator
  • pull-ci-openshift-machine-api-operator-master-e2e-libvirt
  • pull-ci-openshift-machine-api-operator-master-e2e-metal-ipi-ovn-ipv6
  • pull-ci-openshift-machine-api-operator-master-e2e-vsphere
  • pull-ci-openshift-machine-api-operator-master-e2e-vsphere-upgrade
  • pull-ci-openshift-machine-api-operator-master-generate
  • pull-ci-openshift-machine-api-operator-master-goimports
  • pull-ci-openshift-machine-api-operator-master-golint
  • pull-ci-openshift-machine-api-operator-master-govet
  • pull-ci-openshift-machine-api-operator-master-images
  • pull-ci-openshift-machine-api-operator-master-unit
  • pull-ci-openshift-machine-api-operator-master-yaml-lint

In response to this:

/test ci/prow/e2e-aws-upgrade

Instructions 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.

@slintes
Copy link
Member Author

slintes commented Jul 23, 2021

/test e2e-aws-upgrade

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

11 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@n1r1
Copy link
Contributor

n1r1 commented Jul 24, 2021

/retest-required

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 24, 2021

@slintes: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-gcp-operator 73720ee link /test e2e-gcp-operator
ci/prow/e2e-azure-operator 73720ee link /test e2e-azure-operator
ci/prow/e2e-aws-disruptive 73720ee link /test e2e-aws-disruptive

Full PR test history. Your PR dashboard.

Instructions 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.

@JoelSpeed
Copy link
Contributor

/override ci/prow/e2e-aws-operator

The test suite is permafailing on a broken test, we are working on a fix for this, I don't think there are any explicit problems presented by this PR

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 24, 2021

@JoelSpeed: Overrode contexts on behalf of JoelSpeed: ci/prow/e2e-aws-operator

In response to this:

/override ci/prow/e2e-aws-operator

The test suite is permafailing on a broken test, we are working on a fix for this, I don't think there are any explicit problems presented by this PR

Instructions 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.

@openshift-merge-robot openshift-merge-robot merged commit 1cd30d8 into openshift:master Jul 24, 2021
@slintes slintes deleted the pause-annotation branch May 2, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants