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

Bug 1833256: [vSphere] Fail machine if multiple resource pools found #585

Merged

Conversation

alexander-demicev
Copy link
Contributor

Our current implementation allows users to either specify resourcePool in provider spec or leave it empty and fallback to default one. In case when more than one resource pools found lookup fails and the machine is stuck in Provisioning phase. In order to avoid machine getting stuck, this PR introduces machine failure on lookup error.

I have issues with creating additional resource pools in the mocked environment so tests will come later.

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels May 12, 2020
@openshift-ci-robot
Copy link
Contributor

@alexander-demichev: This pull request references Bugzilla bug 1833256, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1833256: [vSphere] Fail machine if multiple resource pools found

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.

@@ -442,6 +442,11 @@ func clone(s *machineScope) (string, error) {

resourcepool, err := s.GetSession().Finder.ResourcePoolOrDefault(s, resourcepoolPath)
if err != nil {
var multipleFoundError *find.MultipleFoundError
Copy link
Member

Choose a reason for hiding this comment

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

before we return an error, as far as I can see we keep returning an error? How does this make any difference for the machine to be stuck provisioning?

Copy link
Member

@enxebre enxebre May 12, 2020

Choose a reason for hiding this comment

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

was this meant to return InvalidMachineConfiguration()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, changed it to InvalidMachineConfiguration()

if errors.As(err, &multipleFoundError) {
return "", machinecontroller.InvalidMachineConfiguration("multiple resource pools found, specify one in config")
}

Copy link
Member

Choose a reason for hiding this comment

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

can you describe user stories that make it legit to return the next line as not InvalidMachineConfiguration?

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 thought about connection errors, when the controller can't reach vSphere endpoints.

Copy link
Member

Choose a reason for hiding this comment

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

is there a ways to discriminate that and include it here?

}

if errors.As(err, &notFoundError) {
return "", machinecontroller.InvalidMachineConfiguration("resource pool not found, specify valid value")
Copy link
Member

Choose a reason for hiding this comment

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

can we unit test this errors now?
we can move this to its own function if we need to.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Creating and deleting resource pools in the mocked environment doesn't look easy. I'll add tests in a follow-up PR.

@@ -442,6 +442,17 @@ func clone(s *machineScope) (string, error) {

resourcepool, err := s.GetSession().Finder.ResourcePoolOrDefault(s, resourcepoolPath)
if err != nil {
// TODO: move error checks to provider spec validation
var multipleFoundError *find.MultipleFoundError
var notFoundError *find.NotFoundError
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor nit, I would move this var declaration down to where it's used, grouping the vars declaration and usage makes the code slightly easier to follow

		var multipleFoundError *find.MultipleFoundError
		if errors.As(err, &multipleFoundError) {
			return "", machinecontroller.InvalidMachineConfiguration("multiple resource pools found, specify one in config")
		}

		var notFoundError *find.NotFoundError
		if errors.As(err, &notFoundError) {
			return "", machinecontroller.InvalidMachineConfiguration("resource pool not found, specify valid value")
		}

@JoelSpeed
Copy link
Contributor

/lgtm

Changes look good, should the tests PR be under the same BZ?

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 19, 2020
@alexander-demicev
Copy link
Contributor Author

I don't think so but I'd like both PRs to get into 4.5 so we can avoid having BZs related to this kind of errors.

@JoelSpeed
Copy link
Contributor

I don't think so but I'd like both PRs to get into 4.5 so we can avoid having BZs related to this kind of errors.

Cool, in which case make sure you create a BZ for that one as well

@enxebre
Copy link
Member

enxebre commented May 19, 2020

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

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 May 19, 2020
@openshift-bot
Copy link
Contributor

/retest

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

5 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

15 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented May 20, 2020

@alexander-demichev: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-azure ab2929a link /test e2e-azure

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your 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. I understand the commands that are listed here.

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-merge-robot openshift-merge-robot merged commit fe76daf into openshift:master May 20, 2020
@openshift-ci-robot
Copy link
Contributor

@alexander-demichev: All pull requests linked via external trackers have merged: openshift/machine-api-operator#585. Bugzilla bug 1833256 has been moved to the MODIFIED state.

In response to this:

Bug 1833256: [vSphere] Fail machine if multiple resource pools found

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.

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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. 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