File tree Expand file tree Collapse file tree 4 files changed +307
-22
lines changed
Expand file tree Collapse file tree 4 files changed +307
-22
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ Feature: Install ClusterExtension
3030 Then ClusterExtension is rolled out
3131 And ClusterExtension is available
3232 And bundle "test-operator.1.2.0" is installed in version "1.2.0"
33- And resource "networkpolicy/test-operator-network-policy" is installed
34- And resource "configmap/test-configmap" is installed
35- And resource "deployment/test-operator" is installed
33+ And ClusterExtension resources are created and labeled
3634
3735 @mirrored-registry
3836 Scenario Outline : Install latest available version from mirrored registry
@@ -57,9 +55,7 @@ Feature: Install ClusterExtension
5755 Then ClusterExtension is rolled out
5856 And ClusterExtension is available
5957 And bundle "<package-name>-operator.1.2.0" is installed in version "1.2.0"
60- And resource "networkpolicy/test-operator-network-policy" is installed
61- And resource "configmap/test-configmap" is installed
62- And resource "deployment/test-operator" is installed
58+ And ClusterExtension resources are created and labeled
6359
6460 Examples :
6561 | package -name |
Original file line number Diff line number Diff line change 1+ Feature : Uninstall ClusterExtension
2+
3+ As an OLM user I would like to uninstall a cluster extension,
4+ removing all resources previously installed/updated through the extension.
5+
6+ Background :
7+ Given OLM is available
8+ And ClusterCatalog "test" serves bundles
9+ And ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
10+ And ClusterExtension is applied
11+ """
12+ apiVersion: olm.operatorframework.io/v1
13+ kind: ClusterExtension
14+ metadata:
15+ name: ${NAME}
16+ spec:
17+ namespace: ${TEST_NAMESPACE}
18+ serviceAccount:
19+ name: olm-sa
20+ source:
21+ sourceType: Catalog
22+ catalog:
23+ packageName: test
24+ selector:
25+ matchLabels:
26+ "olm.operatorframework.io/metadata.name": test-catalog
27+ """
28+ And bundle "test-operator.1.2.0" is installed in version "1.2.0"
29+ And ClusterExtension is rolled out
30+
31+ Scenario : Removing ClusterExtension triggers the extension uninstall, eventually removing all installed resources
32+ When ClusterExtension is removed
33+ Then ClusterExtension is uninstalled
34+
35+ Scenario : Removing ClusterExtension resources leads to all installed resources being removed even if the service account is no longer present
36+ When resource "serviceaccount/olm-sa" is removed
37+ # Ensure service account is gone before checking to ensure resources are cleaned up whether the service account
38+ # and its permissions are present on the cluster or not
39+ And resource "serviceaccount/olm-sa" is eventually not found
40+ And ClusterExtension is removed
41+ Then ClusterExtension is uninstalled
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
1616 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1717 "k8s.io/component-base/featuregate"
1818 "k8s.io/klog/v2/textlogger"
19+ "sigs.k8s.io/controller-runtime/pkg/client"
1920
2021 "github.com/operator-framework/operator-controller/internal/operator-controller/features"
2122)
@@ -32,6 +33,9 @@ type scenarioContext struct {
3233 removedResources []unstructured.Unstructured
3334 backGroundCmds []* exec.Cmd
3435 metricsResponse map [string ]string
36+
37+ // set by ClusterExtensionIsRolledOut
38+ extensionObjects []client.Object
3539}
3640
3741type contextKey string
You can’t perform that action at this time.
0 commit comments