@@ -28,8 +28,9 @@ Before creating any project, this guide has the following prerequisites:
28
28
29
29
Operator SDK CLI tool is used to manage development lifecycle.
30
30
31
- Install the CLI tool:
31
+ Checkout the desired release tag and install the SDK CLI tool:
32
32
```
33
+ git checkout tags/v0.0.1
33
34
go install github.com/coreos/operator-sdk/commands/operator-sdk
34
35
```
35
36
@@ -117,7 +118,7 @@ Re-render the generated code for custom resource:
117
118
operator-sdk generate k8s
118
119
```
119
120
120
- In ` main.go ` , modify ` sdk.Watch ` to watch on ` Memcached ` custom resource:
121
+ In ` cmd/memcached-operator/ main.go` , modify ` sdk.Watch ` to watch on ` Memcached ` custom resource:
121
122
122
123
``` Go
123
124
func main () {
@@ -136,6 +137,7 @@ import (
136
137
" github.com/coreos/operator-sdk/pkg/sdk/action"
137
138
" github.com/coreos/operator-sdk/pkg/sdk/handler"
138
139
" github.com/coreos/operator-sdk/pkg/sdk/types"
140
+ " github.com/sirupsen/logrus"
139
141
apps_v1 " k8s.io/api/apps/v1"
140
142
" k8s.io/api/core/v1"
141
143
metav1 " k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -145,6 +147,7 @@ func (h *Handler) Handle(ctx types.Context, event types.Event) []types.Action {
145
147
var actions []types.Action
146
148
switch obj := event.Object .(type ) {
147
149
case *v1alpha1.Memcached :
150
+ logrus.Infof (" Received Memcached: %v " , obj.Name )
148
151
ls := map [string ]string {
149
152
" app" : " memcached" ,
150
153
" name" : obj.Name ,
@@ -181,6 +184,7 @@ func (h *Handler) Handle(ctx types.Context, event types.Event) []types.Action {
181
184
},
182
185
},
183
186
}
187
+ logrus.Infof (" Creating Deployment: %v " , obj.Name )
184
188
actions = append (actions, types.Action {
185
189
Object: d,
186
190
Func: action.KubeApplyFunc ,
@@ -207,6 +211,7 @@ func (h *Handler) Handle(ctx types.Context, event types.Event) []types.Action {
207
211
}},
208
212
},
209
213
}
214
+ logrus.Infof (" Creating Service: %v " , obj.Name )
210
215
actions = append (actions, types.Action {
211
216
Object: svc,
212
217
Func: action.KubeApplyFunc ,
@@ -268,7 +273,7 @@ We can test the Memcached service by opening a telnet session and running comman
268
273
```
269
274
It should output:
270
275
```
271
- VALUE foo 0 0 3
276
+ VALUE foo 0 3
272
277
bar
273
278
```
274
279
0 commit comments