Skip to content
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

Propose convention for storing operator bundle #27

Merged
merged 1 commit into from Oct 10, 2019

Conversation

tkashem
Copy link
Contributor

@tkashem tkashem commented Sep 19, 2019

This enhancement proposes standards and conventions for storing
operator manifests and metadata as conatiner images.

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 19, 2019
@ashcrow
Copy link
Member

ashcrow commented Sep 19, 2019

On first pass this looks pretty reasonable to me. I do notice that while OCI containers are referenced the majority of the examples rely on the docker command. I assume the custom and docker media-types are interchangeable.

In terms of the format version in use, how would one figure that out? Would there be a specific label associated with the formats version that someone would use skopeo inspect or the like to check?

@deads2k
Copy link
Contributor

deads2k commented Sep 19, 2019

/assign @jwforres

* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifets.
* The label `operators.coreos.com.bundle.mediatype` reflects the media type of the operator bundle. It could be helm charts, plain kubernetes manifests etc.

The labels will also be put inside a YAML file, as shown below.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which is authoritative if they do not match?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we would like to have these annotations defined in one place. In case of a mismatch, the annotations.yaml file is authoritative because on-cluster operator-registry ( component of olm ) that relies on these annotations has access to the yaml file only.

The potential use case for the LABELS is - an external off-cluster tool can inspect the image to check the type of bundle image without downloading the content.

I will add this info to the proposal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkashem I think we should add the reasoning for why OLM doesn't just use the labels itself. As I understand it, there are certain rules around how OpenShift components interact with container images, and that precludes inspecting images directly -- does that sound correct?

ADD test/annotations.yaml /metadata/annotations.yaml
```

Below is the directory layout of the operator bundle insdie the image.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: inside

Copy link
Contributor Author

@tkashem tkashem Sep 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be fixed in the next push.

```bash
$ tree
/
├── manifests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe what you would do with this? It doesn't look like a straight apply of the directory content. It is simply free-form?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, I have used the format used by operator-registry - https://github.com/operator-framework/operator-registry#manifest-format. This is the format olm uses to package operator manifests today. The directory content in this case is not directly kubectl applyable. While the operator is being installed, olm manipulates the content before applying it to the cluster.

I think, we can also package content in the operator bundle image that are straight apply.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, I have used the format used by operator-registry - https://github.com/operator-framework/operator-registry#manifest-format. This is the format olm uses to package operator manifests today. The directory content in this case is not directly kubectl applyable. While the operator is being installed, olm manipulates the content before applying it to the cluster.

I think, we can also package content in the operator bundle image that are straight apply.

please include a link for reference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directory content in this case is not directly kubectl applyable

The content should be kubectl applyable, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if it supported arbitrary resources. A challenge SRE has faced developing operators for managing OSD is how to get all required resources installed. We have a limited set of resources we can include in a grpc bundle today. Resources off the top of my head that we can't bundle but need to deploy w/ the operator: Service, ServiceMonitor, PrometheusRule

operators.coreos.com.bundle.mediatype: bundle
```

The package manifest YAML file that defines a set of `channel`(s) will not be included in the bundle. Operator registry will provide machineries to define `package` and `channel` that can be used while index is being built.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you link out to the channel and package you're describing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also doesn't explain what the index is - or link to something that explains the index concept. I'd be fine linking to another enhancement proposal PR for now if that is where we describe the index.

Copy link
Contributor Author

@tkashem tkashem Sep 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you link out to the channel and package you're describing?

I will add the links to the proposal also.

This also doesn't explain what the index is - or link to something that explains the index concept. I'd be fine linking to another enhancement proposal PR for now if that is where we describe the index.

Enhancement proposal that covers index - #24.

We still have some open questions whether channel and package definitions should be included inside the operator bundle image.


##### Build, Push, Pull Operator Bundle Image
We use the following labels to annotate the operator bundle image.
* The label `operators.coreos.com.bundle.resources` represents the bundle type:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good opportunity for us to switch to an operator framework based API domain, operators.operatorframework.io or something. Ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operators.operatorframework.io sounds good to me. I am happy to update the proposal with this new domain.

At some point, we need to plan to version our APIs to be consistent across?

operators.coreos.com.bundle.mediatype: bundle
```

The package manifest YAML file that defines a set of `channel`(s) will not be included in the bundle. Operator registry will provide machineries to define `package` and `channel` that can be used while index is being built.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also doesn't explain what the index is - or link to something that explains the index concept. I'd be fine linking to another enhancement proposal PR for now if that is where we describe the index.

