From 819b169418a730f18e44c2dd8207e865bcc9b9db Mon Sep 17 00:00:00 2001 From: James Roper Date: Mon, 12 Nov 2018 15:19:09 +1100 Subject: [PATCH] Moved spec and status instructions Fixes #29. --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9398688..8649210 100644 --- a/README.md +++ b/README.md @@ -39,27 +39,6 @@ This creates the `memcached-operator` project. Learn more about the project directory structure from the SDK [project layout][layout_doc] documentation. -#### Define the Memcached spec and status - -Modify the spec and status of the `Memcached` Custom Resource (CR) at `pkg/apis/cache/v1alpha1/memcached_types.go`: - -```Go -type MemcachedSpec struct { - // Size is the size of the memcached deployment - Size int32 `json:"size"` -} -type MemcachedStatus struct { - // Nodes are the names of the memcached pods - Nodes []string `json:"nodes"` -} -``` - -After modifying the `*_types.go` file always run the following command to update the generated code for that resource type: - -```sh -$ operator-sdk generate k8s -``` - ### Manager The main program for the operator `cmd/manager/main.go` initializes and runs the [Manager][manager_go_doc]. @@ -88,6 +67,27 @@ $ operator-sdk add api --api-version=cache.example.com/v1alpha1 --kind=Memcached This will scaffold the `Memcached` resource API under `pkg/apis/cache/v1alpha1/...`. +### Define the Memcached spec and status + +Modify the spec and status of the `Memcached` Custom Resource (CR) at `pkg/apis/cache/v1alpha1/memcached_types.go`: + +```Go +type MemcachedSpec struct { + // Size is the size of the memcached deployment + Size int32 `json:"size"` +} +type MemcachedStatus struct { + // Nodes are the names of the memcached pods + Nodes []string `json:"nodes"` +} +``` + +After modifying the `*_types.go` file always run the following command to update the generated code for that resource type: + +```sh +$ operator-sdk generate k8s +``` + ## Add a new Controller Add a new [Controller][controller_go_doc] to the project that will watch and reconcile the `Memcached` resource: