-
Notifications
You must be signed in to change notification settings - Fork 207
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
Bug 1843327: [vSphere] Improve provider spec validation #605
Conversation
There was a problem hiding this 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
pkg/controller/vsphere/reconciler.go
Outdated
@@ -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" |
There was a problem hiding this comment.
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?
notFoundMsg := "template not found, specify valid value" | |
const notFoundMsg = "template not found, specify valid value" |
pkg/controller/vsphere/reconciler.go
Outdated
@@ -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" |
There was a problem hiding this comment.
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
There was a problem hiding this 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
16e6ee8
to
a865ef3
Compare
@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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this using const and := unconsistently??
https://github.com/openshift/machine-api-operator/pull/605/files#diff-11b6610f82e5d47fdfb8dda44b90dd1eR469
https://github.com/openshift/machine-api-operator/pull/605/files#diff-11b6610f82e5d47fdfb8dda44b90dd1eR470
https://github.com/openshift/machine-api-operator/pull/605/files#diff-11b6610f82e5d47fdfb8dda44b90dd1eR594
https://github.com/openshift/machine-api-operator/pull/605/files#diff-11b6610f82e5d47fdfb8dda44b90dd1eR595
a865ef3
to
8e027a1
Compare
/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") |
There was a problem hiding this comment.
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
"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? |
/retest |
[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 |
@enxebre done |
@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
In response to this:
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. |
/retest |
8e027a1
to
43e60b6
Compare
… user data secret
43e60b6
to
d1de7dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest Please review the full test history for this PR and help us cut down flakes. |
25 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@alexander-demichev: The following test failed, say
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. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@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:
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. |
Return invalid machine configuration error on missing VM template and missing user data secret