Skip to content

cmd: add generate and refactor structure#56

Merged
hongchaodeng merged 1 commit intooperator-framework:masterfrom
hongchaodeng:generate
Feb 24, 2018
Merged

cmd: add generate and refactor structure#56
hongchaodeng merged 1 commit intooperator-framework:masterfrom
hongchaodeng:generate

Conversation

@hongchaodeng
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread commands/operator-sdk/cmd/build.go Outdated
var buildCmd = &cobra.Command{
Use: "build <image>",
Short: "Compiles code and builds artifacts",
Short: "Compile code and build artifacts",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the original "Compiles code and builds artifacts" is fine.

for example:

Command's short description from etcdctl:
Short: "Puts the given key into the store",
Short: "Watches events stream on keys or prefixes",

I think the key here is to keep language usage and style consistent.

Comment thread commands/operator-sdk/cmd/new.go Outdated
var newCmd = &cobra.Command{
Use: "new <project-name> [required-flags]",
Short: "Creates a new operator application",
Short: "Create a new operator application",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to change here.

Comment thread commands/operator-sdk/cmd/new.go Outdated
--api-version and --kind are required flags to generate the new operator application.

For example,
For example,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For example, -> For example:

"github.com/spf13/cobra"
)

func NewGenerateCmd() *cobra.Command {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is better to keep the code consistent.

just use:
var generateCmd = &cobra.Command{..}

Comment thread commands/operator-sdk/cmd/generate.go Outdated
func NewGenerateK8SCmd() *cobra.Command {
return &cobra.Command{
Use: "k8s",
Short: "Generate Kubernetes code for custom resource",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generate -> Generates

@hongchaodeng hongchaodeng changed the title cmd: add generate cmd: add generate and refactor structure Feb 23, 2018
@fanminshi
Copy link
Copy Markdown
Contributor

lgtm

@hongchaodeng
Copy link
Copy Markdown
Contributor Author

hongchaodeng commented Feb 24, 2018

tested:

$ operator-sdk
A sdk for building operator with ease

Usage:
  operator-sdk [command]

Available Commands:
  build       Compiles code and builds artifacts
  generate    Invokes specific generator
  help        Help about any command
  new         Creates a new operator application

Flags:
  -h, --help   help for operator-sdk

Use "operator-sdk [command] --help" for more information about a command.
$ operator-sdk build -h
The operator-sdk build command compiles the code, builds the executables,
and generates Kubernetes manifests.

<image> is the container image to be built, e.g. "quay.io/example/operator:v0.0.1".
This image will be automatically set in the deployment manifests.

After build completes, the image would be built locally in docker. Then it needs to
be pushed to remote registry.
For example:
	$ operator-sdk build quay.io/example/operator:v0.0.1
	$ docker push quay.io/example/operator:v0.0.1

Usage:
  operator-sdk build <image> [flags]

Flags:
  -h, --help   help for build
$ operator-sdk generate
The operator-sdk generate command invokes specific generator to generate code as needed.

Usage:
  operator-sdk generate [command]

Available Commands:
  k8s         Generates Kubernetes code for custom resource

Flags:
  -h, --help   help for generate

Use "operator-sdk generate [command] --help" for more information about a command.
$ 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-version 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-version string   Kubernetes apiVersion 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)

@hongchaodeng hongchaodeng merged commit 78f6286 into operator-framework:master Feb 24, 2018
@hongchaodeng hongchaodeng deleted the generate branch February 24, 2018 00:02
@fanminshi fanminshi mentioned this pull request Feb 28, 2018
21 tasks
m1kola pushed a commit to m1kola/operator-sdk that referenced this pull request Jun 7, 2024
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.

2 participants