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

Add condition when deprovision fails cloud auth #1109

Merged

Conversation

twiest
Copy link
Contributor

@twiest twiest commented Sep 1, 2020

  • Add condition when deprovision fails cloud auth
  • Add unit tests
  • Manually test

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 1, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 1, 2020
@dgoodwin dgoodwin self-assigned this Sep 1, 2020
Copy link
Contributor

@dgoodwin dgoodwin left a comment

Choose a reason for hiding this comment

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

Looking good so far.

hivev1.AuthenticationFailureClusterDeprovisionCondition,
corev1.ConditionTrue,
authenticationFailedReason,
err.Error(),
Copy link
Contributor

Choose a reason for hiding this comment

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

These error messages don't contain any request IDs or anything that could change each time through? Just want to be sure we don't hotloop here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll check to make sure.

@@ -308,6 +308,9 @@ const (

// InstallLaunchErrorCondition is set when a cluster provision fails to launch an install pod
InstallLaunchErrorCondition ClusterDeploymentConditionType = "InstallLaunchError"

// UninstallPermissionFailure is set when a cluster deprovision fails because the cloud credentials are invalid.
UninstallPermissionFailure ClusterDeploymentConditionType = "UninstallPermissionFailure"
Copy link
Contributor

Choose a reason for hiding this comment

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

Appears to be unused.

@twiest twiest force-pushed the check_aws_creds_uninstall branch 3 times, most recently from 2e1141c to 3bb84b4 Compare September 7, 2020 22:28
@twiest twiest force-pushed the check_aws_creds_uninstall branch 2 times, most recently from c48f10d to e57ac8d Compare September 14, 2020 23:51
@twiest
Copy link
Contributor Author

twiest commented Sep 15, 2020

@dgoodwin @joelddiaz I believe I've addressed your comments. PTAL.

@dgoodwin
Copy link
Contributor

/lgtm

Needs [wip] removed though.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 15, 2020
@twiest twiest changed the title [wip] Add condition when deprovision fails cloud auth Add condition when deprovision fails cloud auth Sep 15, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 15, 2020
@twiest
Copy link
Contributor Author

twiest commented Sep 15, 2020

@dgoodwin Rebased and removed WIP. No other changes were made. Please re-lgtm.

// actuator found, ensure creds work.
err := actuator.TestCredentials(instance, r.Client, rLog)
if err != nil {
rLog.WithError(err).Error("Credential check failed")
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a warning or an info, not an error. This is a problem with user input not with the functioning of Hive.

scheme: scheme.Scheme,
deprovisionsDisabled: test.deprovisionsDisabled,
}

// TODO: Mock this
actuators = []Actuator{&awsActuator{awsClientFn: func(clusterDeprovision *hivev1.ClusterDeprovision, c client.Client, logger log.FieldLogger) (awsclient.Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not safe to do in unit tests. It has side effects which leak out of the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still not going to allow for the unit tests to be run in parallel. But I am fine with letting it go as in. We can fix this and the hibernation controller later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.

Comment on lines 369 to 371
if err != nil {
t.Errorf("unexpected error: %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.

Use asserts.

Suggested change
if err != nil {
t.Errorf("unexpected error: %v", err)
}
assert.NoError(t, err, "unexpected error getting ClusterDeprovision")

- [x] Add condition when deprovision fails cloud auth
- [x] Add unit tests
- [x] Manually test
@twiest
Copy link
Contributor Author

twiest commented Sep 16, 2020

@staebler I believe I've addressed your feedback. PTAL.

Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 16, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgoodwin, staebler, twiest

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 [dgoodwin,staebler,twiest]

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 30757d5 into openshift:master Sep 16, 2020
@dgoodwin dgoodwin mentioned this pull request Nov 12, 2020
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

6 participants