-
Notifications
You must be signed in to change notification settings - Fork 715
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
boolean parameter clean up #1209
Comments
@chuckha |
What you are suggesting sounds like a bigger refactor, perhaps worthy of its own ticket. This ticket is to address the difficulties around using boolean parameters in functions. Perhaps you meant to comment on kubernetes/kubernetes#69662 ? That is fetching InitConfiguration during a Join. |
@chuckha +1 on doing small improvements. Sorry I skipped some detail in my comment, but if I remember well the boolean flag we are discussing on was implemented when kubeadm started to fetch init configuration in the context of the kubeadm join --control-plane workflow (and this should be probably fixed by fetching ClusterConfiguration only). |
I would suggest to rename this specific boolean to Anyway, I am doing a set of changes that restructure, cleanup the interface and increase code sharing in the config APIs (as part of #1084 effort), however it would take some time prior to having a PR for this specifically. In these changes the bool is gone completely, replaced by a couple of separate functions. |
Let's close this in favor of @rosti's work. I think the point was missed as the variable name change was not very interesting of a ticket. |
Is this a BUG REPORT or FEATURE REQUEST?
/kind cleanup
Weaving this boolean parameter through is misleading:
https://github.com/kubernetes/kubernetes/blob/69f5f5eff2803317c794bb545705185fed74c201/cmd/kubeadm/app/util/config/cluster.go#L44
The fact that
newControlPlane
dictates behavior of this code is a problem because this is an assumption the implementation is making for the caller.Consider the situation where I want to fetch the init configuration but not execute the code bound up in the control flow dictated by the
newControlPlane
boolean. I cannot do this without forcing a true/false. In some cases, the wrong value will end up returning an error because of assumptions made by the code being executed (files existing).I recommend extracting that logic and moving it out to after this function is called rather than being nested inside this specific function.
This refactor would both clean up several function signatures as well as make the upgrade code more explicit by having it set the necessary values.
If nothing else, renaming that boolean to "upgrading" would be an improvement.
The text was updated successfully, but these errors were encountered: