You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 21, 2020. It is now read-only.
-[Manage the operator using the Operator Lifecycle Manager](#manage-the-operator-using-the-operator-lifecycle-manager)
24
+
-[Generate an operator manifest](#generate-an-operator-manifest)
25
+
-[Deploy the Operator](#deploy-the-operator)
26
+
-[Create an application instance](#create-an-application-instance)
27
+
-[Update an application](#update-an-application)
28
+
-[Conclusion](#conclusion)
29
+
30
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
31
+
32
+
## Overview
33
+
3
34
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.
4
35
5
36
This guide shows how to build a simple [memcached][site_memcached] operator and how to manage its lifecycle from install to update to a new version. For that, we will use two center pieces of the framework:
@@ -17,28 +48,22 @@ This section walks through an example of building a simple memcached operator us
17
48
18
49
### Create a new project
19
50
20
-
Use the CLI to create a new `memcached-operator` project:
51
+
1.Use the CLI to create a new `memcached-operator` project:
The above command will replace the string `REPLACE_IMAGE` with the `<image>:<tag>` built above. Afterwards, verify that your `operator.yaml` file was updated successfully.
210
+
211
+
```yaml
212
+
serviceAccountName: memcached-operator
213
+
containers:
214
+
- name: memcached-operator
215
+
# Replace this with the built image name
216
+
image: quay.io/<user>/memcached-operator:v0.0.1
217
+
command:
218
+
- memcached-operator
219
+
imagePullPolicy: Always
174
220
```
175
221
222
+
**IMPORTANT:** Ensure that your cluster is able to pull the image pushed to your registry.
223
+
176
224
The Deployment manifest is generated at `deploy/operator.yaml`. Be sure to update the deployment image as shown above since the default is just a placeholder.
{"level":"info","ts":1567613604.0514739,"logger":"metrics","msg":"Metrics Service object created","Service.Name":"memcached-operator-metrics","Service.Namespace":"myproject"}
269
+
{"level":"info","ts":1567613604.0976534,"logger":"cmd","msg":"Could not create ServiceMonitor object","error":"no ServiceMonitor registered with the API"}
270
+
{"level":"info","ts":1567613604.0986068,"logger":"cmd","msg":"Install prometheus-operator in your cluster to create ServiceMonitor objects","error":"no ServiceMonitor registered with the API"}
271
+
{"level":"info","ts":1567613604.0988326,"logger":"cmd","msg":"Starting the Cmd."}
Error from server (BadRequest): container "memcached-operator" in pod "memcached-operator-6b5dc697fb-t62cv" is waiting to start: image can't be pulled
289
+
```
290
+
291
+
**NOTE:** Just for tests purposes make the image public and setting up the cluster to allow use insecure registry. ( E.g `--insecure-registry 172.30.0.0/16` )
292
+
195
293
### 2. Run locally outside the cluster
196
294
197
295
This method is preferred during development cycle to deploy and test faster.
Ensure that the memcached-operator creates the deployment for the CR:
332
+
Ensure that the `memcached-operator` creates the deployment for the CR:
235
333
236
334
```sh
237
335
$ kubectl get deployment
@@ -320,8 +418,6 @@ The previous section has covered manually running an operator. In the next secti
320
418
321
419
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.
322
420
323
-
324
-
325
421
### Generate an operator manifest
326
422
327
423
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.
For more details see the SDK's [CSV generation doc][csv_generation_doc].
334
430
335
-
336
431
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.
0 commit comments