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

cluster claim: use watch API #1874

Merged
merged 1 commit into from
May 18, 2021
Merged

cluster claim: use watch API #1874

merged 1 commit into from
May 18, 2021

Conversation

hongkailiu
Copy link
Member

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hongkailiu

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2021
@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 14, 2021
pkg/steps/cluster_claim.go Outdated Show resolved Hide resolved
pkg/steps/cluster_claim.go Outdated Show resolved Hide resolved
@hongkailiu
Copy link
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 29, 2021
@stevekuznetsov
Copy link
Contributor

stevekuznetsov commented May 3, 2021

Part of DPTP-2099

pkg/steps/artifacts.go Outdated Show resolved Hide resolved
pkg/steps/artifacts.go Outdated Show resolved Hide resolved
pkg/steps/artifacts_test.go Outdated Show resolved Hide resolved
pkg/steps/artifacts_test.go Outdated Show resolved Hide resolved
pkg/steps/artifacts_test.go Outdated Show resolved Hide resolved
@openshift-ci openshift-ci bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 6, 2021
return true, nil
},
); err != nil {
t.Errorf("unexpected error occurred in objectFunc: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can't call this from a goroutine - not only will it not kill the test, but if you end up calling this after the test is done, it will panic

Copy link
Member Author

Choose a reason for hiding this comment

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

func() (bool, error) {
ctx := context.TODO()
pod := &coreapi.Pod{}
if err := client.Get(ctx, ctrlruntimeclient.ObjectKey{Name: podName, Namespace: ns}, pod); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

What creates this Pod?

Copy link
Member Author

Choose a reason for hiding this comment

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

pkg/steps/artifacts_test.go Outdated Show resolved Hide resolved
pkg/steps/artifacts_test.go Outdated Show resolved Hide resolved
pkg/steps/cluster_claim.go Outdated Show resolved Hide resolved
claimNamespace := clusterPool.Namespace
claim := &hivev1.ClusterClaim{
ret := &hivev1.ClusterClaim{
Copy link
Contributor

Choose a reason for hiding this comment

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

ret is a bad name as it's not descriptive. Why not claim?

Copy link
Member Author

Choose a reason for hiding this comment

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

We keep the created one to return because it will be deleted no matter what happens in the acquire function.
Renamed the var into which is passed to the acquire function

}
ret = claim
logrus.Info("The claimed cluster is ready.")
clusterDeploymentName := claim.Spec.Namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the utility in this local variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

For improve the readability of the code.
Removed.

pkg/steps/cluster_claim.go Outdated Show resolved Hide resolved
pkg/steps/cluster_claim.go Outdated Show resolved Hide resolved
logrus.WithField("clusterClaim.Namespace", clusterClaim.Namespace).WithField("clusterClaim.Name", clusterClaim.Name).Debug("Deleting cluster claim.")
if err := hiveClient.Delete(ctx, clusterClaim); err != nil {
if err := s.hiveClient.Delete(ctx, clusterClaim); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Likely worth it to retry a couple times on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Add retry.
Why it could fail in the first place? Do we do the retry on other object deleting?

@hongkailiu
Copy link
Member Author

@stevekuznetsov
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 18, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 18, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hongkailiu, stevekuznetsov

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:
  • OWNERS [hongkailiu,stevekuznetsov]

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

@openshift-merge-robot openshift-merge-robot merged commit ead600a into openshift:master May 18, 2021
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.

None yet

5 participants