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

Commit 819b169

Browse files
committed
Moved spec and status instructions
Fixes #29.
1 parent ccefb7b commit 819b169

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,6 @@ This creates the `memcached-operator` project.
3939

4040
Learn more about the project directory structure from the SDK [project layout][layout_doc] documentation.
4141

42-
#### Define the Memcached spec and status
43-
44-
Modify the spec and status of the `Memcached` Custom Resource (CR) at `pkg/apis/cache/v1alpha1/memcached_types.go`:
45-
46-
```Go
47-
type MemcachedSpec struct {
48-
// Size is the size of the memcached deployment
49-
Size int32 `json:"size"`
50-
}
51-
type MemcachedStatus struct {
52-
// Nodes are the names of the memcached pods
53-
Nodes []string `json:"nodes"`
54-
}
55-
```
56-
57-
After modifying the `*_types.go` file always run the following command to update the generated code for that resource type:
58-
59-
```sh
60-
$ operator-sdk generate k8s
61-
```
62-
6342
### Manager
6443

6544
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
8867

8968
This will scaffold the `Memcached` resource API under `pkg/apis/cache/v1alpha1/...`.
9069

70+
### Define the Memcached spec and status
71+
72+
Modify the spec and status of the `Memcached` Custom Resource (CR) at `pkg/apis/cache/v1alpha1/memcached_types.go`:
73+
74+
```Go
75+
type MemcachedSpec struct {
76+
// Size is the size of the memcached deployment
77+
Size int32 `json:"size"`
78+
}
79+
type MemcachedStatus struct {
80+
// Nodes are the names of the memcached pods
81+
Nodes []string `json:"nodes"`
82+
}
83+
```
84+
85+
After modifying the `*_types.go` file always run the following command to update the generated code for that resource type:
86+
87+
```sh
88+
$ operator-sdk generate k8s
89+
```
90+
9191
## Add a new Controller
9292

9393
Add a new [Controller][controller_go_doc] to the project that will watch and reconcile the `Memcached` resource:

0 commit comments

Comments
 (0)