commands/operator-sdk: change defintion of operator-sdk new#23
commands/operator-sdk: change defintion of operator-sdk new#23fanminshi merged 1 commit intooperator-framework:masterfrom fanminshi:command_new_change
Conversation
| // newCmd represents the new command | ||
| var newCmd = &cobra.Command{ | ||
| Use: "new [options] <project-name>", | ||
| Use: "new <project-name> <api-group> <kind>", |
There was a problem hiding this comment.
Based on initial feedback, most members of the group like to have flags to indicate the meeting of the last two params. Let's make apigroup and kind flags.
|
based on private discussion, we are going to have |
| $ operator-sdk new play | ||
| generates a skeletal play application in $GOPATH/src/github.com/example.com/play. | ||
| $ mkdir $GOPATH/src/github.com/example.com/app-operator | ||
| $ cd $GOPATH/src/github.com/example.com/app-operator |
There was a problem hiding this comment.
See the workflow: https://github.com/coreos/operator-sdk#creating-a-new-project
It is:
cd $GOPATH/src/github.com/example.com/
operator-sdk new app-operator
cd app-operator
There was a problem hiding this comment.
good catch on this one!
|
all fixed. PTAL |
|
manual test: |
|
|
LGTM after nit |
|
the best i can do is |
new now requires flags --api-group and --api-kind
|
Sounds good |
|
final output: $ ./operator-sdk new -h
The operator-sdk new command creates a new operator application and
generates a default directory layout based on the input <project-name>.
<project-name> is the project name of the new operator. (e.g app-operator)
--api-group and --kind are required flags to generate the new operator application.
For example,
$ mkdir $GOPATH/src/github.com/example.com/
$ cd $GOPATH/src/github.com/example.com/
$ operator-sdk new app-operator --api-group=app.example.com --kind=AppService
generates a skeletal app-operator application in $GOPATH/src/github.com/example.com/app-operator.
Usage:
operator-sdk new <project-name> [required-flags] [flags]
Flags:
--api-group string Kubernetes API Group and has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)
-h, --help help for new
--kind string Kubernetes CustomResourceDefintion kind. (e.g AppService) |
Run user_setup script in builds
new now requires flags --api-group and --api-kind because providing defaults to those value are not useful; hence un-useful defaults shouldn't be defaults.