-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
doc/user-guide.md: add docs for cli cmd build #267
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
# CLI Guide | ||
|
||
```bash | ||
Usage: | ||
operator-sdk [command] | ||
``` | ||
|
||
## build | ||
|
||
### Args | ||
|
||
* 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. | ||
|
||
### Flags | ||
|
||
* `-h, --help` - help for build | ||
|
||
### Use | ||
|
||
The operator-sdk build command compiles the code, builds the executables, | ||
and generates Kubernetes manifests. After build completes, the image would be built locally in docker. Then it needs to be pushed to remote registry. | ||
|
||
### Example: | ||
|
||
#### Build | ||
|
||
```bash | ||
operator-sdk build quay.io/example/operator:v0.0.1 | ||
|
||
# Output: | ||
building example-operator... | ||
|
||
building container quay.io/example/operator:v0.0.1... | ||
Sending build context to Docker daemon 163.9MB | ||
Step 1/4 : FROM alpine:3.6 | ||
---> 77144d8c6bdc | ||
Step 2/4 : ADD tmp/_output/bin/example-operator /usr/local/bin/example-operator | ||
---> 2ada0d6ca93c | ||
Step 3/4 : RUN adduser -D example-operator | ||
---> Running in 34b4bb507c14 | ||
Removing intermediate container 34b4bb507c14 | ||
---> c671ec1cff03 | ||
Step 4/4 : USER example-operator | ||
---> Running in bd336926317c | ||
Removing intermediate container bd336926317c | ||
---> d6b58a0fcb8c | ||
Successfully built d6b58a0fcb8c | ||
Successfully tagged quay.io/example/operator:v0.0.1 | ||
``` | ||
|
||
## completion | ||
|
||
### Available Commands | ||
|
||
#### bash - Generate bash completions | ||
|
||
##### Flags | ||
|
||
* `-h, --help` - help for bash | ||
|
||
#### zsh - Generate zsh completions | ||
|
||
##### Flags | ||
|
||
* `-h, --help` - help for zsh | ||
|
||
### Flags | ||
|
||
* `-h, --help` - help for completion | ||
|
||
### Use | ||
|
||
Generators for shell completions | ||
|
||
Example: | ||
|
||
```bash | ||
operator-sdk completion bash | ||
|
||
# Output: | ||
# bash completion for operator-sdk -*- shell-script -*- | ||
... | ||
# ex: ts=4 sw=4 et filetype=sh | ||
``` | ||
|
||
## generate | ||
|
||
### Available Commands | ||
|
||
#### k8s - Generates Kubernetes code for custom resource | ||
|
||
##### Use | ||
|
||
k8s generator generates code for custom resource given the API spec | ||
to comply with kube-API requirements. | ||
|
||
##### Flags | ||
|
||
* `-h, --help` - help for k8s | ||
|
||
##### Example | ||
|
||
```bash | ||
operator-sdk generate k8s | ||
|
||
# Output: | ||
Run code-generation for custom resources | ||
Generating deepcopy funcs | ||
``` | ||
|
||
#### olm-catalog - Generates OLM Catalog manifests | ||
|
||
##### Flags | ||
|
||
* `--image` **(required)** string - The container image name to set in the CSV to deploy the operator e.g: quay.io/example/operator:v0.0.1 | ||
* `--version` **(required)** string - The version of the current CSV e.g: 0.0.1 | ||
* `-h, --help` - help for olm-catalog | ||
|
||
##### Example | ||
|
||
```bash | ||
operator-sdk generate olm-catalog --image=quay.io/example/operator:v0.0.1 --version=0.0.1 | ||
|
||
# Output: | ||
Generating OLM catalog manifests | ||
``` | ||
|
||
### Flags | ||
|
||
* `-h, --help` - help for generate | ||
|
||
## new | ||
|
||
The operator-sdk new command creates a new operator application and | ||
generates a default directory layout based on the input `project-name`. | ||
|
||
### Args | ||
|
||
* `project-name` - the project name of the new | ||
|
||
### Flags | ||
|
||
* `--api-version` **(required)** string - Kubernetes apiVersion and has a format of `$GROUP_NAME/$VERSION` (e.g app.example.com/v1alpha1) | ||
* `--kind` **(required)** string - Kubernetes CustomResourceDefintion kind. (e.g AppService) | ||
* `-h, --help` - help for new | ||
|
||
### Example | ||
|
||
```bash | ||
mkdir $GOPATH/src/github.com/example.com/ | ||
cd $GOPATH/src/github.com/example.com/ | ||
operator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=AppService | ||
|
||
# Output: | ||
Create app-operator/.gitignore | ||
... | ||
``` | ||
|
||
## up | ||
|
||
### Available Commands | ||
|
||
#### local - Launches the operator locally | ||
|
||
##### Use | ||
|
||
The operator-sdk up local command launches the operator on the local machine | ||
by building the operator binary with the ability to access a | ||
kubernetes cluster using a kubeconfig file. | ||
|
||
##### Flags | ||
|
||
* `--kubeconfig` string - The file path to kubernetes configuration file; defaults to $HOME/.kube/config | ||
|
||
* `--namespace` string - The namespace where the operator watches for changes. (default "default") | ||
|
||
* `--operator-flags` - Flags that the local operator may need. | ||
|
||
* `-h, --help` - help for local | ||
|
||
##### Example | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll let @shawn-hurley to provide additional descriptions on how to use those flags as he worked on this in a future PR. |
||
|
||
```bash | ||
operator-sdk up local --kubeconfig "mycluster.kubecfg" \ | ||
--namespace "default" \ | ||
--operator-flags "--flag1 value1 --flag2=value2" | ||
``` | ||
|
||
### Flags | ||
|
||
* `-h, --help` - help for up |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add an
Example
section fork8s
command to be consistentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it...also tried to keep the consistency in the generate olm-catalog doc as well.
Thanks for the suggestion!