Skip to content

Commit efd7a82

Browse files
Merge pull request #172 from dinhxuanvu/bundle-docs-update
Update operator-bundle to clarify the bundle format directories
2 parents 0090e4a + b20cc7d commit efd7a82

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

docs/design/operator-bundle.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,30 @@ The operator manifests refers to a set of Kubernetes manifest(s) the defines the
1515

1616
An `Operator Bundle` is built as a scratch (non-runnable) container image that contains operator manifests and specific metadata in designated directories inside the image. Then, it can be pushed and pulled from an OCI-compliant container registry. Ultimately, an operator bundle will be used by [Operator Registry](https://github.com/operator-framework/operator-registry) and [Operator-Lifecycle-Manager (OLM)](https://github.com/operator-framework/operator-lifecycle-manager) to install an operator in OLM-enabled clusters.
1717

18+
### Bundle Manifest Format
19+
20+
The standard bundle format requires two directories named `manifests` and `metatdata`. The `manifests` directory is where all operator manifests are resided including ClusterServiceVersion (CSV), CustomResourceDefinition (CRD) and other supported Kubernetes types. The `metadata` directory is where operator metadata is located including `annotations.yaml` which contains additional information such as package name, channels and media type.
21+
22+
Below is the directory layout of an operator bundle inside a bundle image:
23+
```bash
24+
$ tree
25+
/
26+
├── manifests
27+
│ ├── etcdcluster.crd.yaml
28+
│ └── etcdoperator.clusterserviceversion.yaml
29+
└── metadata
30+
└── annotations.yaml
31+
```
32+
33+
*Notes:*
34+
* The names of manifests and metadata directories must match the bundle annotations that are provided in `annotations.yaml` file. Currently, those names are set to `manifests` and `metadata`.
35+
1836
### Bundle Annotations
1937

2038
We use the following labels to annotate the operator bundle image.
2139
* The label `operators.operatorframework.io.bundle.mediatype.v1` reflects the media type or format of the operator bundle. It could be helm charts, plain Kubernetes manifests etc.
22-
* The label `operators.operatorframework.io.bundle.manifests.v1 `reflects the path in the image to the directory that contains the operator manifests.
23-
* The label `operators.operatorframework.io.bundle.metadata.v1` reflects the path in the image to the directory that contains metadata files about the bundle.
40+
* The label `operators.operatorframework.io.bundle.manifests.v1 `reflects the path in the image to the directory that contains the operator manifests. This label is reserved for the future use and is set to `manifests/` for the time being.
41+
* The label `operators.operatorframework.io.bundle.metadata.v1` reflects the path in the image to the directory that contains metadata files about the bundle. This label is reserved for the future use and is set to `metadata/` for the time being.
2442
* The `manifests.v1` and `metadata.v1` labels imply the bundle type:
2543
* The value `manifests.v1` implies that this bundle contains operator manifests.
2644
* The value `metadata.v1` implies that this bundle has operator metadata.
@@ -44,18 +62,7 @@ annotations:
4462
*Notes:*
4563
* In case of a mismatch, the `annotations.yaml` file is authoritative because the on-cluster operator-registry that relies on these annotations has access to the yaml file only.
4664
* The potential use case for the `LABELS` is - an external off-cluster tool can inspect the image to check the type of a given bundle image without downloading the content.
47-
48-
This example uses [Operator Registry Manifests](https://github.com/operator-framework/operator-registry#manifest-format) format to build an operator bundle image. The source directory of an operator registry bundle has the following layout.
49-
```
50-
$ tree test
51-
test
52-
├── testbackup.crd.yaml
53-
├── testcluster.crd.yaml
54-
├── testoperator.v0.1.0.clusterserviceversion.yaml
55-
├── testrestore.crd.yaml
56-
└── metadata
57-
└── annotations.yaml
58-
```
65+
* The annotations for bundle manifests and metadata are reserved for future use. They are set to be `manifests/` and `metadata/` for the time being.
5966

6067
### Bundle Dockerfile
6168

@@ -76,19 +83,6 @@ ADD test/*.yaml /manifests
7683
ADD test/metadata/annotations.yaml /metadata/annotations.yaml
7784
```
7885

79-
Below is the directory layout of the operator bundle inside the image:
80-
```bash
81-
$ tree
82-
/
83-
├── manifests
84-
│ ├── testbackup.crd.yaml
85-
│ ├── testcluster.crd.yaml
86-
│ ├── testoperator.v0.1.0.clusterserviceversion.yaml
87-
│ └── testrestore.crd.yaml
88-
└── metadata
89-
└── annotations.yaml
90-
```
91-
9286
## Operator Bundle Commands
9387

9488
`opm` (Operator Package Manager) is a CLI tool to generate bundle annotations, build bundle manifests image, validate bundle manifests image and other functionalities. Please note that the `generate`, `build` and `validate` features of `opm` CLI are currently in alpha and only meant for development use.
@@ -139,23 +133,29 @@ $ ./opm alpha bundle generate --directory /test --package test-operator \
139133
--channels stable,beta --default stable
140134
```
141135

142-
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:
136+
The `--directory` or `-d` specifies the directory where the operator manifests, including CSVs and CRDs, are located. For example:
143137
```bash
144138
$ tree test
145139
test
146-
├── testbackup.crd.yaml
147-
├── testcluster.crd.yaml
148-
├── testoperator.v0.1.0.clusterserviceversion.yaml
149-
├── testrestore.crd.yaml
150-
├── metadata
151-
│   └── annotations.yaml
152-
└── Dockerfile
140+
├── etcdcluster.crd.yaml
141+
└── etcdoperator.clusterserviceversion.yaml
153142
```
154143

155144
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.
156145

157146
All information in `annotations.yaml` is also existed in `LABEL` section of `Dockerfile`.
158147

148+
After the generate command is executed, 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:
149+
```bash
150+
$ tree test
151+
test
152+
├── etcdcluster.crd.yaml
153+
├── etcdoperator.clusterserviceversion.yaml
154+
├── metadata
155+
│   └── annotations.yaml
156+
└── Dockerfile
157+
```
158+
159159
The `Dockerfile` can be used manually to build the bundle image using container image tools such as Docker, Podman or Buildah. For example, the Docker build command would be:
160160

161161
```bash

0 commit comments

Comments
 (0)