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 1843327: [vSphere] Improve provider spec validation #605

Merged

Conversation

alexander-demicev
Copy link
Contributor

@alexander-demicev alexander-demicev commented Jun 1, 2020

Return invalid machine configuration error on missing VM template and missing user data secret

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

/lgtm

i just had a couple minor questions

@@ -410,7 +410,9 @@ func clone(s *machineScope) (string, error) {

vmTemplate, err := s.GetSession().FindVM(*s, "", s.providerSpec.Template)
if err != nil {
return "", err
notFoundMsg := "template not found, specify valid value"
Copy link
Contributor

Choose a reason for hiding this comment

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

given that notFoundMsg doesn't change, i wonder if it's better to make it a const?

Suggested change
notFoundMsg := "template not found, specify valid value"
const notFoundMsg = "template not found, specify valid value"

@@ -589,7 +591,10 @@ func getNetworkDevices(s *machineScope, devices object.VirtualDeviceList) ([]typ

ref, err := s.GetSession().Finder.Network(s.Context, netSpec.NetworkName)
if err != nil {
return nil, fmt.Errorf("unable to find network %q: %w", netSpec.NetworkName, err)
multipleFoundMsg := "multiple networks found, specify one in config"
notFoundMsg := "network not found, specify valid value"
Copy link
Contributor

Choose a reason for hiding this comment

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

similar question here for multipleFoundMsg and notFoundMsg

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 1, 2020
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.

LGTM once Mike's suggestions are fixed up

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

@JoelSpeed @elmiko all fixed

/retest

notFoundMsg := "folder not found, specify valid value"
defaultError := fmt.Errorf("unable to get folder for %q: %w", folderPath, err)
return "", handleVSphereError(multipleFoundMsg, notFoundMsg, defaultError, err)
}

datastore, err := s.GetSession().Finder.DatastoreOrDefault(s, datastorePath)
if err != nil {
multipleFoundMsg := "multiple datastores found, specify one in config"
const multipleFoundMsg = "multiple datastores found, specify one in config"
Copy link
Member

@alexander-demicev
Copy link
Contributor Author

/retest

@@ -133,7 +134,7 @@ func (s *machineScope) GetSession() *session.Session {
// provider spec, if one is set.
func (s *machineScope) GetUserData() ([]byte, error) {
if s.providerSpec == nil || s.providerSpec.UserDataSecret == nil {
return nil, nil
return nil, machinecontroller.InvalidMachineConfiguration("user data secret is missing in provider spec")
Copy link
Member

Choose a reason for hiding this comment

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

Although I think this is fine and it makes sense as we don't currently support any model where this could be empty fwiw I don't think we are doing the same in other providers.
In the near future with a model where MCO generate secrets for machines on demand this might need to change.
openshift/enhancements#368
openshift/enhancements#201

@enxebre
Copy link
Member

enxebre commented Jul 1, 2020

"Improve" seems too wide, Can we include "by returning invalid machine configuration error on missing VM template and missing user data secret" as in the desc?
/approve

@enxebre
Copy link
Member

enxebre commented Jul 1, 2020

/retest

@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 Jul 1, 2020
@alexander-demicev
Copy link
Contributor Author

@enxebre done

@alexander-demicev alexander-demicev changed the title [vSphere] Improve provider spec validation Bug 1843327: [vSphere] Improve provider spec validation Jul 1, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium 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 Jul 1, 2020
@openshift-ci-robot
Copy link
Contributor

@alexander-demichev: This pull request references Bugzilla bug 1843327, 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.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1843327: [vSphere] Improve provider spec validation

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.

@alexander-demicev
Copy link
Contributor Author

/retest

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

/lgtm

@enxebre
Copy link
Member

enxebre commented Jul 2, 2020

/retest

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.

/lgtm

@openshift-bot
Copy link
Contributor

/retest

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

25 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-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 Jul 4, 2020

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

Test name Commit Details Rerun command
ci/prow/e2e-aws-scaleup-rhel7 d1de7dd link /test e2e-aws-scaleup-rhel7

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 81dfdad into openshift:master Jul 4, 2020
@openshift-ci-robot
Copy link
Contributor

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

In response to this:

Bug 1843327: [vSphere] Improve provider spec validation

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-medium Referenced Bugzilla bug's severity is medium 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.

7 participants