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

Commit 51a3b63

Browse files
README updated to add certmanager installation step (#133)
* README updated to add certmanager installation step
1 parent 3b4c749 commit 51a3b63

2 files changed

Lines changed: 37 additions & 5 deletions

File tree

go/kubebuilder/memcached-operator/README.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,44 @@ Run the following command
3333
```
3434
$ go mod tidy
3535
```
36+
***NOTE*** As this example showcases validation webhook creation, please follow [this][certmanager] guide to install cert-mamager into cluster prior to deployment.
3637

3738
### Building the operator
3839

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

41-
```
42-
$ make install
42+
```shell
4343
$ export IMG=quay.io/example-inc/memcached-operator:v0.0.1
44-
$ make docker-build $IMG
45-
$ docker push $IMG
46-
$ make deploy $IMG
44+
$ make docker-build docker-push IMG=$IMG
4745
```
4846

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

49+
### Instaling Operator API
50+
51+
Install the CRDs into the cluster:
52+
53+
```shell
54+
$ make install
55+
```
56+
### Deploying your operator
57+
58+
Deploy the Memcached Operator to the cluster with image specified by IMG
59+
60+
```shell
61+
$ make deploy IMG=$IMG
62+
```
63+
64+
### Create memcached-sample instances.
65+
66+
```shell
67+
$ kubectl create -f config/samples/cache_v1alpha1_memcached.yaml -n memcached-operator-system
68+
```
69+
5170
Please verify expected result.
5271

5372
```shell
73+
5474
$ kubectl get all -n memcached-operator-system
5575
NAME READY STATUS RESTARTS AGE
5676
pod/memcached-operator-controller-manager-864f7c75d4-7cf47 2/2 Running 0 118s
@@ -69,6 +89,16 @@ NAME DESIRED CUR
6989
replicaset.apps/memcached-operator-controller-manager-864f7c75d4 1 1 1 118s
7090
```
7191

92+
### Verifying the validating webhook
93+
94+
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`.
95+
96+
```console
97+
$ kubectl patch memcached memcached-sample -p '{"spec":{"size": 4}}' --type=merge -n memcached-operator-system
98+
99+
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
100+
```
101+
72102
### Uninstalling
73103

74104
To uninstall all that was performed in the above step run `make uninstall`.
@@ -89,3 +119,4 @@ $ kubectl logs deployment.apps/memcached-operator-controller-manager -n memcach
89119
[operator_sdk]: https://github.com/operator-framework/operator-sdk
90120
[operator_install]: https://sdk.operatorframework.io/docs/install-operator-sdk/
91121
[quickstart]: https://github.com/operator-framework/operator-sdk/blob/master/website/content/en/docs/kubebuilder/quickstart.md#implement-the-controller
122+
[certmanager]: https://cert-manager.io/docs/installation/kubernetes/

go/kubebuilder/memcached-operator/config/manager/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ kind: Kustomization
55
images:
66
- name: controller
77
newName: quay.io/example-inc/memcached-operator
8+
newTag: v0.0.1

0 commit comments

Comments
 (0)