Skip to content

Commit a20a696

Browse files
Merge pull request #254 from dinhxuanvu/dep-yaml
feat(registry): Add operator version dependency metadata
2 parents a6b3b40 + 1510c73 commit a20a696

File tree

19 files changed

+1487
-278
lines changed

19 files changed

+1487
-278
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dependencies:
2+
- type: olm.gvk
3+
group: testapi.coreos.com
4+
kind: testapi
5+
version: v1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dependencies:
2+
- type: olm.package
3+
packageName: testoperator
4+
version: "> 0.2.0"

docs/design/operator-bundle.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ An `Operator Bundle` is built as a scratch (non-runnable) container image that c
1717

1818
### Bundle Manifest Format
1919

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.
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. Also, `dependencies.yaml` which contains the operator dependency information can be included in `metadata` directory.
2121

2222
Below is the directory layout of an operator bundle inside a bundle image:
2323
```bash
@@ -27,7 +27,8 @@ $ tree
2727
│ ├── etcdcluster.crd.yaml
2828
│ └── etcdoperator.clusterserviceversion.yaml
2929
└── metadata
30-
└── annotations.yaml
30+
├── annotations.yaml
31+
└── dependencies.yaml
3132
```
3233

3334
*Notes:*
@@ -64,6 +65,25 @@ annotations:
6465
* 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.
6566
* The annotations for bundle manifests and metadata are reserved for future use. They are set to be `manifests/` and `metadata/` for the time being.
6667

68+
### Bundle Dependencies
69+
70+
The dependencies of an operator are listed as a list in `dependencies.yaml` file inside `/metadata` folder of a bundle. This file is optional and only used to specify explicit operator version dependencies at first. Eventually, operator authors can migrate the API-based dependencies into `dependencies.yaml` as well in the future. The ultimate goal is to have `dependencies.yaml` as a centralized metadata for operator dependencies and moving the dependency information away from CSV.
71+
72+
The dependency list will contain a `type` field for each item to specify what kind of dependency this is. There are two supported `type` of operator dependencies. It can be a package type (`olm.package`) meaning this is a dependency for a specific operator version. For `olm.package` type, the dependency information should include the `package` name and the `version` of the package in semver format. We use `blang/semver` library for semver parsing (https://github.com/blang/semver). For example, you can specify an exact version such as `0.5.2` or a range of version such as `>0.5.1` (https://github.com/blang/semver#ranges). In addition, the author can specify dependency that is similiar to existing CRD/API-based using `olm.gvk` type and then specify GVK information as how it is done in CSV. This is a path to enable operator authors to consolidate all dependencies (API or explicit version) to be in the same place.
73+
74+
An example of a `dependencies.yaml` that specifies Prometheus operator and etcd CRD dependencies:
75+
76+
```
77+
dependencies:
78+
- type: olm.package
79+
packgeName: prometheus
80+
version: >0.27.0
81+
- type: olm.gvk
82+
group: etcd.database.coreos.com
83+
kind: EtcdCluster
84+
version: v1beta2
85+
```
86+
6787
### Bundle Dockerfile
6888

6989
This is an example of a `Dockerfile` for operator bundle:

pkg/api/grpc_health_v1/health.pb.go

Lines changed: 100 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)