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

Move cluster-related flags to live subcommand #1891

Merged
merged 2 commits into from May 6, 2021

Conversation

mortent
Copy link
Contributor

@mortent mortent commented May 4, 2021

This moves the construction of the util.Factory into the live subcommand. This means that all flags related to a k8s cluster will now be exposed on the live command instead of the top level kpt command.

The current solution for letting users provide custom openapi schemas used the factory to allow users to fetch the k8s schema from the cluster. This PR removes this functionality completely. Depending on how we want to support this going forward, we might want to keep the functionality for reading openapi schemas from disk.

Fixes: #1886

@@ -113,3 +116,21 @@ func GetLiveCommand(name string, f util.Factory) *cobra.Command {

return liveCmd
}

func newFactory(cmd *cobra.Command, version string) util.Factory {
Copy link
Contributor

Choose a reason for hiding this comment

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

util.Factory name is problematic on many levels:
a) What is this Java in 90s? :)
b) util itself is a meaningless term. Utility for WHAT? "util for X" should just be called "X" (or something with X in it), otherwise everything is a util.

Feel free to address this in a separate PR and/or create a package alias to stop the bleeding in the call sites for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

util.Factory comes from the kubernetes codebase, so the name is not something we can change (other than creating an import alias).

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's create an alias

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed util to cluster

@mortent mortent requested a review from frankfarzan May 4, 2021 17:27
@mortent mortent merged commit d36d049 into kptdev:next May 6, 2021
frankfarzan pushed a commit to frankfarzan/kpt that referenced this pull request Jun 3, 2021
* Move cluster-related flags to live subcommand

* Addressed comments
@mortent mortent deleted the MoveFactoryToLive branch June 11, 2021 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants