Skip to content

Commit 7673f8e

Browse files
exdxdinhxuanvu
authored andcommittedJan 16, 2020
Add validate bundle contents
1. Add bundle content validation 2. Add the bundle validation documentation 3. Add needed vendor code for validation Signed-off-by: Vu Dinh <[email protected]>
1 parent 5ec9f93 commit 7673f8e

File tree

389 files changed

+67016
-11876
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

389 files changed

+67016
-11876
lines changed
 

‎docs/design/operator-bundle.md

+25
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,28 @@ The `--package` or `-p` is the name of package fo the operator such as `etcd` wh
209209
*Notes:*
210210
* If there is `Dockerfile` existing in the directory, it will be overwritten.
211211
* If there is an existing `annotations.yaml` in `/metadata` directory, the cli will attempt to validate it and returns any found errors. If the ``annotations.yaml`` is valid, it will be used as a part of build process. The optional boolean `--overwrite/-o` flag can be enabled (false by default) to allow cli to overwrite the `annotations.yaml` if existed.
212+
213+
### Validate Bundle Image
214+
215+
Operator bundle image can validate bundle image that is publicly available in an image registry using `validate` command (see *Notes* below). The overall `bundle validate` command usage is:
216+
```bash
217+
Usage:
218+
operator-SDK bundle validate [flags]
219+
220+
Flags:
221+
-t, --tag string The name of the bundle image will be built
222+
-b, --image-builder string Tool to extract container images. One of: [docker, podman] (default "docker")
223+
-h, --help help for build
224+
```
225+
226+
The command for `validate` task is:
227+
```bash
228+
$ ./operator-sdk bundle build --tag quay.io/coreos/test-operator.v0.1.0:latest --image-builder docker
229+
```
230+
231+
The `validate` command will first extract the contents of the bundle image into a temporary directory after it pulls the image from its image registry. Then, it will validate the format of bundle image to ensure manifests and metadata are located in their appropriate directories (`/manifests/` for bundle manifests files such as CSV and `/metadata/` for metadata files such as `annotations.yaml`). Also, it will validate the information in `annotations.yaml` to confirm that metadata is matching the provided data. For example, the provided media type in annotations.yaml just matches the actual media type is provided in the bundle image.
232+
233+
After the bundle image format is confirmed, the command will validate the bundle contents such as manifests and metadata files only if the bundle format is `RegistryV1` type meaning it contains `ClusterResourceVersion` and its associated Kubernetes objects that makes up an Operator. The content validation process will ensure the individual file in the bundle image is valid and can be applied to an OLM-enabled cluster provided all necessary permissions and configurations are met.
234+
235+
*Notes:*
236+
* The bundle content validation is best effort which means it will not guarantee 100% accuracy due to nature of Kubernetes objects may need certain permissions and configurations, which users may not have, in order to be applied successfully in a cluster.

‎go.mod

+34-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
module github.com/operator-framework/operator-registry
22

3+
go 1.13
4+
35
require (
46
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6
57
github.com/docker/distribution v2.7.1+incompatible
68
github.com/ghodss/yaml v1.0.0
79
github.com/golang-migrate/migrate/v4 v4.6.2
8-
github.com/golang/mock v1.2.0
10+
github.com/golang/mock v1.3.1
911
github.com/golang/protobuf v1.3.2
1012
github.com/grpc-ecosystem/grpc-health-probe v0.2.1-0.20181220223928-2bf0a5b182db
1113
github.com/mattn/go-sqlite3 v1.10.0
1214
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
1315
github.com/onsi/ginkgo v1.10.1
1416
github.com/onsi/gomega v1.7.0
17+
github.com/operator-framework/api v0.0.0-20191127212340-9066a6e95573
18+
github.com/operator-framework/operator-lifecycle-manager v0.0.0-20191115003340-16619cd27fa5
1519
github.com/otiai10/copy v1.0.1
16-
github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 // indirect
1720
github.com/pkg/errors v0.8.1
1821
github.com/sirupsen/logrus v1.4.2
1922
github.com/spf13/cobra v0.0.5
@@ -23,14 +26,35 @@ require (
2326
google.golang.org/grpc v1.24.0
2427
gopkg.in/yaml.v2 v2.2.4
2528
helm.sh/helm/v3 v3.0.1
26-
k8s.io/api v0.0.0-20191016110408-35e52d86657a
27-
k8s.io/apiextensions-apiserver v0.0.0-20191016113550-5357c4baaf65
28-
k8s.io/apimachinery v0.0.0-20191004115801-a2eda9f80ab8
29-
k8s.io/client-go v0.0.0-20191016111102-bec269661e48
29+
k8s.io/api v0.0.0
30+
k8s.io/apiextensions-apiserver v0.0.0
31+
k8s.io/apimachinery v0.0.0
32+
k8s.io/client-go v8.0.0+incompatible
3033
k8s.io/klog v1.0.0
31-
k8s.io/kubectl v0.0.0-20191016120415-2ed914427d51
34+
k8s.io/kubectl v0.0.0
3235
)
3336

34-
replace github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm
35-
36-
go 1.13
37+
replace (
38+
github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm
39+
k8s.io/api => k8s.io/api v0.0.0-20190918155943-95b840bb6a1f
40+
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783
41+
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
42+
k8s.io/apiserver => k8s.io/apiserver v0.0.0-20191016112112-5190913f932d
43+
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20191016114015-74ad18325ed5
44+
k8s.io/client-go => k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90
45+
k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20191016115326-20453efc2458
46+
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.0.0-20191016115129-c07a134afb42
47+
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20191004115455-8e001e5d1894
48+
k8s.io/component-base => k8s.io/component-base v0.0.0-20191016111319-039242c015a9
49+
k8s.io/cri-api => k8s.io/cri-api v0.0.0-20190828162817-608eb1dad4ac
50+
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20191016115521-756ffa5af0bd
51+
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.0.0-20191016112429-9587704a8ad4
52+
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20191016114939-2b2b218dc1df
53+
k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20191016114407-2e83b6f20229
54+
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20191016114748-65049c67a58b
55+
k8s.io/kubectl => k8s.io/kubectl v0.0.0-20191016120415-2ed914427d51
56+
k8s.io/kubelet => k8s.io/kubelet v0.0.0-20191016114556-7841ed97f1b2
57+
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20191016115753-cf0698c3a16b
58+
k8s.io/metrics => k8s.io/metrics v0.0.0-20191016113814-3b1a734dba6e
59+
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.0.0-20191016112829-06bb3c9d77c9
60+
)

0 commit comments

Comments
 (0)
Please sign in to comment.