Skip to content

Commit c77b695

Browse files
committed
Update installation/uninstallation docs (operator-framework#2784)
* Fix spelling error Changes "exmaple" to "example" Signed-off-by: Noah Sapse <[email protected]> * Updates Installation/Uninstallation Documents - Closes operator-framework#2662 - Updates installation document to include `operator-sdk olm install` as an install method - Updates installation document to include `operator-sdk olm uninstall` as an uninstall method Signed-off-by: Noah Sapse <[email protected]>
1 parent cbb6c3d commit c77b695

16 files changed

+103
-164
lines changed

doc/design/building-your-csv.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ The Lifecycle Manager will check against the available CRDs and Operators in the
169169
description: Represents a cluster of etcd nodes.
170170
```
171171
## CRD Templates
172-
Users of your Operator will need to be aware of which options are required vs optional. You can provide templates for each of your CRDs with a minimum set of configuration as an annotation named `alm-examples`. Metadata for each template, for exmaple an expanded description, can be included in an annotation named `alm-examples-metadata`, which should be a hash indexed with the `metadata.name` of the example in the `alm-examples` list. Compatible UIs will pre-enter the `alm-examples` template for users to further customize, and use the `alm-examples-metadata` to help users decide which template to select.
172+
Users of your Operator will need to be aware of which options are required vs optional. You can provide templates for each of your CRDs with a minimum set of configuration as an annotation named `alm-examples`. Metadata for each template, for example an expanded description, can be included in an annotation named `alm-examples-metadata`, which should be a hash indexed with the `metadata.name` of the example in the `alm-examples` list. Compatible UIs will pre-enter the `alm-examples` template for users to further customize, and use the `alm-examples-metadata` to help users decide which template to select.
173173

174174
The annotation consists of a list of the `kind`, eg. the CRD name, and the corresponding `metadata` and `spec` of the Kubernetes object. Here’s a full example that provides templates for `EtcdCluster`, `EtcdBackup` and `EtcdRestore`:
175175

doc/install/install.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ You can verify that the OLM components have been successfully deployed by runnin
3333

3434
**IMPORTANT:** OLM is installed by default in OpenShift 4.0 and above.
3535

36+
## Install with `operator-sdk olm install`
37+
38+
OLM can be installed with the operator-sdk command `operator-sdk olm install` more information is available in the [operator-sdk documentation.](https://sdk.operatorframework.io/docs/cli/operator-sdk_olm_install/)
39+
3640
## Customizing OLM installation
3741

3842
Deployments of OLM can be stamped out with different configurations by writing a `values.yaml` file and running commands to generate resources.
@@ -130,6 +134,4 @@ spec:
130134

131135
# Uninstall
132136

133-
Run the command `make uninstall`.
134-
135-
**NOTE** Valid just for local/manual installs.
137+
OLM can be uninstalled with the `operator-sdk olm uninstall` command. More information is available in the [operator-sdk documentation](https://sdk.operatorframework.io/docs/cli/operator-sdk_olm_uninstall/)

test/e2e/catalog_e2e_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,11 @@ const (
4747

4848
var _ = Describe("Starting CatalogSource e2e tests", func() {
4949
var (
50+
ns corev1.Namespace
5051
c operatorclient.ClientInterface
5152
crc versioned.Interface
52-
ns corev1.Namespace
5353
)
5454
BeforeEach(func() {
55-
c = newKubeClient()
56-
crc = newCRClient()
5755
namespaceName := genName("catsrc-e2e-")
5856
og := operatorsv1.OperatorGroup{
5957
ObjectMeta: metav1.ObjectMeta{
@@ -62,6 +60,8 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
6260
},
6361
}
6462
ns = SetupGeneratedTestNamespaceWithOperatorGroup(namespaceName, og)
63+
c = ctx.Ctx().KubeClient()
64+
crc = ctx.Ctx().OperatorClient()
6565
})
6666

6767
AfterEach(func() {

test/e2e/crd_e2e_test.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import (
99
. "github.com/onsi/ginkgo/v2"
1010
. "github.com/onsi/gomega"
1111
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
12+
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
1213
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"
14+
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
1315
"github.com/operator-framework/operator-lifecycle-manager/test/e2e/ctx"
1416
corev1 "k8s.io/api/core/v1"
1517

@@ -20,12 +22,15 @@ import (
2022
)
2123

2224
var _ = Describe("CRD Versions", func() {
23-
2425
var (
2526
ns corev1.Namespace
27+
c operatorclient.ClientInterface
28+
crc versioned.Interface
2629
)
2730

2831
BeforeEach(func() {
32+
c = ctx.Ctx().KubeClient()
33+
crc = ctx.Ctx().OperatorClient()
2934
ns = SetupGeneratedTestNamespace(genName("crd-e2e-"))
3035
})
3136

@@ -36,8 +41,6 @@ var _ = Describe("CRD Versions", func() {
3641
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2640
3742
It("[FLAKE] creates v1 CRDs with a v1 schema successfully", func() {
3843
By("v1 crds with a valid openapiv3 schema should be created successfully by OLM")
39-
c := newKubeClient()
40-
crc := newCRClient()
4144

4245
mainPackageName := genName("nginx-update2-")
4346
mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName)
@@ -115,9 +118,6 @@ var _ = Describe("CRD Versions", func() {
115118
It("[FLAKE] blocks a CRD upgrade that could cause data loss", func() {
116119
By("checking the storage versions in the existing CRD status and the spec of the new CRD")
117120

118-
c := newKubeClient()
119-
crc := newCRClient()
120-
121121
mainPackageName := genName("nginx-update2-")
122122
mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName)
123123
stableChannel := "stable"
@@ -301,9 +301,6 @@ var _ = Describe("CRD Versions", func() {
301301
It("allows a CRD upgrade that doesn't cause data loss", func() {
302302
By("manually editing the storage versions in the existing CRD status")
303303

304-
c := newKubeClient()
305-
crc := newCRClient()
306-
307304
crdPlural := genName("ins-v1-")
308305
crdName := crdPlural + ".cluster.com"
309306
crdGroup := "cluster.com"

test/e2e/csv_e2e_test.go

+10-14
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ var _ = Describe("ClusterServiceVersion", func() {
4444
)
4545

4646
BeforeEach(func() {
47-
c = newKubeClient()
48-
crc = newCRClient()
47+
c = ctx.Ctx().KubeClient()
48+
crc = ctx.Ctx().OperatorClient()
4949
})
5050

5151
AfterEach(func() {
@@ -3966,7 +3966,7 @@ var _ = Describe("ClusterServiceVersion", func() {
39663966
csv.SetName("csv-hat-1")
39673967
csv.SetNamespace(ns.GetName())
39683968

3969-
createLegacyAPIResources(ns.GetName(), &csv, owned[0])
3969+
createLegacyAPIResources(ns.GetName(), &csv, owned[0], c)
39703970

39713971
// Create the APIService CSV
39723972
cleanupCSV, err := createCSV(c, crc, csv, ns.GetName(), false, false)
@@ -3976,7 +3976,7 @@ var _ = Describe("ClusterServiceVersion", func() {
39763976
_, err = fetchCSV(crc, csv.Name, ns.GetName(), csvSucceededChecker)
39773977
Expect(err).ShouldNot(HaveOccurred())
39783978

3979-
checkLegacyAPIResources(ns.GetName(), owned[0], true)
3979+
checkLegacyAPIResources(ns.GetName(), owned[0], true, c)
39803980
})
39813981

39823982
It("API service resource not migrated if not adoptable", func() {
@@ -4046,7 +4046,7 @@ var _ = Describe("ClusterServiceVersion", func() {
40464046
csv.SetName("csv-hat-1")
40474047
csv.SetNamespace(ns.GetName())
40484048

4049-
createLegacyAPIResources(ns.GetName(), nil, owned[0])
4049+
createLegacyAPIResources(ns.GetName(), nil, owned[0], c)
40504050

40514051
// Create the APIService CSV
40524052
cleanupCSV, err := createCSV(c, crc, csv, ns.GetName(), false, false)
@@ -4056,10 +4056,10 @@ var _ = Describe("ClusterServiceVersion", func() {
40564056
_, err = fetchCSV(crc, csv.Name, ns.GetName(), csvSucceededChecker)
40574057
Expect(err).ShouldNot(HaveOccurred())
40584058

4059-
checkLegacyAPIResources(ns.GetName(), owned[0], false)
4059+
checkLegacyAPIResources(ns.GetName(), owned[0], false, c)
40604060

40614061
// Cleanup the resources created for this test that were not cleaned up.
4062-
deleteLegacyAPIResources(ns.GetName(), owned[0])
4062+
deleteLegacyAPIResources(ns.GetName(), owned[0], c)
40634063
})
40644064

40654065
It("multiple API services on a single pod", func() {
@@ -4510,9 +4510,7 @@ func csvExists(namespace string, c versioned.Interface, name string) bool {
45104510
return true
45114511
}
45124512

4513-
func deleteLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServiceDescription) {
4514-
c := newKubeClient()
4515-
4513+
func deleteLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServiceDescription, c operatorclient.ClientInterface) {
45164514
apiServiceName := fmt.Sprintf("%s.%s", desc.Version, desc.Group)
45174515

45184516
err := c.DeleteService(namespace, strings.Replace(apiServiceName, ".", "-", -1), &metav1.DeleteOptions{})
@@ -4534,8 +4532,7 @@ func deleteLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServic
45344532
Expect(err).ShouldNot(HaveOccurred())
45354533
}
45364534

4537-
func createLegacyAPIResources(namespace string, csv *operatorsv1alpha1.ClusterServiceVersion, desc operatorsv1alpha1.APIServiceDescription) {
4538-
c := newKubeClient()
4535+
func createLegacyAPIResources(namespace string, csv *operatorsv1alpha1.ClusterServiceVersion, desc operatorsv1alpha1.APIServiceDescription, c operatorclient.ClientInterface) {
45394536

45404537
apiServiceName := fmt.Sprintf("%s.%s", desc.Version, desc.Group)
45414538

@@ -4621,8 +4618,7 @@ func createLegacyAPIResources(namespace string, csv *operatorsv1alpha1.ClusterSe
46214618
Expect(err).ShouldNot(HaveOccurred())
46224619
}
46234620

4624-
func checkLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServiceDescription, expectedIsNotFound bool) {
4625-
c := newKubeClient()
4621+
func checkLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServiceDescription, expectedIsNotFound bool, c operatorclient.ClientInterface) {
46264622
apiServiceName := fmt.Sprintf("%s.%s", desc.Version, desc.Group)
46274623

46284624
// Attempt to create the legacy service

test/e2e/dynamic_resource_e2e_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ var _ = Describe("Subscriptions create required objects from Catalogs", func() {
2828
)
2929

3030
BeforeEach(func() {
31-
c = newKubeClient()
32-
crc = newCRClient()
31+
c = ctx.Ctx().KubeClient()
32+
crc = ctx.Ctx().OperatorClient()
3333
dynamicClient = ctx.Ctx().DynamicClient()
3434

3535
deleteOpts = &metav1.DeleteOptions{}

test/e2e/installplan_e2e_test.go

+7-44
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ import (
5252

5353
var _ = Describe("Install Plan", func() {
5454

55-
var ns corev1.Namespace
55+
var (
56+
c operatorclient.ClientInterface
57+
crc versioned.Interface
58+
ns corev1.Namespace
59+
)
5660

5761
BeforeEach(func() {
5862
namespaceName := genName("install-plan-e2e-")
@@ -63,6 +67,8 @@ var _ = Describe("Install Plan", func() {
6367
},
6468
}
6569
ns = SetupGeneratedTestNamespaceWithOperatorGroup(namespaceName, og)
70+
c = ctx.Ctx().KubeClient()
71+
crc = ctx.Ctx().OperatorClient()
6672
})
6773

6874
AfterEach(func() {
@@ -688,8 +694,6 @@ var _ = Describe("Install Plan", func() {
688694
mainCSV := newCSV(mainPackageStable, ns.GetName(), "", semver.MustParse("0.1.0"), nil, []apiextensions.CustomResourceDefinition{dependentCRD}, nil)
689695
dependentCSV := newCSV(dependentPackageStable, ns.GetName(), "", semver.MustParse("0.1.0"), []apiextensions.CustomResourceDefinition{dependentCRD}, nil, nil)
690696

691-
c := newKubeClient()
692-
crc := newCRClient()
693697
defer func() {
694698
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
695699
}()
@@ -894,8 +898,6 @@ var _ = Describe("Install Plan", func() {
894898
}).Should(Succeed())
895899
}()
896900

897-
c := newKubeClient()
898-
crc := newCRClient()
899901
defer func() {
900902
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
901903
}()
@@ -1310,9 +1312,6 @@ var _ = Describe("Install Plan", func() {
13101312
}
13111313
}()
13121314

1313-
c := newKubeClient()
1314-
crc := newCRClient()
1315-
13161315
// Existing custom resource
13171316
existingCR := &unstructured.Unstructured{
13181317
Object: map[string]interface{}{
@@ -1569,9 +1568,6 @@ var _ = Describe("Install Plan", func() {
15691568
}
15701569
}()
15711570

1572-
c := newKubeClient()
1573-
crc := newCRClient()
1574-
15751571
// Defer crd clean up
15761572
defer func() {
15771573
Expect(client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), tt.newCRD))).To(Succeed())
@@ -1708,8 +1704,6 @@ var _ = Describe("Install Plan", func() {
17081704
}
17091705
It("AmplifyPermissions", func() {
17101706

1711-
c := newKubeClient()
1712-
crc := newCRClient()
17131707
defer func() {
17141708
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
17151709
}()
@@ -1897,8 +1891,6 @@ var _ = Describe("Install Plan", func() {
18971891
})
18981892
It("AttenuatePermissions", func() {
18991893

1900-
c := newKubeClient()
1901-
crc := newCRClient()
19021894
defer func() {
19031895
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
19041896
}()
@@ -2124,8 +2116,6 @@ var _ = Describe("Install Plan", func() {
21242116

21252117
It("StopOnCSVModifications", func() {
21262118

2127-
c := newKubeClient()
2128-
crc := newCRClient()
21292119
defer func() {
21302120
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
21312121
}()
@@ -2438,8 +2428,6 @@ var _ = Describe("Install Plan", func() {
24382428
}).Should(Succeed())
24392429
}()
24402430

2441-
c := newKubeClient()
2442-
crc := newCRClient()
24432431
defer func() {
24442432
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
24452433
}()
@@ -2545,8 +2533,6 @@ var _ = Describe("Install Plan", func() {
25452533

25462534
It("UpdatePreexistingCRDFailed", func() {
25472535

2548-
c := newKubeClient()
2549-
crc := newCRClient()
25502536
defer func() {
25512537
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
25522538
}()
@@ -2795,8 +2781,6 @@ var _ = Describe("Install Plan", func() {
27952781
// Create new CSVs
27962782
stableCSV := newCSV(stableCSVName, ns.GetName(), "", semver.MustParse("0.1.0"), []apiextensions.CustomResourceDefinition{crd}, nil, &namedStrategy)
27972783

2798-
c := newKubeClient()
2799-
crc := newCRClient()
28002784
defer func() {
28012785
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
28022786
}()
@@ -3050,9 +3034,6 @@ var _ = Describe("Install Plan", func() {
30503034
}
30513035

30523036
// Create the CatalogSource
3053-
c := newKubeClient()
3054-
crc := newCRClient()
3055-
30563037
catalogSourceName := genName("mock-nginx-")
30573038
_, cleanupCatalogSource := createInternalCatalogSource(c, crc, catalogSourceName, ns.GetName(), manifests, []apiextensions.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csv})
30583039
defer cleanupCatalogSource()
@@ -3080,10 +3061,6 @@ var _ = Describe("Install Plan", func() {
30803061
})
30813062

30823063
It("unpacks bundle image", func() {
3083-
3084-
c := newKubeClient()
3085-
crc := newCRClient()
3086-
30873064
ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{
30883065
ObjectMeta: metav1.ObjectMeta{
30893066
Name: genName("ns-"),
@@ -3183,9 +3160,6 @@ var _ = Describe("Install Plan", func() {
31833160
ns := &corev1.Namespace{}
31843161
ns.SetName(genName("ns-"))
31853162

3186-
c := newKubeClient()
3187-
crc := newCRClient()
3188-
31893163
// Create a namespace an OperatorGroup
31903164
ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), ns, metav1.CreateOptions{})
31913165
require.NoError(GinkgoT(), err)
@@ -3327,14 +3301,10 @@ var _ = Describe("Install Plan", func() {
33273301
When("an InstallPlan is created with no valid OperatorGroup present", func() {
33283302

33293303
var (
3330-
c operatorclient.ClientInterface
3331-
crc versioned.Interface
33323304
installPlanName string
33333305
ns *corev1.Namespace
33343306
)
33353307
BeforeEach(func() {
3336-
c = newKubeClient()
3337-
crc = newCRClient()
33383308

33393309
ns = &corev1.Namespace{}
33403310
ns.SetName(genName("ns-"))
@@ -3637,9 +3607,6 @@ var _ = Describe("Install Plan", func() {
36373607
// Test ensures that all steps for index-based catalogs are references to configmaps. This avoids the problem
36383608
// of installplans growing beyond the etcd size limit when manifests are written to the ip status.
36393609

3640-
c := newKubeClient()
3641-
crc := newCRClient()
3642-
36433610
ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{
36443611
ObjectMeta: metav1.ObjectMeta{
36453612
Name: genName("ns-"),
@@ -3723,8 +3690,6 @@ var _ = Describe("Install Plan", func() {
37233690
})
37243691

37253692
It("limits installed resources if the scoped serviceaccount has no permissions", func() {
3726-
c := newKubeClient()
3727-
crc := newCRClient()
37283693

37293694
By("creating a scoped serviceaccount specified in the operatorgroup")
37303695
ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{
@@ -3966,8 +3931,6 @@ var _ = Describe("Install Plan", func() {
39663931
})
39673932

39683933
It("uses the correct client when installing resources from an installplan", func() {
3969-
c := newKubeClient()
3970-
crc := newCRClient()
39713934

39723935
By("creating a scoped serviceaccount specifified in the operatorgroup")
39733936
ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{

0 commit comments

Comments
 (0)