Skip to content

Commit 419cfd3

Browse files
authoredJan 15, 2019
commands,pkg/scaffold,hack,pkg/helm: run and migrate command support for helm (#897)
* [travis deploy] commands,pkg/scaffold,hack,pkg/helm: run and migrate command support for helm * CHANGELOG.md,doc,commands/.../run/helm.go: document helm support for run and migrate commands * doc/dev/testing/travis-build.md: ansible/helm e2e doc update * doc/dev/release.md: documenting new release steps for ansible/helm gopkgtoml.go
1 parent 3c2fee5 commit 419cfd3

26 files changed

+569
-208
lines changed
 

Diff for: ‎CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
### Added
44

5-
- A new command [`operator-sdk migrate`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#migrate) which adds a main.go source file and any associated source files for an operator that is not of the "go" type. ([#887](https://github.com/operator-framework/operator-sdk/pull/887))
6-
- A new command [`operator-sdk run ansible`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#ansible) which runs as an ansible operator process. This is intended to be used when running in a Pod inside a cluster. Developers wanting to run their operator locally should continue to use `up local`. ([#887](https://github.com/operator-framework/operator-sdk/pull/887))
5+
- A new command [`operator-sdk migrate`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#migrate) which adds a main.go source file and any associated source files for an operator that is not of the "go" type. ([#887](https://github.com/operator-framework/operator-sdk/pull/887) and [#897](https://github.com/operator-framework/operator-sdk/pull/897))
6+
- New commands [`operator-sdk run ansible`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#ansible) and [`operator-sdk run helm`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#helm) which run the SDK as ansible and helm operator processes, respectively. These are intended to be used when running in a Pod inside a cluster. Developers wanting to run their operator locally should continue to use `up local`. ([#887](https://github.com/operator-framework/operator-sdk/pull/887) and [#897](https://github.com/operator-framework/operator-sdk/pull/897))
77

88
### Changed
99

Diff for: ‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ image/build: image/build/ansible image/build/helm
108108
image/build/ansible: build/operator-sdk-dev-x86_64-linux-gnu
109109
./hack/image/build-ansible-image.sh $(ANSIBLE_BASE_IMAGE):dev
110110

111-
image/build/helm:
111+
image/build/helm: build/operator-sdk-dev-x86_64-linux-gnu
112112
./hack/image/build-helm-image.sh $(HELM_BASE_IMAGE):dev
113113

114114
image/push: image/push/ansible image/push/helm

Diff for: ‎commands/operator-sdk/cmd/migrate.go

+41-7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/operator-framework/operator-sdk/internal/util/projutil"
2222
"github.com/operator-framework/operator-sdk/pkg/scaffold"
2323
"github.com/operator-framework/operator-sdk/pkg/scaffold/ansible"
24+
"github.com/operator-framework/operator-sdk/pkg/scaffold/helm"
2425
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
2526

2627
log "github.com/sirupsen/logrus"
@@ -48,6 +49,8 @@ func migrateRun(cmd *cobra.Command, args []string) {
4849
switch opType {
4950
case projutil.OperatorTypeAnsible:
5051
migrateAnsible()
52+
case projutil.OperatorTypeHelm:
53+
migrateHelm()
5154
default:
5255
log.Fatalf("Operator of type %s cannot be migrated.", opType)
5356
}
@@ -76,13 +79,7 @@ func migrateAnsible() {
7679
log.Fatalf("Error trying to stat playbook.yaml: (%v)", err)
7780
}
7881

79-
dockerfilePath := filepath.Join(scaffold.BuildDir, scaffold.DockerfileFile)
80-
newDockerfilePath := dockerfilePath + ".sdkold"
81-
err = os.Rename(dockerfilePath, newDockerfilePath)
82-
if err != nil {
83-
log.Fatalf("Failed to rename Dockerfile: (%v)", err)
84-
}
85-
log.Infof("Renamed Dockerfile to %s and replaced with newer version. Compare the new Dockerfile to your old one and manually migrate any customizations", newDockerfilePath)
82+
renameDockerfile()
8683

8784
s := &scaffold.Scaffold{}
8885
err = s.Execute(cfg,
@@ -96,3 +93,40 @@ func migrateAnsible() {
9693
log.Fatalf("Migrate scaffold failed: (%v)", err)
9794
}
9895
}
96+
97+
// migrateHelm runs the migration process for a helm-based operator
98+
func migrateHelm() {
99+
wd := projutil.MustGetwd()
100+
101+
cfg := &input.Config{
102+
AbsProjectPath: wd,
103+
ProjectName: filepath.Base(wd),
104+
}
105+
106+
renameDockerfile()
107+
108+
s := &scaffold.Scaffold{}
109+
err := s.Execute(cfg,
110+
&helm.Main{},
111+
&helm.GopkgToml{},
112+
&helm.DockerfileHybrid{
113+
Watches: true,
114+
HelmCharts: true,
115+
},
116+
&helm.Entrypoint{},
117+
&helm.UserSetup{},
118+
)
119+
if err != nil {
120+
log.Fatalf("Migrate scaffold failed: (%v)", err)
121+
}
122+
}
123+
124+
func renameDockerfile() {
125+
dockerfilePath := filepath.Join(scaffold.BuildDir, scaffold.DockerfileFile)
126+
newDockerfilePath := dockerfilePath + ".sdkold"
127+
err := os.Rename(dockerfilePath, newDockerfilePath)
128+
if err != nil {
129+
log.Fatalf("Failed to rename Dockerfile: (%v)", err)
130+
}
131+
log.Infof("Renamed Dockerfile to %s and replaced with newer version. Compare the new Dockerfile to your old one and manually migrate any customizations", newDockerfilePath)
132+
}

Diff for: ‎commands/operator-sdk/cmd/run.go

+1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ should use "up local" instead.`,
3232
}
3333

3434
runCmd.AddCommand(run.NewAnsibleCmd())
35+
runCmd.AddCommand(run.NewHelmCmd())
3536
return runCmd
3637
}

Diff for: ‎commands/operator-sdk/cmd/run/ansible.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ import (
2121
"github.com/spf13/cobra"
2222
)
2323

24-
var flags *aoflags.AnsibleOperatorFlags
25-
2624
// NewAnsibleCmd returns a command that will run an ansible operator
2725
func NewAnsibleCmd() *cobra.Command {
26+
var flags *aoflags.AnsibleOperatorFlags
2827
newCmd := &cobra.Command{
2928
Use: "ansible",
3029
Short: "Runs as an ansible operator",

Diff for: ‎commands/operator-sdk/cmd/run/helm.go

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2019 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package run
16+
17+
import (
18+
"github.com/operator-framework/operator-sdk/pkg/helm"
19+
hoflags "github.com/operator-framework/operator-sdk/pkg/helm/flags"
20+
21+
"github.com/spf13/cobra"
22+
)
23+
24+
// NewHelmCmd returns a command that will run a helm operator
25+
func NewHelmCmd() *cobra.Command {
26+
var flags *hoflags.HelmOperatorFlags
27+
newCmd := &cobra.Command{
28+
Use: "helm",
29+
Short: "Runs as a helm operator",
30+
Long: `Runs as a helm operator. This is intended to be used when running
31+
in a Pod inside a cluster. Developers wanting to run their operator locally
32+
should use "up local" instead.`,
33+
Run: func(cmd *cobra.Command, args []string) {
34+
helm.Run(flags)
35+
},
36+
}
37+
flags = hoflags.AddTo(newCmd.Flags())
38+
39+
return newCmd
40+
}

Diff for: ‎commands/operator-sdk/cmd/up/local.go

+6-51
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,17 @@ import (
2525
"strings"
2626
"syscall"
2727

28-
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
29-
3028
"github.com/operator-framework/operator-sdk/internal/util/projutil"
3129
"github.com/operator-framework/operator-sdk/pkg/ansible"
3230
aoflags "github.com/operator-framework/operator-sdk/pkg/ansible/flags"
33-
"github.com/operator-framework/operator-sdk/pkg/helm/client"
34-
"github.com/operator-framework/operator-sdk/pkg/helm/controller"
31+
"github.com/operator-framework/operator-sdk/pkg/helm"
3532
hoflags "github.com/operator-framework/operator-sdk/pkg/helm/flags"
36-
"github.com/operator-framework/operator-sdk/pkg/helm/release"
3733
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
3834
"github.com/operator-framework/operator-sdk/pkg/scaffold"
3935
sdkVersion "github.com/operator-framework/operator-sdk/version"
40-
"k8s.io/helm/pkg/storage"
41-
"k8s.io/helm/pkg/storage/driver"
4236

4337
log "github.com/sirupsen/logrus"
4438
"github.com/spf13/cobra"
45-
"sigs.k8s.io/controller-runtime/pkg/client/config"
46-
"sigs.k8s.io/controller-runtime/pkg/manager"
47-
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
4839
)
4940

5041
// NewLocalCmd - up local command to run an operator loccally
@@ -172,50 +163,14 @@ func upLocalHelm() {
172163
log.Fatalf("Failed to set %s environment variable: (%v)", k8sutil.KubeConfigEnvVar, err)
173164
}
174165

175-
logf.SetLogger(logf.ZapLogger(false))
176-
177-
printVersion()
178-
179-
cfg, err := config.GetConfig()
180-
if err != nil {
181-
log.Fatal(err)
182-
}
183-
184-
mgr, err := manager.New(cfg, manager.Options{Namespace: namespace})
185-
if err != nil {
186-
log.Fatal(err)
187-
}
188-
189-
// Create Tiller's storage backend and kubernetes client
190-
storageBackend := storage.Init(driver.NewMemory())
191-
tillerKubeClient, err := client.NewFromManager(mgr)
192-
if err != nil {
193-
log.Fatal(err)
194-
}
195-
196-
factories, err := release.NewManagerFactoriesFromFile(storageBackend, tillerKubeClient, helmOperatorFlags.WatchesFile)
197-
if err != nil {
198-
log.Fatal(err)
199-
}
200-
201-
for gvk, factory := range factories {
202-
// Register the controller with the factory.
203-
err := controller.Add(mgr, controller.WatchOptions{
204-
Namespace: namespace,
205-
GVK: gvk,
206-
ManagerFactory: factory,
207-
ReconcilePeriod: helmOperatorFlags.ReconcilePeriod,
208-
WatchDependentResources: true,
209-
})
210-
if err != nil {
211-
log.Fatal(err)
166+
// Set the kubeconfig that the manager will be able to grab
167+
if namespace != "" {
168+
if err := os.Setenv(k8sutil.WatchNamespaceEnvVar, namespace); err != nil {
169+
log.Fatalf("Failed to set %s environment variable: (%v)", k8sutil.WatchNamespaceEnvVar, err)
212170
}
213171
}
214172

215-
// Start the Cmd
216-
if err := mgr.Start(signals.SetupSignalHandler()); err != nil {
217-
log.Fatal(err)
218-
}
173+
helm.Run(helmOperatorFlags)
219174
}
220175

221176
func printVersion() {

Diff for: ‎doc/dev/release.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,15 @@ Create a new branch to push release commits:
171171
$ git checkout -b release-v1.3.0
172172
```
173173

174-
Commit changes to the following four files:
174+
Commit changes to the following six files:
175175
* `version/version.go`: update `Version` to `v1.3.0`.
176176
* `pkg/scaffold/gopkgtoml.go`, under the `[[constraint]]` for `github.com/operator-framework/operator-sdk`:
177177
* Comment out `branch = "master"`
178178
* Un-comment `version = "v1.2.0"`
179179
* Change `v1.2.0` to `v1.3.0`
180180
* `pkg/scaffold/gopkgtoml_test.go`: same as for `pkg/scaffold/gopkgtoml.go`.
181+
* `pkg/scaffold/ansible/gopkgtoml.go`: same as for `pkg/scaffold/gopkgtoml.go`.
182+
* `pkg/scaffold/helm/gopkgtoml.go`: same as for `pkg/scaffold/gopkgtoml.go`.
181183
* `CHANGELOG.md`: update the `## Unreleased` header to `## v1.3.0`.
182184

183185
Create a new PR for `release-v1.3.0`.
@@ -216,6 +218,8 @@ Check out a new branch from master (or use your `release-v1.3.0`) and commit the
216218
* Comment out `version = "v1.3.0"`
217219
* Un-comment `branch = "master"`
218220
* `pkg/scaffold/gopkgtoml_test.go`: same as for `pkg/scaffold/gopkgtoml.go`.
221+
* `pkg/scaffold/ansible/gopkgtoml.go`: same as for `pkg/scaffold/gopkgtoml.go`.
222+
* `pkg/scaffold/helm/gopkgtoml.go`: same as for `pkg/scaffold/gopkgtoml.go`.
219223
* `CHANGELOG.md`: add the following as a new set of headers above `## v1.3.0`:
220224
```
221225
## Unreleased

Diff for: ‎doc/dev/testing/travis-build.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The Go, Ansible, and Helm tests then differ in what tests they run.
6969
### Ansible tests
7070

7171
1. Run [ansible e2e tests][ansible-e2e].
72-
1. Create base ansible operator image by running [`hack/image/scaffold-ansible-image.go`][ansible-base].
72+
1. Create base ansible operator project by running [`hack/image/ansible/scaffold-ansible-image.go`][ansible-base].
7373
2. Build base ansible operator image.
7474
3. Create and configure a new ansible type memcached-operator.
7575
4. Create cluster resources.
@@ -86,12 +86,18 @@ The Go, Ansible, and Helm tests then differ in what tests they run.
8686
### Helm Tests
8787

8888
1. Run [helm e2e tests][helm-e2e].
89-
1. Build base helm operator image from [`test/helm-operator`][helm-base].
90-
2. Create and configure a new helm type nginx-operator.
91-
3. Create cluster resources.
92-
4. Wait for operator to be ready.
93-
5. Create nginx CR and wait for it to be ready.
94-
6. Delete nginx CR and verify that finalizer (which writes a message in the operator logs) ran.
89+
1. Create base helm operator project by running [`hack/image/helm/scaffold-helm-image.go`][helm-base].
90+
2. Build base helm operator image.
91+
3. Create and configure a new helm type nginx-operator.
92+
4. Create cluster resources.
93+
5. Wait for operator to be ready.
94+
6. Create nginx CR and wait for it to be ready.
95+
7. Scale up the dependent deployment and verify the operator reconciles it back down.
96+
8. Scale up the CR and verify the dependent deployment scales up accordingly.
97+
9. Delete nginx CR and verify that finalizer (which writes a message in the operator logs) ran.
98+
10. Run `operator-sdk migrate` to add go source to the operator.
99+
11. Run `operator-sdk build` to compile the new binary and build a new image.
100+
12. Re-run steps 4-9 to test the migrated operator.
95101

96102
**NOTE**: All created resources, including the namespace, are deleted using a bash trap when the test finishes
97103

@@ -110,8 +116,8 @@ The markdown test does not create a new cluster and runs in a barebones travis V
110116
[go-e2e]: ../../../hack/tests/e2e-go.sh
111117
[tls-tests]: ../../../test/e2e/tls_util_test.go
112118
[ansible-e2e]: ../../../hack/tests/e2e-ansible.sh
113-
[ansible-base]: ../../../hack/image/scaffold-ansible-image.go
119+
[ansible-base]: ../../../hack/image/ansible/scaffold-ansible-image.go
114120
[helm-e2e]: ../../../hack/tests/e2e-helm.sh
115-
[helm-base]: ../../../test/helm-operator
121+
[helm-base]: ../../../hack/image/helm/scaffold-helm-image.go
116122
[marker-github]: https://github.com/crawford/marker
117123
[marker-local]: ../../../hack/ci/marker

Diff for: ‎doc/sdk-cli-reference.md

+17
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,23 @@ should use `up local` instead.
300300
$ operator-sdk run ansible --watches-file=/opt/ansible/watches.yaml --reconcile-period=30s
301301
```
302302

303+
### helm
304+
305+
Runs as a helm operator process. This is intended to be used when running
306+
in a Pod inside a cluster. Developers wanting to run their operator locally
307+
should use `up local` instead.
308+
309+
#### Flags
310+
311+
* `--reconcile-period` string - Default reconcile period for controllers (default 1m0s)
312+
* `--watches-file` string - Path to the watches file to use (default "./watches.yaml")
313+
314+
#### Example
315+
316+
```bash
317+
$ operator-sdk run helm --watches-file=/opt/helm/watches.yaml --reconcile-period=30s
318+
```
319+
303320
## test
304321

305322
### Available Commands
File renamed without changes.

Diff for: ‎hack/image/build-ansible-image.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mkdir -p "$BASEIMAGEDIR"
1212

1313
# build operator binary and base image
1414
pushd "$BASEIMAGEDIR"
15-
go run "$ROOTDIR/hack/image/scaffold-ansible-image.go"
15+
go run "$ROOTDIR/hack/image/ansible/scaffold-ansible-image.go"
1616

1717
mkdir -p build/_output/bin/
1818
cp $ROOTDIR/build/operator-sdk-dev-x86_64-linux-gnu build/_output/bin/ansible-operator

Diff for: ‎hack/image/build-helm-image.sh

+14-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
set -eux
44

5+
source hack/lib/test_lib.sh
6+
7+
ROOTDIR="$(pwd)"
8+
GOTMP="$(mktemp -d -p $GOPATH/src)"
9+
trap_add 'rm -rf $GOTMP' EXIT
10+
BASEIMAGEDIR="$GOTMP/helm-operator"
11+
mkdir -p "$BASEIMAGEDIR"
12+
513
# build operator binary and base image
6-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o test/helm-operator/helm-operator test/helm-operator/cmd/helm-operator/main.go
7-
pushd test/helm-operator
8-
docker build -t "$1" .
14+
pushd "$BASEIMAGEDIR"
15+
go run "$ROOTDIR/hack/image/helm/scaffold-helm-image.go"
16+
17+
mkdir -p build/_output/bin/
18+
cp $ROOTDIR/build/operator-sdk-dev-x86_64-linux-gnu build/_output/bin/helm-operator
19+
operator-sdk build $1
920
popd

Diff for: ‎hack/image/helm/scaffold-helm-image.go

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2019 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package main
16+
17+
import (
18+
"log"
19+
20+
"github.com/operator-framework/operator-sdk/internal/util/projutil"
21+
"github.com/operator-framework/operator-sdk/pkg/scaffold"
22+
"github.com/operator-framework/operator-sdk/pkg/scaffold/helm"
23+
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
24+
)
25+
26+
// main renders scaffolds that are required to build the helm operator base
27+
// image. It is intended for release engineering use only. After running this,
28+
// you can place a binary in `build/_output/bin/helm-operator` and then run
29+
// `operator-sdk build`.
30+
func main() {
31+
cfg := &input.Config{
32+
AbsProjectPath: projutil.MustGetwd(),
33+
ProjectName: "helm-operator",
34+
}
35+
36+
s := &scaffold.Scaffold{}
37+
err := s.Execute(cfg,
38+
&helm.DockerfileHybrid{},
39+
&helm.Entrypoint{},
40+
&helm.UserSetup{},
41+
)
42+
if err != nil {
43+
log.Fatalf("add scaffold failed: (%v)", err)
44+
}
45+
}

Diff for: ‎hack/tests/e2e-helm.sh

+105-70
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,85 @@
22

33
source hack/lib/test_lib.sh
44

5-
DEST_IMAGE="quay.io/example/nginx-operator:v0.0.2"
5+
set -eux
66

7-
set -ex
7+
DEST_IMAGE="quay.io/example/nginx-operator:v0.0.2"
8+
ROOTDIR="$(pwd)"
9+
GOTMP="$(mktemp -d -p $GOPATH/src)"
10+
trap_add 'rm -rf $GOTMP' EXIT
11+
12+
deploy_operator() {
13+
kubectl create -f "$OPERATORDIR/deploy/service_account.yaml"
14+
kubectl create -f "$OPERATORDIR/deploy/role.yaml"
15+
kubectl create -f "$OPERATORDIR/deploy/role_binding.yaml"
16+
kubectl create -f "$OPERATORDIR/deploy/crds/helm_v1alpha1_nginx_crd.yaml"
17+
kubectl create -f "$OPERATORDIR/deploy/operator.yaml"
18+
}
19+
20+
remove_operator() {
21+
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/service_account.yaml"
22+
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/role.yaml"
23+
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/role_binding.yaml"
24+
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/crds/helm_v1alpha1_nginx_crd.yaml"
25+
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/operator.yaml"
26+
}
27+
28+
test_operator() {
29+
# wait for operator pod to run
30+
if ! timeout 1m kubectl rollout status deployment/nginx-operator;
31+
then
32+
kubectl logs deployment/nginx-operator
33+
exit 1
34+
fi
35+
36+
# create CR
37+
kubectl create -f deploy/crds/helm_v1alpha1_nginx_cr.yaml
38+
trap_add 'kubectl delete --ignore-not-found -f ${OPERATORDIR}/deploy/crds/helm_v1alpha1_nginx_cr.yaml' EXIT
39+
if ! timeout 1m bash -c -- 'until kubectl get nginxes.helm.example.com example-nginx -o jsonpath="{..status.conditions[1].release.info.status.code}" | grep 1; do sleep 1; done';
40+
then
41+
kubectl logs deployment/nginx-operator
42+
exit 1
43+
fi
44+
45+
release_name=$(kubectl get nginxes.helm.example.com example-nginx -o jsonpath="{..status.conditions[1].release.name}")
46+
nginx_deployment=$(kubectl get deployment -l "app.kubernetes.io/instance=${release_name}" -o jsonpath="{..metadata.name}")
47+
48+
if ! timeout 1m kubectl rollout status deployment/${nginx_deployment};
49+
then
50+
kubectl describe pods -l "app.kubernetes.io/instance=${release_name}"
51+
kubectl describe deployments ${nginx_deployment}
52+
kubectl logs deployment/${nginx_deployment}
53+
exit 1
54+
fi
55+
56+
nginx_service=$(kubectl get service -l "app.kubernetes.io/instance=${release_name}" -o jsonpath="{..metadata.name}")
57+
kubectl get service ${nginx_service}
58+
59+
# scale deployment replicas to 2 and verify the
60+
# deployment automatically scales back down to 1.
61+
kubectl scale deployment/${nginx_deployment} --replicas=2
62+
if ! timeout 1m test $(kubectl get deployment/${nginx_deployment} -o jsonpath="{..spec.replicas}") -eq 1;
63+
then
64+
kubectl describe pods -l "app.kubernetes.io/instance=${release_name}"
65+
kubectl describe deployments ${nginx_deployment}
66+
kubectl logs deployment/${nginx_deployment}
67+
exit 1
68+
fi
69+
70+
# update CR to replicaCount=2 and verify the deployment
71+
# automatically scales up to 2 replicas.
72+
kubectl patch nginxes.helm.example.com example-nginx -p '[{"op":"replace","path":"/spec/replicaCount","value":2}]' --type=json
73+
if ! timeout 1m test $(kubectl get deployment/${nginx_deployment} -o jsonpath="{..spec.replicas}") -eq 2;
74+
then
75+
kubectl describe pods -l "app.kubernetes.io/instance=${release_name}"
76+
kubectl describe deployments ${nginx_deployment}
77+
kubectl logs deployment/${nginx_deployment}
78+
exit 1
79+
fi
80+
81+
kubectl delete -f deploy/crds/helm_v1alpha1_nginx_cr.yaml --wait=true
82+
kubectl logs deployment/nginx-operator | grep "Uninstalled release" | grep "${release_name}"
83+
}
884

985
# if on openshift switch to the "default" namespace
1086
# and allow containers to run as root (necessary for
@@ -15,93 +91,52 @@ then
1591
oc adm policy add-scc-to-user anyuid -z default
1692
fi
1793

18-
# Make a test directory for Helm tests so we avoid using default GOPATH.
19-
# Save test directory so we can delete it on exit.
20-
HELM_TEST_DIR="$(mktemp -d)"
21-
trap_add 'rm -rf $HELM_TEST_DIR' EXIT
22-
cp -a test/helm-* "$HELM_TEST_DIR"
23-
pushd "$HELM_TEST_DIR"
24-
25-
# Helm tests should not run in a Golang environment.
26-
unset GOPATH GOROOT
2794

2895
# create and build the operator
96+
pushd "$GOTMP"
2997
operator-sdk new nginx-operator --api-version=helm.example.com/v1alpha1 --kind=Nginx --type=helm
98+
3099
pushd nginx-operator
31100
sed -i 's|\(FROM quay.io/operator-framework/helm-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
32-
33101
operator-sdk build "$DEST_IMAGE"
34102
sed -i "s|REPLACE_IMAGE|$DEST_IMAGE|g" deploy/operator.yaml
35103
sed -i 's|Always|Never|g' deploy/operator.yaml
36104
sed -i 's|size: 3|replicaCount: 1|g' deploy/crds/helm_v1alpha1_nginx_cr.yaml
37105

38-
DIR2="$(pwd)"
39-
# deploy the operator
40-
kubectl create -f deploy/service_account.yaml
41-
trap_add 'kubectl delete -f ${DIR2}/deploy/service_account.yaml' EXIT
42-
kubectl create -f deploy/role.yaml
43-
trap_add 'kubectl delete -f ${DIR2}/deploy/role.yaml' EXIT
44-
kubectl create -f deploy/role_binding.yaml
45-
trap_add 'kubectl delete -f ${DIR2}/deploy/role_binding.yaml' EXIT
46-
kubectl create -f deploy/crds/helm_v1alpha1_nginx_crd.yaml
47-
trap_add 'kubectl delete -f ${DIR2}/deploy/crds/helm_v1alpha1_nginx_crd.yaml' EXIT
48-
kubectl create -f deploy/operator.yaml
49-
trap_add 'kubectl delete -f ${DIR2}/deploy/operator.yaml' EXIT
50-
51-
# wait for operator pod to run
52-
if ! timeout 1m kubectl rollout status deployment/nginx-operator;
53-
then
54-
kubectl logs deployment/nginx-operator
55-
exit 1
56-
fi
57-
58-
# create CR
59-
kubectl create -f deploy/crds/helm_v1alpha1_nginx_cr.yaml
60-
trap_add 'kubectl delete --ignore-not-found -f ${DIR2}/deploy/crds/helm_v1alpha1_nginx_cr.yaml' EXIT
61-
if ! timeout 1m bash -c -- 'until kubectl get nginxes.helm.example.com example-nginx -o jsonpath="{..status.conditions[1].release.info.status.code}" | grep 1; do sleep 1; done';
62-
then
63-
kubectl logs deployment/nginx-operator
64-
exit 1
65-
fi
106+
OPERATORDIR="$(pwd)"
66107

67-
release_name=$(kubectl get nginxes.helm.example.com example-nginx -o jsonpath="{..status.conditions[1].release.name}")
68-
nginx_deployment=$(kubectl get deployment -l "app.kubernetes.io/instance=${release_name}" -o jsonpath="{..metadata.name}")
108+
deploy_operator
109+
trap_add 'remove_operator' EXIT
110+
test_operator
111+
remove_operator
69112

70-
if ! timeout 1m kubectl rollout status deployment/${nginx_deployment};
71-
then
72-
kubectl describe pods -l "app.kubernetes.io/instance=${release_name}"
73-
kubectl describe deployments ${nginx_deployment}
74-
kubectl logs deployment/${nginx_deployment}
75-
exit 1
76-
fi
113+
echo "###"
114+
echo "### Base image testing passed"
115+
echo "### Now testing migrate to hybrid operator"
116+
echo "###"
77117

78-
nginx_service=$(kubectl get service -l "app.kubernetes.io/instance=${release_name}" -o jsonpath="{..metadata.name}")
79-
kubectl get service ${nginx_service}
118+
operator-sdk migrate
80119

81-
# scale deployment replicas to 2 and verify the
82-
# deployment automatically scales back down to 1.
83-
kubectl scale deployment/${nginx_deployment} --replicas=2
84-
if ! timeout 1m test $(kubectl get deployment/${nginx_deployment} -o jsonpath="{..spec.replicas}") -eq 1;
120+
if [[ ! -e build/Dockerfile.sdkold ]];
85121
then
86-
kubectl describe pods -l "app.kubernetes.io/instance=${release_name}"
87-
kubectl describe deployments ${nginx_deployment}
88-
kubectl logs deployment/${nginx_deployment}
122+
echo FAIL the old Dockerfile should have been renamed to Dockerfile.sdkold
89123
exit 1
90124
fi
91125

92-
# update CR to replicaCount=2 and verify the deployment
93-
# automatically scales up to 2 replicas.
94-
kubectl patch nginxes.helm.example.com example-nginx -p '[{"op":"replace","path":"/spec/replicaCount","value":2}]' --type=json
95-
if ! timeout 1m test $(kubectl get deployment/${nginx_deployment} -o jsonpath="{..spec.replicas}") -eq 2;
96-
then
97-
kubectl describe pods -l "app.kubernetes.io/instance=${release_name}"
98-
kubectl describe deployments ${nginx_deployment}
99-
kubectl logs deployment/${nginx_deployment}
100-
exit 1
101-
fi
126+
# We can't reliably run `dep ensure` because when there are changes to
127+
# operator-sdk itself, and those changes are not merged upstream, we hit this
128+
# bug: https://github.com/golang/dep/issues/1747
129+
# Instead, this re-uses operator-sdk's own vendor directory.
130+
cp -a "$ROOTDIR"/vendor ./
131+
mkdir -p vendor/github.com/operator-framework/operator-sdk/
132+
# We cannot just use operator-sdk from $GOPATH because compilation tries to use
133+
# its vendor directory, which can conflict with the local one.
134+
cp -a "$ROOTDIR"/{internal,pkg,version,LICENSE} vendor/github.com/operator-framework/operator-sdk/
135+
136+
operator-sdk build "$DEST_IMAGE"
102137

103-
kubectl delete -f deploy/crds/helm_v1alpha1_nginx_cr.yaml --wait=true
104-
kubectl logs deployment/nginx-operator | grep "Uninstalled release" | grep "${release_name}"
138+
deploy_operator
139+
test_operator
105140

106141
popd
107142
popd

Diff for: ‎test/helm-operator/cmd/helm-operator/main.go renamed to ‎pkg/helm/run.go

+11-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 The Operator-SDK Authors
1+
// Copyright 2019 The Operator-SDK Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package main
15+
package helm
1616

1717
import (
1818
"fmt"
@@ -25,7 +25,6 @@ import (
2525
"github.com/operator-framework/operator-sdk/pkg/helm/release"
2626
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
2727
sdkVersion "github.com/operator-framework/operator-sdk/version"
28-
"github.com/spf13/pflag"
2928

3029
"k8s.io/helm/pkg/storage"
3130
"k8s.io/helm/pkg/storage/driver"
@@ -43,18 +42,17 @@ func printVersion() {
4342
log.Info(fmt.Sprintf("Version of operator-sdk: %v", sdkVersion.Version))
4443
}
4544

46-
func main() {
47-
hflags := hoflags.AddTo(pflag.CommandLine)
48-
pflag.Parse()
49-
45+
// Run runs the helm operator
46+
func Run(flags *hoflags.HelmOperatorFlags) {
5047
logf.SetLogger(logf.ZapLogger(false))
5148

5249
printVersion()
5350

54-
namespace, err := k8sutil.GetWatchNamespace()
55-
if err != nil {
56-
log.Error(err, "Failed to get watch namespace")
57-
os.Exit(1)
51+
namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar)
52+
if found {
53+
log.Info("Watching single namespace", "namespace", namespace)
54+
} else {
55+
log.Info(k8sutil.WatchNamespaceEnvVar + " environment variable not set, watching all namespaces")
5856
}
5957

6058
cfg, err := config.GetConfig()
@@ -69,8 +67,6 @@ func main() {
6967
os.Exit(1)
7068
}
7169

72-
log.Info("Registering Components.")
73-
7470
// Create Tiller's storage backend and kubernetes client
7571
storageBackend := storage.Init(driver.NewMemory())
7672
tillerKubeClient, err := client.NewFromManager(mgr)
@@ -79,7 +75,7 @@ func main() {
7975
os.Exit(1)
8076
}
8177

82-
factories, err := release.NewManagerFactoriesFromFile(storageBackend, tillerKubeClient, hflags.WatchesFile)
78+
factories, err := release.NewManagerFactoriesFromFile(storageBackend, tillerKubeClient, flags.WatchesFile)
8379
if err != nil {
8480
log.Error(err, "")
8581
os.Exit(1)
@@ -91,7 +87,7 @@ func main() {
9187
Namespace: namespace,
9288
GVK: gvk,
9389
ManagerFactory: factory,
94-
ReconcilePeriod: hflags.ReconcilePeriod,
90+
ReconcilePeriod: flags.ReconcilePeriod,
9591
WatchDependentResources: true,
9692
})
9793
if err != nil {
@@ -100,8 +96,6 @@ func main() {
10096
}
10197
}
10298

103-
log.Info("Starting the Cmd.")
104-
10599
// Start the Cmd
106100
if err := mgr.Start(signals.SetupSignalHandler()); err != nil {
107101
log.Error(err, "Manager exited non-zero")

Diff for: ‎pkg/scaffold/helm/dockerfilehybrid.go

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright 2019 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package helm
16+
17+
import (
18+
"path/filepath"
19+
20+
"github.com/operator-framework/operator-sdk/pkg/scaffold"
21+
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
22+
)
23+
24+
//DockerfileHybrid - Dockerfile for a hybrid operator
25+
type DockerfileHybrid struct {
26+
input.Input
27+
28+
// HelmCharts - if true, include a COPY statement for the helm-charts directory
29+
HelmCharts bool
30+
31+
// Watches - if true, include a COPY statement for watches.yaml
32+
Watches bool
33+
}
34+
35+
// GetInput - gets the input
36+
func (d *DockerfileHybrid) GetInput() (input.Input, error) {
37+
if d.Path == "" {
38+
d.Path = filepath.Join(scaffold.BuildDir, scaffold.DockerfileFile)
39+
}
40+
d.TemplateBody = dockerFileHybridHelmTmpl
41+
return d.Input, nil
42+
}
43+
44+
const dockerFileHybridHelmTmpl = `FROM alpine:3.6
45+
46+
ENV OPERATOR=/usr/local/bin/helm-operator \
47+
USER_UID=1001 \
48+
USER_NAME=helm \
49+
HOME=/opt/helm
50+
51+
# install operator binary
52+
COPY build/_output/bin/{{.ProjectName}} ${OPERATOR}
53+
54+
COPY bin /usr/local/bin
55+
RUN /usr/local/bin/user_setup
56+
57+
{{- if .HelmCharts }}
58+
COPY helm-charts/ ${HOME}/helm-charts/{{ end }}
59+
{{- if .Watches }}
60+
COPY watches.yaml ${HOME}/watches.yaml{{ end }}
61+
62+
ENTRYPOINT ["/usr/local/bin/entrypoint"]
63+
64+
USER ${USER_UID}`

Diff for: ‎pkg/scaffold/helm/entrypoint.go

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2019 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package helm
16+
17+
import (
18+
"path/filepath"
19+
20+
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
21+
)
22+
23+
// Entrypoint - entrypoint script
24+
type Entrypoint struct {
25+
input.Input
26+
}
27+
28+
func (e *Entrypoint) GetInput() (input.Input, error) {
29+
if e.Path == "" {
30+
e.Path = filepath.Join("bin", "entrypoint")
31+
}
32+
e.TemplateBody = entrypointTmpl
33+
e.IsExec = true
34+
return e.Input, nil
35+
}
36+
37+
const entrypointTmpl = `#!/bin/sh -e
38+
39+
# This is documented here:
40+
# https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines
41+
42+
if ! whoami &>/dev/null; then
43+
if [ -w /etc/passwd ]; then
44+
echo "${USER_NAME:-helm}:x:$(id -u):$(id -g):${USER_NAME:-helm} user:${HOME}:/sbin/nologin" >> /etc/passwd
45+
fi
46+
fi
47+
48+
exec ${OPERATOR} run helm --watches-file=/opt/helm/watches.yaml $@
49+
`

Diff for: ‎pkg/scaffold/helm/gopkgtoml.go

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2019 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package helm
16+
17+
import (
18+
"github.com/operator-framework/operator-sdk/pkg/scaffold"
19+
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
20+
)
21+
22+
// GopkgToml - the Gopkg.toml file for a hybrid operator
23+
type GopkgToml struct {
24+
input.Input
25+
}
26+
27+
func (s *GopkgToml) GetInput() (input.Input, error) {
28+
if s.Path == "" {
29+
s.Path = scaffold.GopkgTomlFile
30+
}
31+
s.TemplateBody = gopkgTomlTmpl
32+
return s.Input, nil
33+
}
34+
35+
const gopkgTomlTmpl = `[[constraint]]
36+
name = "github.com/operator-framework/operator-sdk"
37+
# The version rule is used for a specific release and the master branch for in between releases.
38+
branch = "master" #osdk_branch_annotation
39+
# version = "=v0.3.0" #osdk_version_annotation
40+
41+
[prune]
42+
go-tests = true
43+
unused-packages = true
44+
`

Diff for: ‎pkg/scaffold/helm/main.go

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2019 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package helm
16+
17+
import (
18+
"path/filepath"
19+
20+
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
21+
)
22+
23+
// Main - main source file for helm operator
24+
type Main struct {
25+
input.Input
26+
}
27+
28+
func (m *Main) GetInput() (input.Input, error) {
29+
if m.Path == "" {
30+
m.Path = filepath.Join("cmd", "manager", "main.go")
31+
}
32+
m.TemplateBody = mainTmpl
33+
return m.Input, nil
34+
}
35+
36+
const mainTmpl = `package main
37+
38+
import (
39+
hoflags "github.com/operator-framework/operator-sdk/pkg/helm/flags"
40+
"github.com/operator-framework/operator-sdk/pkg/helm"
41+
42+
"github.com/spf13/pflag"
43+
)
44+
45+
func main() {
46+
hflags := hoflags.AddTo(pflag.CommandLine)
47+
pflag.Parse()
48+
49+
helm.Run(hflags)
50+
}
51+
`

Diff for: ‎pkg/scaffold/helm/usersetup.go

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2019 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package helm
16+
17+
import (
18+
"path/filepath"
19+
20+
"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
21+
)
22+
23+
// UserSetup - userSetup script
24+
type UserSetup struct {
25+
input.Input
26+
}
27+
28+
func (u *UserSetup) GetInput() (input.Input, error) {
29+
if u.Path == "" {
30+
u.Path = filepath.Join("bin", "user_setup")
31+
}
32+
u.TemplateBody = userSetupTmpl
33+
u.IsExec = true
34+
return u.Input, nil
35+
}
36+
37+
const userSetupTmpl = `#!/bin/sh
38+
set -x
39+
40+
# ensure $HOME exists and is accessible by group 0 (we don't know what the runtime UID will be)
41+
mkdir -p ${HOME}
42+
chown ${USER_UID}:0 ${HOME}
43+
chmod ug+rwx ${HOME}
44+
45+
# runtime user will need to be able to self-insert in /etc/passwd
46+
chmod g+rw /etc/passwd
47+
48+
# no need for this script to remain in the image after running
49+
rm $0
50+
`

Diff for: ‎release.sh

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fi
3333
VER_FILE="version/version.go"
3434
TOML_TMPL_FILE="pkg/scaffold/gopkgtoml.go"
3535
ANS_TOML_TMPL_FILE="pkg/scaffold/ansible/gopkgtoml.go"
36+
HELM_TOML_TMPL_FILE="pkg/scaffold/helm/gopkgtoml.go"
3637
CURR_VER_VER_FILE="$(sed -nr 's/Version = "(.+)"/\1/p' "$VER_FILE" | tr -d ' \t\n')"
3738
CURR_VER_TMPL_FILE="$(sed -nr 's/.*".*v(.+)".*#osdk_version_annotation/v\1/p' "$TOML_TMPL_FILE" | tr -d ' \t\n')"
3839
if [[ "$VER" != "$CURR_VER_VER_FILE" || "$VER" != "$CURR_VER_TMPL_FILE" ]]; then
@@ -44,6 +45,11 @@ if [[ "$VER" != "$CURR_VER_ANS_TMPL_FILE" ]]; then
4445
echo "versions are not set correctly in $ANS_TOML_TMPL_FILE"
4546
exit 1
4647
fi
48+
CURR_VER_HELM_TMPL_FILE="$(sed -nr 's/.*".*v(.+)".*#osdk_version_annotation/v\1/p' "$HELM_TOML_TMPL_FILE" | tr -d ' \t\n')"
49+
if [[ "$VER" != "$CURR_VER_HELM_TMPL_FILE" ]]; then
50+
echo "versions are not set correctly in $HELM_TOML_TMPL_FILE"
51+
exit 1
52+
fi
4753

4854
git tag --sign --message "Operator SDK $VER" "$VER"
4955

Diff for: ‎test/helm-operator/Dockerfile

-16
This file was deleted.

Diff for: ‎test/helm-operator/README.md

-2
This file was deleted.

Diff for: ‎test/helm-operator/bin/entrypoint

-13
This file was deleted.

Diff for: ‎test/helm-operator/bin/user_setup

-13
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.