Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
README updated to add certmanager installation step (#133)
Browse files Browse the repository at this point in the history
* README updated to add certmanager installation step
  • Loading branch information
bharathi-tenneti authored Jul 8, 2020
1 parent 3b4c749 commit 51a3b63
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
41 changes: 36 additions & 5 deletions go/kubebuilder/memcached-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,44 @@ Run the following command
```
$ go mod tidy
```
***NOTE*** As this example showcases validation webhook creation, please follow [this][certmanager] guide to install cert-mamager into cluster prior to deployment.

### Building the operator

Build the Memcached operator image and push it to a public registry, such as quay.io:

```
$ make install
```shell
$ export IMG=quay.io/example-inc/memcached-operator:v0.0.1
$ make docker-build $IMG
$ docker push $IMG
$ make deploy $IMG
$ make docker-build docker-push IMG=$IMG
```

**NOTE** The `quay.io/example-inc/memcached-operator:v0.0.1` is an example. You should build and push the image for your repository.

### Instaling Operator API

Install the CRDs into the cluster:

```shell
$ make install
```
### Deploying your operator

Deploy the Memcached Operator to the cluster with image specified by IMG

```shell
$ make deploy IMG=$IMG
```

### Create memcached-sample instances.

```shell
$ kubectl create -f config/samples/cache_v1alpha1_memcached.yaml -n memcached-operator-system
```

Please verify expected result.

```shell

$ kubectl get all -n memcached-operator-system
NAME READY STATUS RESTARTS AGE
pod/memcached-operator-controller-manager-864f7c75d4-7cf47 2/2 Running 0 118s
Expand All @@ -69,6 +89,16 @@ NAME DESIRED CUR
replicaset.apps/memcached-operator-controller-manager-864f7c75d4 1 1 1 118s
```

### Verifying the validating webhook

The following command attempts to increase the CR's `spec.size` to an even number. It should throw an error like that shown below, as the validating webhook does not allow an even `spec.size`.

```console
$ kubectl patch memcached memcached-sample -p '{"spec":{"size": 4}}' --type=merge -n memcached-operator-system

Error from server (Cluster size must be an odd number): admission webhook "vmemcached.kb.io" denied the request: Cluster size must be an odd number
```

### Uninstalling

To uninstall all that was performed in the above step run `make uninstall`.
Expand All @@ -89,3 +119,4 @@ $ kubectl logs deployment.apps/memcached-operator-controller-manager -n memcach
[operator_sdk]: https://github.com/operator-framework/operator-sdk
[operator_install]: https://sdk.operatorframework.io/docs/install-operator-sdk/
[quickstart]: https://github.com/operator-framework/operator-sdk/blob/master/website/content/en/docs/kubebuilder/quickstart.md#implement-the-controller
[certmanager]: https://cert-manager.io/docs/installation/kubernetes/
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/example-inc/memcached-operator
newTag: v0.0.1

0 comments on commit 51a3b63

Please sign in to comment.