```bash
cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v2alpha1
kind: Operator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What component would watch for this Operator resource and translate this into a running operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example shows how a user can run the operator using olm. This is being covered here - #28.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkashem I think it would also be useful to write out manual application by pulling the bundle image locally, unpacking it, and applying to the cluster.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkashem I think we can scope this section to just what @ecordell said as "install w/ bundle image using Operator" is covered by #28

$ cd test

# the following command generates the necessary scaffolding.
$ operator-framework bundle init --type=operator-registry --bundle-folder=0.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have existing values for this --type flag today? If so what are they? I'm not convinced that operator-registry is the right thing to put here, but I'm missing some context to say what might be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/operator-framework/operator-registry#manifest-format - operator registry bundle format is what olm uses today to pack/unpack operators. We wanted to take an incremental approach:

  • Quick win: package operator-registry into the bundle image, this gets us off of app-registry with relatively less efforts and sooner.
  • Long term: We can focus our efforts on a different format where operator metadata and manifests are separately defined and stored. csv is decomposed into plain kube manifests. We can also focus on adding support for other packaging format like helm.

The values for --type can be - operator-registry, plain ( straight apply kube manifets ), helm.

@tkashem
Copy link
Contributor Author

tkashem commented Sep 20, 2019

In terms of the format version in use, how would one figure that out? Would there be a specific label associated with the formats version that someone would use skopeo inspect or the like to check?

Good point, we can use operators.coreos.com.bundle.mediatype=bundle+v1 or a new label operators.coreos.com.bundle.version.

$ cd test

# the following command generates the necessary scaffolding.
$ operator-framework bundle init --type=operator-registry --bundle-folder=0.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we merge this proposal are we committing to the operator-framework cli name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's just an example. :) It's an open question whether we have a new cli, or use operator-sdk or operator-registry.

We use the following labels to annotate the operator bundle image.
* The label `operators.operatorframework.io.bundle.resources` represents the bundle type:
* The value `manifests` implies that this bundle contains operator manifests only.
* The value `metadada` implies that this bundle has operator metadata only.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The value `metadada` implies that this bundle has operator metadata only.
* The value `metadata` implies that this bundle has operator metadata only.

* The label `operators.operatorframework.io.bundle.resources` represents the bundle type:
* The value `manifests` implies that this bundle contains operator manifests only.
* The value `metadada` implies that this bundle has operator metadata only.
* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifets.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifets.
* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifests.

By standardizing on a container format for this data, we get many other features for free, such as: identity, distribution, replication, deduplication, signing, and ingress.

### Goals
* Define a convention for storing operator manifetss and metadata with container image.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Define a convention for storing operator manifetss and metadata with container image.
* Define a convention for storing operator manifests and metadata with container image.

* The `/manifests` folder is expected to contain resources that can be applied to the cluster using standard tooling like `kubectl`.
* The `/metadata` folder is expected to contain resources that are not directly appliable. It can be used to store supporting metadata associated with the operator.
* The image is not runnable, it is built from `scratch`.
* The first image layer is expected to contain all of `/manifests`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this requirement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it, so unpacking the bundle content will now involve going through each image layer and extracting it.

$ cd test

# the following command generates the necessary scaffolding.
$ operator-framework bundle init --type=registry --bundle-folder=0.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add this to operator-sdk?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be - we're building the libraries and tooling so that operator-sdk can just wrap them. I believe this is just a strawman, but we'll likely have an entry point outside of sdk as well.

Once the scaffolding is generated the user can do a `docker build` to create an operator bundle image.

#### Validate an Operator Bundle
As an operator author I want to validate an operator bundle image so that I can ensure it runs as expected on a cluster.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated above, these images do not and cannot run, so consider rewording this. You could just leave it at "As an operator author I want to validate an operator bundle image."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a typo, it should be I can ensure my operator runs as expected on a cluster.

```

The validate command will do the following:
* Make sure the image `label` and `annotations.yaml` are appropriately configured. If there is any mismatch, the tool shoud generate apropriate error message.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/shoud/should/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/apropriate/appropriate/

├── 0.1.0
│ ├── testbackup.crd.yaml
│ ├── testcluster.crd.yaml
│ ├── testoperator.v0.1.0.clusterserviceversion.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do CSVs still include the "placeholder" namespace? This seems to assume that's not a problem in this example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a separate effort to enable "directly applying CSVs" that this section assumes is already in place.

But I think the example probably should include a namespace flag?

* The label `operators.operatorframework.io.bundle.resources` represents the bundle type:
* The value `manifests` implies that this bundle contains operator manifests only.
* The value `metadada` implies that this bundle has operator metadata only.
* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifets.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the use case for having a bundle with only one or the other? It seems like not a lot of data; why not "bundle" it together all the time and not worry about this difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec keeps room for separation, on the other hand our implementation which is already in progress "bundles" all of manifests/metadata together.

This enhancement proposes standards and conventions for storing
operator manifests and metadata as conatiner images.
Comment on lines +78 to +81
* The label `operators.operatorframework.io.bundle.resources` represents the bundle type:
* The value `manifests` implies that this bundle contains operator manifests only.
* The value `metadata` implies that this bundle has operator metadata only.
* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's not a direct need for this now, I suggest leaving it out of the initial implementation. I'm sure you will version the format you're creating, and if this turns out to be a valuable distinction, you can add it in a later version.

Otherwise, this adds a fair amount of complexity that may not be worthwhile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this falls under the inspect portion of the Build, Push, Pull Operator Bundle story. It's necessary if a user wants to identify a bundle image before pulling its layers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Michael, this is not something that we need to be focusing on.


