Skip to content

Commit

Permalink
Update installation/uninstallation docs (operator-framework#2784)
Browse files Browse the repository at this point in the history
* Fix spelling error

Changes "exmaple" to "example"

Signed-off-by: Noah Sapse <nsapse@gmail.com>

* 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 <nsapse@gmail.com>
  • Loading branch information
nsapse committed Jun 1, 2022
1 parent cbb6c3d commit c6fb3b3
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 165 deletions.
2 changes: 1 addition & 1 deletion doc/design/building-your-csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ The Lifecycle Manager will check against the available CRDs and Operators in the
description: Represents a cluster of etcd nodes.
```
## CRD Templates
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.
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.

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`:

Expand Down
8 changes: 5 additions & 3 deletions doc/install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ You can verify that the OLM components have been successfully deployed by runnin

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

## Install with `operator-sdk olm install`

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/)

## Customizing OLM installation

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

# Uninstall

Run the command `make uninstall`.

**NOTE** Valid just for local/manual installs.
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/)
6 changes: 3 additions & 3 deletions test/e2e/catalog_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ const (

var _ = Describe("Starting CatalogSource e2e tests", func() {
var (
ns corev1.Namespace
c operatorclient.ClientInterface
crc versioned.Interface
ns corev1.Namespace
)
BeforeEach(func() {
c = newKubeClient()
crc = newCRClient()
namespaceName := genName("catsrc-e2e-")
og := operatorsv1.OperatorGroup{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -62,6 +60,8 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
},
}
ns = SetupGeneratedTestNamespaceWithOperatorGroup(namespaceName, og)
c = ctx.Ctx().KubeClient()
crc = ctx.Ctx().OperatorClient()
})

AfterEach(func() {
Expand Down
15 changes: 6 additions & 9 deletions test/e2e/crd_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
"github.com/operator-framework/operator-lifecycle-manager/test/e2e/ctx"
corev1 "k8s.io/api/core/v1"

Expand All @@ -20,12 +22,15 @@ import (
)

var _ = Describe("CRD Versions", func() {

var (
ns corev1.Namespace
c operatorclient.ClientInterface
crc versioned.Interface
)

BeforeEach(func() {
c = ctx.Ctx().KubeClient()
crc = ctx.Ctx().OperatorClient()
ns = SetupGeneratedTestNamespace(genName("crd-e2e-"))
})

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

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

c := newKubeClient()
crc := newCRClient()

mainPackageName := genName("nginx-update2-")
mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName)
stableChannel := "stable"
Expand Down Expand Up @@ -301,9 +301,6 @@ var _ = Describe("CRD Versions", func() {
It("allows a CRD upgrade that doesn't cause data loss", func() {
By("manually editing the storage versions in the existing CRD status")

c := newKubeClient()
crc := newCRClient()

crdPlural := genName("ins-v1-")
crdName := crdPlural + ".cluster.com"
crdGroup := "cluster.com"
Expand Down
24 changes: 10 additions & 14 deletions test/e2e/csv_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ var _ = Describe("ClusterServiceVersion", func() {
)

BeforeEach(func() {
c = newKubeClient()
crc = newCRClient()
c = ctx.Ctx().KubeClient()
crc = ctx.Ctx().OperatorClient()
})

AfterEach(func() {
Expand Down Expand Up @@ -3966,7 +3966,7 @@ var _ = Describe("ClusterServiceVersion", func() {
csv.SetName("csv-hat-1")
csv.SetNamespace(ns.GetName())

createLegacyAPIResources(ns.GetName(), &csv, owned[0])
createLegacyAPIResources(ns.GetName(), &csv, owned[0], c)

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

checkLegacyAPIResources(ns.GetName(), owned[0], true)
checkLegacyAPIResources(ns.GetName(), owned[0], true, c)
})

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

createLegacyAPIResources(ns.GetName(), nil, owned[0])
createLegacyAPIResources(ns.GetName(), nil, owned[0], c)

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

checkLegacyAPIResources(ns.GetName(), owned[0], false)
checkLegacyAPIResources(ns.GetName(), owned[0], false, c)

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

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

func deleteLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServiceDescription) {
c := newKubeClient()

func deleteLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServiceDescription, c operatorclient.ClientInterface) {
apiServiceName := fmt.Sprintf("%s.%s", desc.Version, desc.Group)

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

func createLegacyAPIResources(namespace string, csv *operatorsv1alpha1.ClusterServiceVersion, desc operatorsv1alpha1.APIServiceDescription) {
c := newKubeClient()
func createLegacyAPIResources(namespace string, csv *operatorsv1alpha1.ClusterServiceVersion, desc operatorsv1alpha1.APIServiceDescription, c operatorclient.ClientInterface) {

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

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

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

// Attempt to create the legacy service
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/dynamic_resource_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ var _ = Describe("Subscriptions create required objects from Catalogs", func() {
)

BeforeEach(func() {
c = newKubeClient()
crc = newCRClient()
c = ctx.Ctx().KubeClient()
crc = ctx.Ctx().OperatorClient()
dynamicClient = ctx.Ctx().DynamicClient()

deleteOpts = &metav1.DeleteOptions{}
Expand Down
51 changes: 7 additions & 44 deletions test/e2e/installplan_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ import (

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

var ns corev1.Namespace
var (
c operatorclient.ClientInterface
crc versioned.Interface
ns corev1.Namespace
)

BeforeEach(func() {
namespaceName := genName("install-plan-e2e-")
Expand All @@ -63,6 +67,8 @@ var _ = Describe("Install Plan", func() {
},
}
ns = SetupGeneratedTestNamespaceWithOperatorGroup(namespaceName, og)
c = ctx.Ctx().KubeClient()
crc = ctx.Ctx().OperatorClient()
})

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

c := newKubeClient()
crc := newCRClient()
defer func() {
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
}()
Expand Down Expand Up @@ -894,8 +898,6 @@ var _ = Describe("Install Plan", func() {
}).Should(Succeed())
}()

c := newKubeClient()
crc := newCRClient()
defer func() {
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
}()
Expand Down Expand Up @@ -1310,9 +1312,6 @@ var _ = Describe("Install Plan", func() {
}
}()

c := newKubeClient()
crc := newCRClient()

// Existing custom resource
existingCR := &unstructured.Unstructured{
Object: map[string]interface{}{
Expand Down Expand Up @@ -1569,9 +1568,6 @@ var _ = Describe("Install Plan", func() {
}
}()

c := newKubeClient()
crc := newCRClient()

// Defer crd clean up
defer func() {
Expect(client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), tt.newCRD))).To(Succeed())
Expand Down Expand Up @@ -1708,8 +1704,6 @@ var _ = Describe("Install Plan", func() {
}
It("AmplifyPermissions", func() {

c := newKubeClient()
crc := newCRClient()
defer func() {
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
}()
Expand Down Expand Up @@ -1897,8 +1891,6 @@ var _ = Describe("Install Plan", func() {
})
It("AttenuatePermissions", func() {

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

It("StopOnCSVModifications", func() {

c := newKubeClient()
crc := newCRClient()
defer func() {
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(ns.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{}))
}()
Expand Down Expand Up @@ -2438,8 +2428,6 @@ var _ = Describe("Install Plan", func() {
}).Should(Succeed())
}()

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

It("UpdatePreexistingCRDFailed", func() {

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

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

// Create the CatalogSource
c := newKubeClient()
crc := newCRClient()

catalogSourceName := genName("mock-nginx-")
_, cleanupCatalogSource := createInternalCatalogSource(c, crc, catalogSourceName, ns.GetName(), manifests, []apiextensions.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csv})
defer cleanupCatalogSource()
Expand Down Expand Up @@ -3080,10 +3061,6 @@ var _ = Describe("Install Plan", func() {
})

It("unpacks bundle image", func() {

c := newKubeClient()
crc := newCRClient()

ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: genName("ns-"),
Expand Down Expand Up @@ -3183,9 +3160,6 @@ var _ = Describe("Install Plan", func() {
ns := &corev1.Namespace{}
ns.SetName(genName("ns-"))

c := newKubeClient()
crc := newCRClient()

// Create a namespace an OperatorGroup
ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), ns, metav1.CreateOptions{})
require.NoError(GinkgoT(), err)
Expand Down Expand Up @@ -3327,14 +3301,10 @@ var _ = Describe("Install Plan", func() {
When("an InstallPlan is created with no valid OperatorGroup present", func() {

var (
c operatorclient.ClientInterface
crc versioned.Interface
installPlanName string
ns *corev1.Namespace
)
BeforeEach(func() {
c = newKubeClient()
crc = newCRClient()

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

c := newKubeClient()
crc := newCRClient()

ns, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: genName("ns-"),
Expand Down Expand Up @@ -3723,8 +3690,6 @@ var _ = Describe("Install Plan", func() {
})

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

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

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

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

0 comments on commit c6fb3b3

Please sign in to comment.