Skip to content

Commit 3842bd3

Browse files
add: new community validator to check bundles (#4939)
Signed-off-by: Camila Macedo <[email protected]>
1 parent 69495b4 commit 3842bd3

File tree

7 files changed

+75
-13
lines changed

7 files changed

+75
-13
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# entries is a list of entries to include in
2+
# release notes and/or the migration guide
3+
entries:
4+
- description: >
5+
Added new bundle validator to check the bundle against the Community Operator criteria in the alpha stage. For futher information run `operator-sdk bundle validate --list-optional` and `operator-sdk bundle validate --help`.
6+
7+
# kind is one of:
8+
# - addition
9+
# - change
10+
# - deprecation
11+
# - removal
12+
# - bugfix
13+
kind: "addition"
14+
15+
# Is this a breaking change?
16+
breaking: false

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
1313
github.com/onsi/ginkgo v1.15.2
1414
github.com/onsi/gomega v1.11.0
15-
github.com/operator-framework/api v0.8.1
15+
github.com/operator-framework/api v0.8.2-0.20210526151024-41d37db9141f
1616
github.com/operator-framework/java-operator-plugins v0.0.0-20210525141944-8303c38a876d
1717
github.com/operator-framework/operator-lib v0.4.1
1818
github.com/operator-framework/operator-registry v1.15.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh
768768
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
769769
github.com/operator-framework/api v0.3.22/go.mod h1:GVNiB6AQucwdZz3ZFXNv9HtcLOzcFnr6O/QldzKG93g=
770770
github.com/operator-framework/api v0.5.2/go.mod h1:L7IvLd/ckxJEJg/t4oTTlnHKAJIP/p51AvEslW3wYdY=
771-
github.com/operator-framework/api v0.8.1 h1:eFWAV70bvnQfNFM1dmBOY4y5u/WGZHV/SVDDl5WNsMk=
772-
github.com/operator-framework/api v0.8.1/go.mod h1:L7IvLd/ckxJEJg/t4oTTlnHKAJIP/p51AvEslW3wYdY=
771+
github.com/operator-framework/api v0.8.2-0.20210526151024-41d37db9141f h1:VX19pxX9NNJNoh0kfS0PSzK4lOInXh4+4VNlbaED/gg=
772+
github.com/operator-framework/api v0.8.2-0.20210526151024-41d37db9141f/go.mod h1:L7IvLd/ckxJEJg/t4oTTlnHKAJIP/p51AvEslW3wYdY=
773773
github.com/operator-framework/java-operator-plugins v0.0.0-20210525141944-8303c38a876d h1:HE4CQY27vaQWQnk7oD2mku417tKyOz6UQHOUNVCuFHU=
774774
github.com/operator-framework/java-operator-plugins v0.0.0-20210525141944-8303c38a876d/go.mod h1:QFcG224Nx8VMwBEqxpZbT17LkISNzlOjY1/r4OQBYic=
775775
github.com/operator-framework/operator-lib v0.4.1 h1:Eh4JHs+LAWeC85ZMHXJ9RXg7G5grYx8J29TkOw8003s=

internal/cmd/operator-sdk/bundle/validate/cmd.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,32 @@ To build and validate a *pullable* bundle image:
6565
To list and run optional validators, which are specified by a label selector:
6666
6767
$ operator-sdk bundle validate --list-optional
68-
NAME LABELS DESCRIPTION
69-
operatorhub name=operatorhub OperatorHub.io metadata validation
70-
suite=operatorframework
68+
NAME LABELS DESCRIPTION
69+
operatorhub name=operatorhub OperatorHub.io metadata validation.
70+
suite=operatorframework
71+
community name=community (stage: alpha) Community Operator bundle validation.
7172
7273
To validate a bundle against the entire suite of validators for Operator Framework, in addition to required bundle validators:
7374
7475
$ operator-sdk bundle validate ./bundle --select-optional suite=operatorframework
7576
77+
**NOTE:** The OperatorHub.io validator in the operatorframework optional suite allows you to validate that your manifests can work with a Kubernetes cluster of a particular version using the k8s-version optional key value:
78+
79+
$ operator-sdk bundle validate ./bundle --select-optional suite=operatorframework --optional-values=k8s-version=1.22
80+
7681
To validate a bundle against the validator for operatorhub.io specifically, in addition to required bundle validators:
7782
7883
$ operator-sdk bundle validate ./bundle --select-optional name=operatorhub
84+
85+
**NOTE:** This validator allows check the bundle against an specific Kubernetes cluster version using the k8s-version optional key value:
86+
87+
$ operator-sdk bundle validate ./bundle --select-optional name=operatorhub --optional-values=k8s-version=1.22
88+
89+
(stage: alpha) To validate a bundle against the validator for Community Operators specifically, in addition to required bundle validators. This validator allows check the bundle image. In this way, inform the path-index optional key value:
90+
91+
$ operator-sdk bundle validate ./bundle --select-optional name=community --optional-values=index-path=bundle.Dockerfile
92+
93+
**NOTE:** Community Operators are the operators which will be distributed on the OKD/OCP catalogs. More info: https://github.com/operator-framework/community-operators/
7994
`
8095
)
8196

internal/cmd/operator-sdk/bundle/validate/optional.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@ var optionalValidators = validators{
4242
nameKey: "operatorhub",
4343
suiteKey: "operatorframework",
4444
},
45-
desc: "OperatorHub.io metadata validation",
45+
desc: "OperatorHub.io metadata validation. ",
46+
},
47+
{
48+
Validator: apivalidation.CommunityOperatorValidator,
49+
name: "community",
50+
labels: map[string]string{
51+
nameKey: "community",
52+
},
53+
desc: "(stage: alpha) Community Operator bundle validation.",
4654
},
4755
}
4856

@@ -117,6 +125,7 @@ func (vals validators) run(bundle *apimanifests.Bundle, sel labels.Selector, opt
117125
}
118126

119127
// Pass the --optional-values. e.g. --optional-values="k8s-version=1.22"
128+
// or --optional-values="image-path=bundle.Dockerfile"
120129
objs = append(objs, optionalValues)
121130

122131
for _, v := range vals {

website/content/en/docs/cli/operator-sdk_bundle_validate.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,32 @@ To build and validate a *pullable* bundle image:
5151
To list and run optional validators, which are specified by a label selector:
5252
5353
$ operator-sdk bundle validate --list-optional
54-
NAME LABELS DESCRIPTION
55-
operatorhub name=operatorhub OperatorHub.io metadata validation
56-
suite=operatorframework
54+
NAME LABELS DESCRIPTION
55+
operatorhub name=operatorhub OperatorHub.io metadata validation.
56+
suite=operatorframework
57+
community name=community (stage: alpha) Community Operator bundle validation.
5758
5859
To validate a bundle against the entire suite of validators for Operator Framework, in addition to required bundle validators:
5960
6061
$ operator-sdk bundle validate ./bundle --select-optional suite=operatorframework
6162
63+
**NOTE:** The OperatorHub.io validator in the operatorframework optional suite allows you to validate that your manifests can work with a Kubernetes cluster of a particular version using the k8s-version optional key value:
64+
65+
$ operator-sdk bundle validate ./bundle --select-optional suite=operatorframework --optional-values=k8s-version=1.22
66+
6267
To validate a bundle against the validator for operatorhub.io specifically, in addition to required bundle validators:
6368
6469
$ operator-sdk bundle validate ./bundle --select-optional name=operatorhub
70+
71+
**NOTE:** This validator allows check the bundle against an specific Kubernetes cluster version using the k8s-version optional key value:
72+
73+
$ operator-sdk bundle validate ./bundle --select-optional name=operatorhub --optional-values=k8s-version=1.22
74+
75+
(stage: alpha) To validate a bundle against the validator for Community Operators specifically, in addition to required bundle validators. This validator allows check the bundle image. In this way, inform the path-index optional key value:
76+
77+
$ operator-sdk bundle validate ./bundle --select-optional name=community --optional-values=index-path=bundle.Dockerfile
78+
79+
**NOTE:** Community Operators are the operators which will be distributed on the OKD/OCP catalogs. More info: https://github.com/operator-framework/community-operators/
6580
6681
```
6782

website/content/en/docs/olm-integration/generation.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ You can list all available optional validators by setting the `--list-optional`
223223

224224
```console
225225
$ operator-sdk bundle validate --list-optional
226-
NAME LABELS DESCRIPTION
227-
operatorhub name=operatorhub OperatorHub.io metadata validation
228-
suite=operatorframework
226+
NAME LABELS DESCRIPTION
227+
operatorhub name=operatorhub OperatorHub.io metadata validation.
228+
suite=operatorframework
229+
community name=community (stage: alpha) Community Operator bundle validation
229230
...
230231
```
231232

@@ -254,6 +255,12 @@ operator-sdk bundle validate ./bundle --select-optional suite=operatorframework
254255
Documentation on optional validators:
255256
- [`operatorhub`][operatorhub_validator]
256257

258+
**Note**: (stage: alpha) The `Community` validator allows you to validate your `bundle.Dockerfile` configuration against its specific criteria using the `image-path` optional key value:
259+
260+
```sh
261+
operator-sdk bundle validate ./bundle --select-optional name=community --optional-values=image-path=bundle.Dockerfile
262+
```
263+
257264
### Package manifests format
258265

259266
A [package manifests][package-manifests] format consists of on-disk manifests (CSV, CRDs and other supported kinds)

0 commit comments

Comments
 (0)