Skip to content

Commit bf3670a

Browse files
Merge pull request #1101 from openshift-bot/synchronize-upstream
NO-ISSUE: Synchronize From Upstream Repositories
2 parents 0366121 + a2ef251 commit bf3670a

File tree

12 files changed

+151
-21
lines changed

12 files changed

+151
-21
lines changed

staging/operator-lifecycle-manager/DEVELOPMENT.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ To run a specific e2e test locally:
4646
$ make e2e-local TEST=TestCreateInstallPlanManualApproval
4747
```
4848

49+
##### Updating test images
50+
51+
Sometimes you will need to update the index or bundle images used in the unit or e2e tests. To update those images, you will need to be logged into quay.io with membership in the `olmtest` organization. Then simply run `./scripts/build_e2e_test_images.sh` which will build all the required bundle images, push those to quay.io, build all the index images, and push those to quay.io as well.
52+
53+
Please be aware that these scripts push directly to the image tags used by the actual e2e tests.
54+
55+
The contents and Containerfiles of these bundles can be found in `./test/images/`.
56+
4957
[controller-runtime instructions]: https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest#section-readme
5058

5159
#### Building
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
QUAY_REPO="${QUAY_REPO:-olmtest}"
4+
SINGLE_BUNDLE_TAG="${BUNDLE_TAG:-objects-pdb-v2}"
5+
SINGLE_BUNDLE_INDEX_TAG="${INDEX_TAG:-pdb-v2}"
6+
7+
# Busybox Operator Index Image
8+
docker build -t quay.io/${QUAY_REPO}/busybox-bundle:1.0.0 ./test/images/busybox-index/busybox/1.0.0
9+
docker build -t quay.io/${QUAY_REPO}/busybox-bundle:2.0.0 ./test/images/busybox-index/busybox/2.0.0
10+
11+
docker build -t quay.io/${QUAY_REPO}/busybox-dependency-bundle:1.0.0 ./test/images/busybox-index/busybox-dependency/1.0.0
12+
docker build -t quay.io/${QUAY_REPO}/busybox-dependency-bundle:2.0.0 ./test/images/busybox-index/busybox-dependency/2.0.0
13+
14+
docker push quay.io/${QUAY_REPO}/busybox-bundle:1.0.0
15+
docker push quay.io/${QUAY_REPO}/busybox-bundle:2.0.0
16+
docker push quay.io/${QUAY_REPO}/busybox-dependency-bundle:1.0.0
17+
docker push quay.io/${QUAY_REPO}/busybox-dependency-bundle:2.0.0
18+
19+
opm index add --bundles quay.io/${QUAY_REPO}/busybox-dependency-bundle:1.0.0,quay.io/olmtest/busybox-bundle:1.0.0 --tag quay.io/olmtest/busybox-dependencies-index:1.0.0-with-ListBundles-method -c docker
20+
docker push quay.io/${QUAY_REPO}/busybox-dependencies-index:1.0.0-with-ListBundles-method
21+
22+
opm index add --bundles quay.io/${QUAY_REPO}/busybox-dependency-bundle:2.0.0,quay.io/olmtest/busybox-bundle:2.0.0 --tag quay.io/olmtest/busybox-dependencies-index:2.0.0-with-ListBundles-method --from-index quay.io/olmtest/busybox-dependencies-index:1.0.0-with-ListBundles-method -c docker
23+
docker push quay.io/${QUAY_REPO}/busybox-dependencies-index:2.0.0-with-ListBundles-method
24+
25+
# Single Bundle E2E Test Image
26+
docker build -t quay.io/${QUAY_REPO}/bundle:${BUNDLE_TAG} ./test/images/single-bundle-index
27+
docker push quay.io/${QUAY_REPO}/bundle:${BUNDLE_TAG}
28+
29+
opm index add --bundles quay.io/${QUAY_REPO}/bundle:${BUNDLE_TAG} --tag quay.io/${QUAY_REPO}/single-bundle-index:${INDEX_TAG} -c docker
30+
docker push quay.io/${QUAY_REPO}/single-bundle-index:${INDEX_TAG}

staging/operator-lifecycle-manager/scripts/build_test_images.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

staging/operator-lifecycle-manager/test/e2e/bundle_e2e_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ var _ = Describe("Installing bundles with new object types", Label("ObjectTypes"
4747
TeardownNamespace(generatedNamespace.GetName())
4848
})
4949

50-
When("a bundle with a pdb, priorityclass, and VPA object is installed", func() {
50+
When("a bundle that includes supported resources is installed", func() {
51+
// Supported resources installed are a NetworkPolicy, pdb, priorityclass, and VPA object
5152
const (
5253
packageName = "busybox"
5354
channelName = "alpha"
@@ -59,7 +60,7 @@ var _ = Describe("Installing bundles with new object types", Label("ObjectTypes"
5960
By("first installing the VPA CRD on cluster")
6061
const (
6162
sourceName = "test-catalog"
62-
imageName = "quay.io/olmtest/single-bundle-index:pdb-v1"
63+
imageName = "quay.io/olmtest/single-bundle-index:pdb-v2"
6364
)
6465

6566
By("create VPA CRD on cluster")
@@ -141,6 +142,7 @@ var _ = Describe("Installing bundles with new object types", Label("ObjectTypes"
141142
pdbName = "busybox-pdb"
142143
priorityClassName = "super-priority"
143144
vpaName = "busybox-vpa"
145+
networkPolicyName = "busybox-networkpolicy"
144146
)
145147

146148
var resource = schema.GroupVersionResource{
@@ -164,6 +166,11 @@ var _ = Describe("Installing bundles with new object types", Label("ObjectTypes"
164166
_, err := kubeClient.KubernetesInterface().PolicyV1().PodDisruptionBudgets(generatedNamespace.GetName()).Get(context.Background(), pdbName, metav1.GetOptions{})
165167
return err
166168
}).Should(Succeed(), "expected no error getting pdb object associated with CSV")
169+
170+
Eventually(func() error {
171+
_, err := kubeClient.KubernetesInterface().NetworkingV1().NetworkPolicies(generatedNamespace.GetName()).Get(context.Background(), networkPolicyName, metav1.GetOptions{})
172+
return err
173+
}).Should(Succeed(), "expected no error finding networkpolicy object associated with CSV")
167174
})
168175

169176
AfterEach(func() {

staging/operator-lifecycle-manager/test/images/busybox-index/busybox/1.0.0/manifests/csv.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ spec:
3434
command:
3535
- sleep
3636
- "9000"
37+
permissions:
38+
- serviceAccountName: busybox-operator
39+
rules:
40+
- apiGroups: ["networking.k8s.io"]
41+
resources: ["networkpolicies"]
42+
verbs: ["get", "list", "create", "update", "delete"]
3743
strategy: deployment
3844
installModes:
3945
- supported: true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM scratch
2+
3+
# We are pushing an operator-registry bundle
4+
# that has both metadata and manifests.
5+
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
6+
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
7+
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
8+
LABEL operators.operatorframework.io.bundle.package.v1=busybox
9+
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
10+
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
11+
12+
COPY ./manifests/*.yaml /manifests/
13+
COPY ./metadata/annotations.yaml /metadata/annotations.yaml
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: ClusterServiceVersion
3+
metadata:
4+
name: busybox.v2.0.0
5+
namespace: operators
6+
spec:
7+
description: busybox
8+
displayName: busybox
9+
install:
10+
spec:
11+
deployments:
12+
- name: busybox
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
app: busybox
18+
template:
19+
metadata:
20+
labels:
21+
app: busybox
22+
spec:
23+
containers:
24+
- command:
25+
- sleep
26+
- "9000"
27+
image: busybox
28+
name: busybox
29+
strategy: deployment
30+
installModes:
31+
- supported: true
32+
type: OwnNamespace
33+
- supported: true
34+
type: SingleNamespace
35+
- supported: true
36+
type: MultiNamespace
37+
- supported: true
38+
type: AllNamespaces
39+
maturity: alpha
40+
provider:
41+
name: Red Hat
42+
version: 2.0.0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
name: busybox-networkpolicy
5+
spec:
6+
podSelector: {}
7+
policyTypes:
8+
- Ingress
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: policy/v1
2+
kind: PodDisruptionBudget
3+
metadata:
4+
name: busybox-pdb
5+
spec:
6+
minAvailable: 2
7+
selector:
8+
matchLabels:
9+
app: busybox
10+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: scheduling.k8s.io/v1
2+
kind: PriorityClass
3+
metadata:
4+
name: super-priority
5+
description: This priority class should be used for XYZ service pods only.
6+
globalDefault: false
7+
value: 1000

0 commit comments

Comments
 (0)