We would like to be able to talk about a set of metadata and manifests, outside the context of a cluster, as representing a particular application or service (in this case, an operator).

By standardizing on a container format for this data, we get many other features for free, such as: identity, distribution, replication, deduplication, signing, and ingress.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... on a container format ...

Would "on an OCI-compliant format" be more clear?

By standardizing on a container format for this data, we get many other features for free, such as: identity, distribution, replication, deduplication, signing, and ingress.

### Goals
* Define a convention for storing operator manifests and metadata with container image.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Define a convention for storing operator manifests and metadata with container image.
* Define a convention for storing operator manifests and metadata with a container image.

* Build on-cluster tooling to interact with bundles

## Proposal
We delineate the operator metadata from the operator manifests. The operator manifests refers to a set of kubernetes manifest(s) the defines the deployment and RBAC model of the operator. The operator metadata on the other hand are, but not limited to:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We delineate the operator metadata from the operator manifests. The operator manifests refers to a set of kubernetes manifest(s) the defines the deployment and RBAC model of the operator. The operator metadata on the other hand are, but not limited to:
We delineate operator metadata from operator manifests. We define _operator manifests_ as a set of kubernetes manifests that compose an operator's deployment (`Deployment`, RBAC, etc), and _operator metadata_ as including:


*Constraints*:
* An operator bundle (including both manifests and metadata) should be identifiable using a single versioned identifier.
* For an operator The metadata can be downloaded independently of the manifest.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* For an operator The metadata can be downloaded independently of the manifest.
* An operator's metadata can be downloaded independently of its manifests.

Comment on lines +78 to +81
* The label `operators.operatorframework.io.bundle.resources` represents the bundle type:
* The value `manifests` implies that this bundle contains operator manifests only.
* The value `metadata` implies that this bundle has operator metadata only.
* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this falls under the inspect portion of the Build, Push, Pull Operator Bundle story. It's necessary if a user wants to identify a bundle image before pulling its layers.

* The value `manifests` implies that this bundle contains operator manifests only.
* The value `metadata` implies that this bundle has operator metadata only.
* The value `manifests+metadata` implies that this bundle contains both operator metadata and manifests.
* The label `operators.operatorframework.io.bundle.mediatype` reflects the media type or format of the operator bundle. It could be helm charts, plain kubernetes manifests etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that manifests and metadata will always be of the same mediatype?

Comment on lines +99 to +101
* `registry`: Format used by [Operator Registry](https://github.com/operator-framework/operator-registry#manifest-format) to package an operator.
* `helm`: Can be used to package a helm chart inside an operator bundle.
* `plain`: Can be used to package plain k8s manifests inside an operator bundle.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call out kustomize too?

$ cd test

# the following command generates the necessary scaffolding.
$ operator-framework bundle init --type=registry --bundle-folder=0.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What registry version would --type=registry use, the latest the tool is privy to? Should we always require the proposed version suffix (+<v>)?

* Verify that the format of the bundle is valid. If the bundle is of `registry` format, we should verify that the bundle conforms to operator-registry standards.

#### Run the Operator from the Bundle Image
As an operator author I want to run my operator directly from the bundle image. Once an operator is packaged into a bundle image, we want to give the author ability to run it using `olm` directly from the bundle image.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As an operator author I want to run my operator directly from the bundle image. Once an operator is packaged into a bundle image, we want to give the author ability to run it using `olm` directly from the bundle image.
As an operator author I want to install my operator directly using only its bundle image.

```bash
cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v2alpha1
kind: Operator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkashem I think we can scope this section to just what @ecordell said as "install w/ bundle image using Operator" is covered by #28

@mhrivnak
Copy link
Member

mhrivnak commented Oct 4, 2019

Did you consider putting the metadata into a LABEL on the image? That would simplify retrieval of metadata from a bundle. That approach was used successfully with APBs.


`Dockerfile` for operator bundle
```
FROM scratch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we considered that this is included in the operator image in a well-defined place?

Seems to me the only issue would be the SHA that is used in the deployment manifest but could OLM/Index Image replace that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed off-line - this is a feature we could build as part of the index in the future, but it would make it harder to audit images that are running on-cluster. We should be able to layer it on to the current proposal easily, but we need to weigh building that vs. the UX of understanding what's actually running on your cluster.

@ecordell
Copy link
Contributor

ecordell commented Oct 7, 2019

@mhrivnak Labels would be ideal, but we need the metadata on-cluster, and we won't have access to the actual (docker v2-2) manifest on-cluster.

There's nothing stopping us from replicating the metadata into labels, much like we're doing for the media types here, as need arises.

* 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.

###### Format
We can use the following values for `mediatype`:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this indicate that we will have to write the ability to deploy with these types? Can we say that these are potential types and not implement them until later? I think that we just focus on registry for now.

@ecordell
Copy link
Contributor

/approve
/lgtm

The remaining issues will be addressed in a followup PR.

@shawn-hurley
Copy link

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 10, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ecordell, shawn-hurley, tkashem

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [ecordell,shawn-hurley]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 10, 2019
@openshift-merge-robot openshift-merge-robot merged commit aa0d20f into openshift:master Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet