Skip to content

Commit b443c0c

Browse files
committedApr 8, 2020
Add bundle dependencies specification documentation
Signed-off-by: Vu Dinh <[email protected]>
1 parent 818ce2b commit b443c0c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
 

‎docs/design/operator-bundle.md

+23-2
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,26 @@ 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+
name: prometheus
80+
version: >0.27.0
81+
- type: olm.gvk
82+
name: etcdclusters.etcd.database.coreos.com
83+
group: etcd.database.coreos.com
84+
kind: EtcdCluster
85+
version: v1beta2
86+
```
87+
6788
### Bundle Dockerfile
6889

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

‎pkg/api/registry.proto

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ service Registry {
1212
rpc GetChannelEntriesThatProvide(GetAllProvidersRequest) returns (stream ChannelEntry) {}
1313
rpc GetLatestChannelEntriesThatProvide(GetLatestProvidersRequest) returns (stream ChannelEntry) {}
1414
rpc GetDefaultBundleThatProvides(GetDefaultProviderRequest) returns (Bundle) {}
15-
rpc ListBundles() returns (stream Bundle) {}
15+
rpc ListBundles(ListBundlesRequest) returns (stream Bundle) {}
1616
}
1717

1818

@@ -69,6 +69,8 @@ message ChannelEntry{
6969

7070
message ListPackageRequest{}
7171

72+
message ListBundlesRequest{}
73+
7274
message GetPackageRequest{
7375
string name = 1;
7476
}

0 commit comments

Comments
 (0)
Please sign in to comment.