Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Remove redundant TODOs #207

Merged
merged 1 commit into from
Sep 5, 2019

Conversation

SataQiu
Copy link
Contributor

@SataQiu SataQiu commented Sep 4, 2019

What this PR does / why we need it:
Add APIServerEndpoint validation for JoinConfiguration

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 4, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 4, 2019
@SataQiu SataQiu changed the title add APIServerEndpoint validation for JoinConfiguration Add APIServerEndpoint validation for JoinConfiguration Sep 4, 2019
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

minor feedback.

I'm not sure what the use case for this is @fabriziopandini can you expand on your TODO a little bit more here? Maybe open an issue if it's significant enough?

apiServerEndpoint := config.Spec.JoinConfiguration.Discovery.BootstrapToken.APIServerEndpoint
needValidateAPIEndpoints := true
Copy link
Contributor

Choose a reason for hiding this comment

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

We could do away with this boolean and always validate, right? I think the optimization of running this validation code is not worth introducing the boolean and we should validate every time regardless.

}
// validate user provided APIServerEndpoint matches the api endpoint defined at cluster level
if needValidateAPIEndpoints {
found := false
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put this whole thing in a function,

func validateAPIEndpoints(endpoint string, endpoints []string) error {
...
}

Copy link
Contributor

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

@SataQiu @chuckha
Considering that in all other cases like e.g. cluster name or network settings we are using values from the KubeConfig object without comparing them to the top-level object values, I'm in favor of simply removing the TODO without implementing/calling the validateAPIEndpoints func.

@SataQiu
Copy link
Contributor Author

SataQiu commented Sep 5, 2019

Thank you for your explanation @fabriziopandini
I understand your point. Let's ignore it for the moment.

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 5, 2019
@SataQiu SataQiu changed the title Add APIServerEndpoint validation for JoinConfiguration Remove redundant TODOs Sep 5, 2019
@chuckha
Copy link
Contributor

chuckha commented Sep 5, 2019

That's fine with me. Approving and lgtm as this is only comment changes.

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 5, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chuckha, SataQiu

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 5, 2019
@k8s-ci-robot k8s-ci-robot merged commit 5bf8343 into kubernetes-retired:master Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants