Skip to content

Conversation

@abhinavdahiya
Copy link
Contributor

This allows us to use the already vendored cobra cli package, and drop gopkg.in/alecthomas/kingpin.v2.
This also splits cli into 3 different command groups: targets, destroy and version.
cobra allows us to add new subcommands and local flags without putting everything into single switch in main.go

/cc @wking

@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 8, 2018
Copy link
Member

@wking wking left a comment

Choose a reason for hiding this comment

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

Looks good. I left a few suggestion inline which you can take or leave as you like.

Copy link
Member

Choose a reason for hiding this comment

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

Can we move these to main()? It feels strange to have an init() in a command package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather have these in main.go like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think kubectl example is more useful if we have more complex commands. but i can add new<cmd> type funcs.

Copy link
Member

Choose a reason for hiding this comment

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

No I just meant "not in an init()" ;).

Copy link
Member

Choose a reason for hiding this comment

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

This shoiuld probably move to version.go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure.

This allows us to use the already vendored cobra cli package, and drop gopkg.in/alecthomas/kingpin.v2.
This also splits cli into 3 different command groups: targets, destroy and version.
cobra allows us to add new subcommands and local flags without putting everything into single switch in main.go
@abhinavdahiya
Copy link
Contributor Author

@wking updated to remove init() funcs... does this look better?

@wking
Copy link
Member

wking commented Oct 8, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 8, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, wking

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [abhinavdahiya,wking]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit c033120 into openshift:master Oct 8, 2018
wking added a commit to wking/openshift-installer that referenced this pull request Nov 2, 2018
Once the cluster is up, the bootstrap stuff is just a waste of
resources.  With this commit we make a reasonable effort to wait for
the bootstrap-complete event, and, if we see it, we tear down the
bootstrap resources.

The Kubernetes client initialization is based on [1] and the local
wait.go is based on [2].  Both of those are, like this project, under
the Apache 2.0 license.  Once kubernetes/kubernetes#50102 lands, we
can drop the local wait.go and use the upstream implementation.

I've dropped the errors.Cause call from main.go, because it was
dropping the wrapped context, which is useful context for debugging.
That Cause call is from dc118f2 (cmd: switch to already vendored
cobra, 2018-10-08, openshift#429), but that commit doesn't explicitly motivate
the call.

[1]: https://github.com/kubernetes/client-go/blob/v9.0.0/examples/out-of-cluster-client-configuration/main.go
[2]: https://github.com/kubernetes/kubernetes/pull/50102/files
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. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants