-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Alibaba: fix: replace the ic.ClusterName in the validateClusterName #5461
Alibaba: fix: replace the ic.ClusterName in the validateClusterName #5461
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.
While we are here fixing field errors, can we fix the typo in namePath
where it uses "matedata" instead of "metadata"?
@@ -117,7 +117,7 @@ func validateClusterName(client *Client, ic *types.InstallConfig) field.ErrorLis | |||
allErrs = append(allErrs, field.InternalError(namePath, err)) | |||
} | |||
if response.TotalItems > 0 { | |||
allErrs = append(allErrs, field.Invalid(namePath, ic.ClusterName, fmt.Sprintf("cluster name is unavailable, private zone name %s already exists", zoneName))) | |||
allErrs = append(allErrs, field.Invalid(namePath, ic.ObjectMeta.Name, fmt.Sprintf("cluster name is unavailable, private zone name %s already exists", zoneName))) |
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.
allErrs = append(allErrs, field.Invalid(namePath, ic.ObjectMeta.Name, fmt.Sprintf("cluster name is unavailable, private zone name %s already exists", zoneName))) | |
allErrs = append(allErrs, field.Invalid(namePath, ic.Name, fmt.Sprintf("cluster name is unavailable, private zone name %s already exists", zoneName))) |
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.
While we are here fixing field errors, can we fix the typo in namePath where it uses "matedata" instead of "metadata"?
Thanks for reminding!
Sorry, I did not understand this suggestion, the type types.InstallConfig
does not exist Name
, or modify validateClusterName(client *Client, ic *types.InstallConfig)
to validateClusterName(client *Client, ic *ObjectMeta)
?
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.
My suggestion is just to get the name via ic.Name
rather than ic.ObjectMeta.Name
. The ObjectMeta
part is unnecessary as ObjectMeta
is an anonymous field. See http://golangtutorials.blogspot.com/2011/06/anonymous-fields-in-structs-like-object.html.
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.
I remember, because ic.ObjectMeta.Name
and ic.Platform.Name
exist at the same time, so ic.Name
will cause "ambiguous selector" error.
1. The `ic.ClusterName` is empty in the `validateClusterName`, and the `ic.ObjectMeta.Name` is correct, not `ic.ClusterName`. 2. Fix the spelling errors, use "metadata" instead of "matedata" Signed-off-by: sunhui <wb-sh373163@alibaba-inc.com>
d8cab2d
to
d3f0cf8
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: staebler 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 |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
3 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
@bd233: The following tests failed, say
Full PR test history. Your PR dashboard. 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-required Please review the full test history for this PR and help us cut down flakes. |
14 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
6 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
The
ic.ClusterName
is empty in thevalidateClusterName
, and theic.ObjectMeta.Name
is correct, notic.ClusterName
.