Skip to content

Commit 2df8338

Browse files
authored
Merge pull request kubernetes#1481 from ecordell/bundlekep
Add manifest bundle kep
2 parents 2a265b3 + ab81a4d commit 2df8338

File tree

1 file changed

+189
-0
lines changed

1 file changed

+189
-0
lines changed
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
---
2+
title: Manifest Bundle
3+
authors: ["@ecordell"]
4+
owning-sig: sig-cluster-lifecycle
5+
participating-sigs: ["sig-cluster-lifecycle", "sig-api-machinery"]
6+
reviewers: ["TBD"]
7+
approvers: ["TBD"]
8+
editor: TBD
9+
creation-date: 2020-01-21
10+
last-updated: 2020-02-06
11+
status: provisional
12+
see-also: ["/keps/sig-cluster-lifecycle/addons/0035-20190128-addons-via-operators.md"]
13+
---
14+
15+
# Manifest Bundle
16+
17+
## Table of Contents
18+
19+
<!-- toc -->
20+
- [Summary](#summary)
21+
- [Motivation](#motivation)
22+
- [Goals](#goals)
23+
- [Non-Goals](#non-goals)
24+
- [Proposal](#proposal)
25+
- [User Stories](#user-stories)
26+
- [Build, Push, Pull Manifest Bundle](#build-push-pull-manifest-bundle)
27+
- [Implementation Details/Notes/Constraints](#implementation-detailsnotesconstraints)
28+
- [Examples](#examples)
29+
- [Operator Bundles](#operator-bundles)
30+
- [Plain manifests](#plain-manifests)
31+
- [kops](#kops)
32+
- [kubeadm](#kubeadm)
33+
- [Expose a Manifest bundle](#expose-a-manifest-bundle)
34+
- [Implementation Details/Notes/Constraints](#implementation-detailsnotesconstraints-1)
35+
- [Alternatives](#alternatives)
36+
<!-- /toc -->
37+
38+
## Summary
39+
40+
This enhancement proposes standards and conventions for storing kubernetes manifests and metadata associated with an operator as container images in OCI-compliant container registries, and to associate metadata-only images with standard, runnable images.
41+
42+
## Motivation
43+
44+
There is no standard way to associate and transmit kube and kube-like manifests and metadata between clusters, or to associate a set of manifests with one or more runnable container images.
45+
46+
Existing non-standard methods include:
47+
48+
* git repositories
49+
* operator-registry directory “bundles”
50+
* helm charts
51+
* appregistry
52+
53+
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).
54+
55+
By standardizing on a container format for this data, we get many other features for free, such as: identity, distribution, replication, deduplication, signing, and cluster ingress.
56+
57+
## Goals
58+
59+
* Define a convention for storing manifests and metadata with a container image
60+
* Build and push metadata using standard container tooling (docker cli, podman, etc) to common container image registries (Artifactory, docker hub, quay, google's registry, amazon's registry)
61+
* No union filesystem should be required to consume metadata
62+
* Have a simple mechanism to apply a bundle to a kubernetes cluster
63+
64+
## Non-Goals
65+
66+
* Require OCI registries that support any non-standard media types (i.e. anything other than docker and layer image oci)
67+
* Build on-cluster tooling to interact with bundles
68+
69+
## Proposal
70+
71+
We would like to make a distinction between:
72+
73+
* **Manifests** * data which can be applied to a cluster, either with or without pre-processing. Examples: json or yaml manifests, helm charts, kustomize bundles.
74+
* **Metadata** * information which will not be directly applied to a cluster, but which will otherwise affect the processing or application of a bundle.
75+
76+
## User Stories
77+
78+
### Build, Push, Pull Manifest Bundle
79+
80+
As a manifest author, I would like to store manifests and metadata in a format compatible with container registries.
81+
82+
Constraints:
83+
84+
* An operator bundle (including both manifests and metadata) should be identifiable using a single versioned identifier.
85+
86+
## Implementation Details/Notes/Constraints
87+
88+
The initial implementation target will be Docker v2-2 manifests, manifest-lists, and client support, for maximum compatibility with existing tooling. OCI is a future target, but avoided for now due to lack of tooling support.
89+
90+
Labels are used to identify the contents. The approach is similar to OCI mediatypes, but is supported by existing tooling.
91+
92+
The following label convention is used to annotate the bundle image:
93+
94+
* `<namespace>.mediatype.<version>=<identifier>` is used to identify the top-level format of the bundle. For example, this may indicate that the bundle contains a kustomization file and kustomize manifests.
95+
* `<namespace>.bundle.manifests.<version>=<path>` reflects the path in the image to a directory that contains manifests.
96+
* `<namespace>.bundle.metadata.<version>=<path>` reflects the path in the image to a directory that contains metadata.
97+
* Any additional `<namespace>.bundle.<identifier>=<value>` may be used to indicate additional properties of the manifest bundle. It may be useful to denormalize information that would otherwise be stored in the metadata directory, so that tooling can read it without unpacking a full image.
98+
These labels should also be replicated in a well-known location within the image, metadata/annotations.yaml:
99+
100+
```yaml
101+
annotations:
102+
<namespace>.mediatype.<version>: <identifier>
103+
<namespace>.bundle.manifests.<version>: <path>
104+
<namespace>.bundle.metadata.<version>: <path>
105+
<namespace>.bundle.<identifier>: <value>
106+
```
107+
108+
This is important so that on-cluster tools can have access to the labels. There is currently no way for kubernetes to expose image labels to a consumer. In the case of a conflict, the labels in the annotations file are preferred.
109+
110+
### Examples
111+
112+
#### Operator Bundles
113+
114+
The operator framework is [piloting the use of this format](https://github.com/operator-framework/operator-registry/blob/master/docs/design/operator-bundle.md) for transmitting operator bundles. The annotations used in this example are:
115+
116+
```yaml
117+
annotations:
118+
operators.operatorframework.io.bundle.mediatype.v1: "registry+v1"
119+
operators.operatorframework.io.bundle.manifests.v1: "manifests/"
120+
operators.operatorframework.io.bundle.metadata.v1: "metadata/"
121+
operators.operatorframework.io.bundle.package.v1: "test-operator"
122+
operators.operatorframework.io.bundle.channels.v1: "beta,stable"
123+
operators.operatorframework.io.bundle.channel.default.v1: "stable"
124+
```
125+
126+
#### Plain manifests
127+
128+
Kubernetes manifests may be packaged minimally with:
129+
130+
```yaml
131+
annotations:
132+
k8s.io.bundle.mediatype.v1: "manifests"
133+
k8s.io.bundle.manifests.v1: "manifests/"
134+
k8s.io.bundle.metadata.v1: "metadata/"
135+
```
136+
137+
and kubectl could easily be extended to support applying a bundle formatted in this way.
138+
139+
#### kops
140+
141+
There is ongoing work in `kops` to improve support for addons. One current prototype uses `kops create cluster --add=file.yaml --add=file2.yaml`, where each `--add` flag indicates some manifest required for an addon. Metadata for kops may look something like:
142+
143+
```yaml
144+
annotations:
145+
kops.k8s.io.bundle.mediatype.v1: "kops+v1"
146+
operators.operatorframework.io.bundle.manifests.v1: "manifests/"
147+
operators.operatorframework.io.bundle.metadata.v1: "metadata/"
148+
```
149+
150+
#### kubeadm
151+
152+
The [proposed kep](https://github.com/kubernetes/enhancements/pull/1308) for addon support for kubeadm mentions kustomize as a target bundle format and OCI artifacts as a potential solution. The current KEP would offer similar benefits to the OCI approach but without some of the current limitations.
153+
154+
### Expose a Manifest bundle
155+
156+
As a kubernetes user, I would like to use kubelet to download the manifest bundle and expose it to me for consumption.
157+
158+
Clusters are often configured with specific rules and credentials for pulling images into a cluster. Relying on kubelet to pull manifest bundles ensures that configuration comes through the same channel as runnable images.
159+
160+
#### Implementation Details/Notes/Constraints
161+
162+
A tool should be able to pull down the manifest bundle and expose it to a cluster. Examples of such extractors are:
163+
164+
* Extract and store manifests as entries in a configmap or secret for further processing on-cluster
165+
* Read and apply the manifests, according to rules configured by the metadata.
166+
167+
Tools that extract bundles on a cluster work by:
168+
169+
* Running a Pod with an initContainer containing the extraction tool and a container referencing the bundle.
170+
* On start, the tool from the init container is copied into the running environment
171+
172+
The tool is run in a pod which is now populated with manifests. It will read metadata/annotations.json to know how to process the other files in the bundle.
173+
174+
Such a [tool](https://github.com/operator-framework/operator-registry/blob/master/cmd/opm/alpha/bundle/extract.go) has been written for the operator-framework pilot and can easily be generalized.
175+
176+
## Alternatives
177+
178+
This proposal is aligned with the use cases and requirements of [OCI Artifacts](https://github.com/opencontainers/artifacts). This proposal could be seen as a way to implement OCI artifacts with standard container images.
179+
180+
There are several reasons that artifacts are not a good solution _at the moment_:
181+
182+
* Not all registries support OCI yet.
183+
* Of registries that do support the OCI spec, not all support OCI artifacts in particular.
184+
* Of registries that do support OCI artifacts, not all allow arbitrary media types, or provide a mechanism to register new media types. There is currently no standard set of artifact media types for registries to support (something of a chicken-and-egg problem with mediatypes).
185+
* There are few tools that can build OCI artifacts.
186+
* There is currently no way for kubelet to pull an OCI artifact into a cluster. This limits the ways in which manifest bundles can be used to offcluster. (Other, non-kubelet tools within a cluster could pull them, but such pulls would lack the auditing and cluster-wide configuration that comes from relying on kubelet for image ingress).
187+
* There is currently no way to read labels (annotations) from an image on a cluster.
188+
189+
None of these problems are insurmountable, and it would be desirable to move to OCI artifacts when these roadblocks are removed. There should be a straightforward migration path to OCI artifacts when that happens.

0 commit comments

Comments
 (0)