diff --git a/README.md b/README.md index ee3d32d..5c25eed 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # Getting Started - - - - - [Overview](#overview) - [Build an operator using the Operator SDK](#build-an-operator-using-the-operator-sdk) - [Create a new project](#create-a-new-project) @@ -22,13 +18,10 @@ - [Reference implementation](#reference-implementation) - [Manage the operator using the Operator Lifecycle Manager](#manage-the-operator-using-the-operator-lifecycle-manager) - [Generate an operator manifest](#generate-an-operator-manifest) - - [Deploy the Operator](#deploy-the-operator) - - [Create an application instance](#create-an-application-instance) - - [Update an application](#update-an-application) + - [Testing locally](#testing-locally) + - [Promoting operator standards](#promoting-operator-standards) - [Conclusion](#conclusion) - - ## Overview The [Operator Framework][org_operator_framework] ([intro blog post][site_blog_post]) is an open source toolkit to manage Kubernetes native applications, called operators, in an effective, automated, and scalable way. Operators take advantage of Kubernetes's extensibility to deliver the automation advantages of cloud services like provisioning, scaling, and backup/restore while being able to run anywhere that Kubernetes can run. @@ -416,107 +409,42 @@ The above walkthrough follows the actual implementation process used to produce ## Manage the operator using the Operator Lifecycle Manager +> NOTE: This section of the Getting Started Guide is out-of-date. +> We're working on some improvements to Operator SDK to streamline +> the experience of using OLM. For further information see, for example, this enhancement [proposal][sdk-integration-with-olm-doc]. +> In the meantime, you might find the following documentation helpful: + The previous section has covered manually running an operator. In the next sections, we will explore using the [Operator Lifecycle Manager][operator_lifecycle_manager] (OLM) which is what enables a more robust deployment model for operators being run in production environments. OLM helps you to install, update, and generally manage the lifecycle of all of the operators (and their associated services) on a Kubernetes cluster. It runs as an Kubernetes extension and lets you use `kubectl` for all the lifecycle management functions without any additional tools. +**NOTE:** Various public, OLM-ready operator projects are available at [operatorhub.io][operator-hub-io]. + ### Generate an operator manifest The first step to leveraging OLM is to create a [Cluster Service Version][csv_design_doc] (CSV) manifest. An operator manifest describes how to display, create and manage the application, in this case memcached, as a whole. It is required for OLM to function. The Operator SDK CLI can generate CSV manifests via the following command: -```console -$ operator-sdk olm-catalog gen-csv --csv-version 0.0.1 -``` -For more details see the SDK's [CSV generation doc][csv_generation_doc]. -For the purpose of this guide, we will continue with this [predefined manifest][manifest_v1] file for the next steps. If you’d like, you can alter the image field within this manifest to reflect the image you built in previous steps, but it is unnecessary. - -### Deploy the Operator - -Deploying an operator is as simple as applying the operator’s CSV manifest to the desired namespace in the cluster. - -First we need to create an [OperatorGroup][operator_group_doc] that specifies the namespaces that the operator will be targeting. Create the following OperatorGroup in the namespace where you will create the CSV. In this example the `default` namespace is used. - -```YAML -apiVersion: operators.coreos.com/v1alpha2 -kind: OperatorGroup -metadata: - name: memcached-operator-group - namespace: default -spec: - targetNamespaces: - - default -``` - -Next create the CSV. - -```sh -$ curl -Lo memcachedoperator.0.0.1.csv.yaml https://raw.githubusercontent.com/operator-framework/getting-started/master/memcachedoperator.0.0.1.csv.yaml -$ kubectl apply -f memcachedoperator.0.0.1.csv.yaml -$ kubectl get ClusterServiceVersion memcachedoperator.v0.0.1 -o json | jq '.status' -``` - -After applying this manifest, nothing has happened yet, because the cluster does not meet the requirements specified in our manifest. Create the CustomResourceDefinition and RBAC rules for the `Memcached` type managed by the operator: - -```sh -$ kubectl create -f deploy/crds/cache_v1alpha1_memcached_crd.yaml -$ kubectl create -f deploy/service_account.yaml -$ kubectl create -f deploy/role.yaml -$ kubectl create -f deploy/role_binding.yaml +```console +$ operator-sdk olm-catalog gen-csv --csv-version 0.0.1 --update-crds ``` -Because OLM creates operators in a particular namespace when a manifest has been applied, administrators can leverage the native Kubernetes RBAC permission model to restrict which users are allowed to install operators. +Several fields must be updated after generating the CSV. See the CSV generation doc for a list of [required fields][csv-fields], and the memcached-operator [CSV][memcached_csv] for an example of a complete CSV. -### Create an application instance +**NOTE:** You are able to preview and validate your CSV manifest syntax in the [operatorhub.io CSV Preview][operator-hub-io-preview] tool. -The memcached operator is now running in the `memcached` namespace. Users interact with operators via instances of CustomResources; in this case, the resource has the Kind `Memcached`. Native Kubernetes RBAC also applies to CustomResources, providing administrators control over who can interact with each operator. +### Testing locally -Creating instances of memcached in this namespace will now trigger the memcached operator to instantiate pods running the memcached server that are managed by the operator. The more CustomResources you create, the more unique instances of memcached will be managed by the memcached operator running in this namespace. - -```sh -$ cat <