@@ -39,27 +39,6 @@ This creates the `memcached-operator` project.
39
39
40
40
Learn more about the project directory structure from the SDK [ project layout] [ layout_doc ] documentation.
41
41
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
-
63
42
### Manager
64
43
65
44
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
88
67
89
68
This will scaffold the ` Memcached ` resource API under ` pkg/apis/cache/v1alpha1/... ` .
90
69
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
+
91
91
## Add a new Controller
92
92
93
93
Add a new [ Controller] [ controller_go_doc ] to the project that will watch and reconcile the ` Memcached ` resource:
0 commit comments