Skip to content

Commit 9762fd5

Browse files
committedOct 23, 2019
Fix bundle library doc to reflect new changes/features
Signed-off-by: Vu Dinh <[email protected]>
1 parent ff44b59 commit 9762fd5

File tree

1 file changed

+50
-11
lines changed

1 file changed

+50
-11
lines changed
 

‎docs/design/operator-bundle.md

+50-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Operator Bundle
1+
overwrite# Operator Bundle
22

33
An `Operator Bundle` is a container image that stores Kubernetes manifests and metadata associated with an operator. A bundle is meant to present a *specific* version of an operator.
44

@@ -87,7 +87,7 @@ In order to use Operator SDK CLI, follow the operator-SDK installation instructi
8787

8888
1. Install the [Operator SDK CLI](https://github.com/operator-framework/operator-sdk/blob/master/doc/user/install-operator-sdk.md)
8989

90-
Now, a binary named `operator-cli` is available in OLM's directory to use.
90+
Now, a binary named `operator-sdk` is available in OLM's directory to use.
9191
```bash
9292
$ ./operator-sdk
9393
An SDK for building operators with ease
@@ -106,11 +106,29 @@ Use "operator-sdk [command] --help" for more information about a command.
106106
```
107107

108108
### Generate Bundle Annotations and DockerFile
109+
*Notes:*
110+
* If there are `annotations.yaml` and `Dockerfile` existing in the directory, they will be overwritten.
109111

110-
Using `operator-sdk` CLI, bundle annotations can be generated from provided operator manifests. The command for `generate` task is:
112+
Using `operator-sdk` CLI, bundle annotations can be generated from provided operator manifests. The overall `bundle generate` command usage is:
111113
```bash
112-
$ ./operator-sdk bundle generate --directory /test/
114+
Usage:
115+
operator-sdk bundle generate [flags]
116+
117+
Flags:
118+
-c, --channels string The list of channels that bundle image belongs to
119+
-e, --default string The default channel for the bundle image
120+
-d, --directory string The directory where bundle manifests are located.
121+
-h, --help help for generate
122+
-p, --package string The name of the package that bundle image belongs to
113123
```
124+
125+
The `--directory/-d`, `--channels/-c`, `--package/-p` are required flags while `--default/-e` is optional.
126+
127+
The command for `generate` task is:
128+
```bash
129+
$ ./operator-sdk bundle generate --directory /test --package test-operator --channels stable,beta --default stable
130+
```
131+
114132
The `--directory` or `-d` specifies the directory where the operator manifests are located. The `Dockerfile` is generated in the same directory where the YAML manifests are located while the `annotations.yaml` file is located in a folder named `metadata`. For example:
115133
```bash
116134
$ tree test
@@ -124,22 +142,43 @@ test
124142
└── Dockerfile
125143
```
126144

127-
*Notes:*
128-
* If there are `annotations.yaml` and `Dockerfile` existing in the directory, they will be overwritten.
145+
The `--package` or `-p` is the name of package fo the operator such as `etcd` which which map `channels` to a particular application definition. `channels` allow package authors to write different upgrade paths for different users (e.g. `beta` vs. `stable`). The `channels` list is provided via `--channels` or `-c` flag. Multiple `channels` are separated by a comma (`,`). The default channel is provided optionally via `--default` or `-e` flag. If the default channel is not provided, the first channel in channel list is selected as default.
146+
147+
All information in `annotations.yaml` is also existed in `LABEL` section of `Dockerfile`.
129148

130149
### Build Bundle Image
131150

132-
Operator bundle image can be built from provided operator manifests using `build` command:
151+
Operator bundle image can be built from provided operator manifests using `build` command (see *Notes* below). The overall `bundle build` command usage is:
133152
```bash
134-
$ ./operator-sdk bundle build --directory /test/0.1.0/ --tag quay.io/coreos/test-operator.v0.1.0:latest
153+
Usage:
154+
operator-SDK bundle build [flags]
155+
156+
Flags:
157+
-c, --channels string The list of channels that bundle image belongs to
158+
-e, --default string The default channel for the bundle image
159+
-d, --directory string The directory where bundle manifests are located
160+
-h, --help help for build
161+
-b, --image-builder string Tool to build container images. One of: [docker, podman, buildah] (default "docker")
162+
-0, --overwrite To overwrite annotations.yaml if existing
163+
-p, --package string The name of the package that bundle image belongs to
164+
-t, --tag string The name of the bundle image will be built
135165
```
166+
167+
The command for `build` task is:
168+
```bash
169+
$ ./operator-sdk bundle build --directory /test --tag quay.io/coreos/test-operator.v0.1.0:latest --package test-operator --channels stable,beta --default stable
170+
```
171+
136172
The `--directory` or `-d` specifies the directory where the operator manifests are located. The `--tag` or `-t` specifies the image tag that you want the operator bundle image to have. By using `build` command, the `annotations.yaml` and `Dockerfile` are automatically generated in the background.
137173
138174
The default image builder is `Docker`. However, ` Buildah` and `Podman` are also supported. An image builder can specified via `--image-builder` or `-b` optional tag in `build` command. For example:
139175
```bash
140-
$ ./operator-sdk bundle build --directory /test/0.1.0/ --tag quay.io/coreos/test-operator.v0.1.0:latest --image-builder podman
176+
$ ./operator-sdk bundle build --directory /test/0.1.0/ --tag quay.io/coreos/test-operator.v0.1.0:latest --image-builder podman --package test-operator --channels stable,beta --default stable
141177
```
142178
179+
The `--package` or `-p` is the name of package fo the operator such as `etcd` which which map `channels` to a particular application definition. `channels` allow package authors to write different upgrade paths for different users (e.g. `beta` vs. `stable`). The `channels` list is provided via `--channels` or `-c` flag. Multiple `channels` are separated by a comma (`,`). The default channel is provided optionally via `--default` or `-e` flag. If the default channel is not provided, the first channel in channel list is selected as default.
180+
143181
*Notes:*
144-
* If there are `annotations.yaml` and `Dockerfile` existing in the directory, they will be overwritten.
145-
* The directory where the operator manifests are located must must be inside the context of the build which in this case is inside the directory where you run the command.
182+
* If there is `Dockerfile` existing in the directory, it will be overwritten.
183+
* If there is an existing `annotations.yaml` in `/metadata` directory, the cli will attempt to validate it and returns any found errors. If the ``annotations.yaml`` is valid, it will be used as a part of build process. The optional boolean `--overwrite/-o` flag can be enabled (false by default) to allow cli to overwrite the `annotations.yaml` if existed.
184+
* The directory where the operator manifests are located must be inside the context of the build which in this case is inside the directory where you run the command.

0 commit comments

Comments
 (0)
Please sign in to comment.