@@ -21,7 +21,7 @@ import (
21
21
22
22
const (
23
23
// test constants for app-operator
24
- appRepoPath = "github.com/example-inc/app-operator"
24
+ appRepoPath = "github.com/example-inc/" + appProjectName
25
25
appKind = "AppService"
26
26
appApiDirName = "app"
27
27
appAPIVersion = appGroupName + "/" + appVersion
@@ -94,7 +94,7 @@ type Handler struct {
94
94
95
95
func (h *Handler) Handle(ctx types.Context, event types.Event) error {
96
96
switch o := event.Object.(type) {
97
- case *v1alpha1.App :
97
+ case *v1alpha1.AppService :
98
98
err := action.Create(newbusyBoxPod(o))
99
99
if err != nil && !errors.IsAlreadyExists(err) {
100
100
logrus.Errorf("Failed to create busybox pod : %v", err)
@@ -105,7 +105,7 @@ func (h *Handler) Handle(ctx types.Context, event types.Event) error {
105
105
}
106
106
107
107
// newbusyBoxPod demonstrates how to create a busybox pod
108
- func newbusyBoxPod(cr *v1alpha1.App ) *v1.Pod {
108
+ func newbusyBoxPod(cr *v1alpha1.AppService ) *v1.Pod {
109
109
labels := map[string]string{
110
110
"app": "busy-box",
111
111
}
@@ -162,7 +162,7 @@ import (
162
162
163
163
const (
164
164
version = "v1alpha1"
165
- groupName = "play .example.com"
165
+ groupName = "app .example.com"
166
166
)
167
167
168
168
var (
@@ -179,8 +179,8 @@ func init() {
179
179
// addKnownTypes adds the set of types defined in this package to the supplied scheme.
180
180
func addKnownTypes(scheme *runtime.Scheme) error {
181
181
scheme.AddKnownTypes(SchemeGroupVersion,
182
- &PlayService {},
183
- &PlayServiceList {},
182
+ &AppService {},
183
+ &AppServiceList {},
184
184
)
185
185
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
186
186
return nil
@@ -189,7 +189,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
189
189
190
190
func TestGenRegister (t * testing.T ) {
191
191
buf := & bytes.Buffer {}
192
- if err := renderAPIRegisterFile (buf , "PlayService" , "play.example.com" , "v1alpha1" ); err != nil {
192
+ if err := renderAPIRegisterFile (buf , appKind , appGroupName , appVersion ); err != nil {
193
193
t .Error (err )
194
194
return
195
195
}
254
254
255
255
BIN_DIR="$(pwd)/tmp/_output/bin"
256
256
mkdir -p ${BIN_DIR}
257
- PROJECT_NAME="play "
258
- REPO_PATH="github.com/coreos/play "
257
+ PROJECT_NAME="app-operator "
258
+ REPO_PATH="github.com/example-inc/app-operator "
259
259
BUILD_PATH="${REPO_PATH}/cmd/${PROJECT_NAME}"
260
260
echo "building "${PROJECT_NAME}"..."
261
261
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ${BIN_DIR}/${PROJECT_NAME} $BUILD_PATH
262
262
`
263
263
264
264
const dockerFileExp = `FROM alpine:3.6
265
265
266
- ADD tmp/_output/bin/play /usr/local/bin/play
266
+ ADD tmp/_output/bin/app-operator /usr/local/bin/app-operator
267
267
268
- RUN adduser -D play
269
- USER play
268
+ RUN adduser -D app-operator
269
+ USER app-operator
270
270
`
271
271
272
272
func TestGenBuild (t * testing.T ) {
273
273
buf := & bytes.Buffer {}
274
- projectName := "play"
275
- if err := renderBuildFile (buf , "github.com/coreos/play" , projectName ); err != nil {
274
+ if err := renderBuildFile (buf , appRepoPath , appProjectName ); err != nil {
276
275
t .Error (err )
277
276
return
278
277
}
@@ -290,7 +289,7 @@ func TestGenBuild(t *testing.T) {
290
289
}
291
290
292
291
buf = & bytes.Buffer {}
293
- if err := renderDockerFile (buf , projectName ); err != nil {
292
+ if err := renderDockerFile (buf , appProjectName ); err != nil {
294
293
t .Error (err )
295
294
return
296
295
}
@@ -308,7 +307,7 @@ set -o errexit
308
307
set -o nounset
309
308
set -o pipefail
310
309
311
- DOCKER_REPO_ROOT="/go/src/github.com/coreos/play "
310
+ DOCKER_REPO_ROOT="/go/src/github.com/example-inc/app-operator "
312
311
IMAGE=${IMAGE:-"gcr.io/coreos-k8s-scale-testing/codegen:1.9.3"}
313
312
314
313
docker run --rm \
@@ -317,16 +316,16 @@ docker run --rm \
317
316
"$IMAGE" \
318
317
"/go/src/k8s.io/code-generator/generate-groups.sh" \
319
318
"deepcopy" \
320
- "github.com/coreos/play /pkg/generated" \
321
- "github.com/coreos/play /pkg/apis" \
322
- "play :v1alpha1" \
319
+ "github.com/example-inc/app-operator /pkg/generated" \
320
+ "github.com/example-inc/app-operator /pkg/apis" \
321
+ "app :v1alpha1" \
323
322
--go-header-file "./tmp/codegen/boilerplate.go.txt" \
324
323
$@
325
324
`
326
325
327
326
func TestCodeGen (t * testing.T ) {
328
327
buf := & bytes.Buffer {}
329
- if err := renderBoilerplateFile (buf , "play" ); err != nil {
328
+ if err := renderBoilerplateFile (buf , appProjectName ); err != nil {
330
329
t .Error (err )
331
330
return
332
331
}
@@ -335,7 +334,7 @@ func TestCodeGen(t *testing.T) {
335
334
}
336
335
337
336
buf = & bytes.Buffer {}
338
- if err := renderUpdateGeneratedFile (buf , "github.com/coreos/play" , "play" , "v1alpha1" ); err != nil {
337
+ if err := renderUpdateGeneratedFile (buf , appRepoPath , appApiDirName , appVersion ); err != nil {
339
338
t .Error (err )
340
339
return
341
340
}
@@ -372,7 +371,7 @@ projectName: app-operator
372
371
373
372
func TestGenConfig (t * testing.T ) {
374
373
buf := & bytes.Buffer {}
375
- if err := renderConfigFile (buf , "app.example.com/v1alpha1" , "AppService" , "app-operator" ); err != nil {
374
+ if err := renderConfigFile (buf , appAPIVersion , appKind , appProjectName ); err != nil {
376
375
t .Error (err )
377
376
}
378
377
if configExp != buf .String () {
0 commit comments