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

🌱 Cleanup unused variable in bootstrap/kubeadm/api/v1alpha4/kubeadmconfig_webhook.go #4606

Merged
merged 1 commit into from
May 19, 2021

Conversation

chymy
Copy link
Contributor

@chymy chymy commented May 13, 2021

What this PR does / why we need it:
The variable MissingFileSourceMsg is not used in bootstrap/kubeadm/api/v1alpha4/kubeadmconfig_webhook.go.
If file.Content and file.ContentFrom are allowed to be nil at the same time, the MissingFileSourceMsg variable is redundant. Otherwise, we should verify that file.Content cannot be nil when file.ContentFrom is nil

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 May 13, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @chymy. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 13, 2021
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 13, 2021
@chymy chymy changed the title Cleanup unused variable in bootstrap/kubeadm/api/v1alpha4/kubeadmconfig_webhook.go 🌱 Cleanup unused variable in bootstrap/kubeadm/api/v1alpha4/kubeadmconfig_webhook.go May 13, 2021
@sbueringer
Copy link
Member

Seems to depend on if we want to support creating empty files. I'm not sure about that.

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 13, 2021
@chymy
Copy link
Contributor Author

chymy commented May 13, 2021

Seems to depend on if we want to support creating empty files. I'm not sure about that.

After testing, it supports creating empty files. Maybe some users just want to create empty files.

@chymy
Copy link
Contributor Author

chymy commented May 13, 2021

/retest

@sbueringer
Copy link
Member

sbueringer commented May 13, 2021

Seems to depend on if we want to support creating empty files. I'm not sure about that.

After testing, it supports creating empty files. Maybe some users just want to create empty files.

Yup, right now it works, because we don't block it. It's fine for me to keep that behavior as is.

I'm just not sure what our intention was when we added the error constant initially, because it seems to indicate that we had different plans then. But I think someone else can provide more context.

@chymy
Copy link
Contributor Author

chymy commented May 14, 2021

/test pull-cluster-api-apidiff-main

@k8s-ci-robot
Copy link
Contributor

@chymy: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-cluster-api-apidiff-main c849885 link /test pull-cluster-api-apidiff-main

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.

@chymy
Copy link
Contributor Author

chymy commented May 14, 2021

@alexeldeib What about you?

@CecileRobertMichon
Copy link
Contributor

From what I can remember, I think MissingFileSourceMsg is meant to be used if ContentFrom is not nil, indicating the user wants to fill the file from a source, but no source was specified. This would become relevant if we ever add more file source options besides Secret as noted in https://github.com/kubernetes-sigs/cluster-api/pull/4606/files#diff-466d019b7ec6acc1f196f24df198cb9d8d0e20602ffb0e2b7cba026cf65fdac6L79.

Right now the var is unused because only secrets are supported so we can directly check that the secret name & key are set. I think it's okay to remove the unused var for now. If we ever add another FileSource type, we can re-add an error specific no file source being specified.

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2021
Copy link
Member

@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.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 May 19, 2021
@k8s-ci-robot k8s-ci-robot merged commit e7fb8ee into kubernetes-sigs:master May 19, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone May 19, 2021
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants