ansible-community / operator-sdk-performance-testing

Performance testing for the Kubernetes Operator SDK.
MIT License
8 stars 4 forks source link

Add build and deployment of Ansible, Go, and Helm Memcached operators #1

Closed geerlingguy closed 4 years ago

geerlingguy commented 4 years ago

See: https://github.com/operator-framework/operator-sdk-samples

Basically, for each one we need a registry available. Maybe I could set up a public registry in Quay, or set up a separate private registry in CI?

Then we need to cd into the respective directory and run the commands as instructed in the respective READMEs.

geerlingguy commented 4 years ago

Maybe use https://ttl.sh ?

geerlingguy commented 4 years ago

My PR is running into this issue: https://github.com/operator-framework/operator-sdk/issues/3335

Might be a directory pathing thing. Might also be related to https://github.com/operator-framework/operator-sdk/issues/2648

geerlingguy commented 4 years ago

Updated to the 1.0.0 versions, but still getting:

...
Step 3/6 : RUN ansible-galaxy collection install -r ${HOME}/requirements.yml  && chmod -R ug+rwx ${HOME}/.ansible
 ---> Running in 345df6571084\n
ERROR! Unexpected Exception, this is probably a bug: [Errno 13] Permission denied: '/opt/ansible/requirements.yml'
to see the full traceback, use -vvv
Makefile:42: recipe for target 'docker-build' failed

Edit: to fix, I made the clonse of the examples repo 777 :P

geerlingguy commented 4 years ago

Now working on building the Go operator and getting it up and running, but hitting:

unable to recognize "STDIN": no matches for kind "Certificate" in version "cert-manager.io/v1alpha2"
unable to recognize "STDIN": no matches for kind "Issuer" in version "cert-manager.io/v1alpha2"
make: *** [deploy] Error 1
geerlingguy commented 4 years ago

Now the Helm memcached operator deploy is giving:

error: unable to recognize "STDIN": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
make: *** [deploy] Error 1

Looks like we have to add in extra stuff for the Helm operator sample :P

geerlingguy commented 4 years ago

Trying to deploy prometheus-operator results in:

pods "prometheus-operator-7589597769-" is forbidden: error looking up service account default/prometheus-operator: serviceaccount "prometheus-operator" not found
geerlingguy commented 4 years ago

I had to manually create the ServiceAccount prior to deploying the operator (I guess since the ServiceAccount definition is way down at the end of the manifest, so it's not created in time).

# Without this the operator doesn't deploy successfully on the first go.
- name: Manually create the prometheus-operator ServiceAccount.
  k8s:
    state: present
    definition:
      apiVersion: v1
      kind: ServiceAccount
      metadata:
        labels:
          app.kubernetes.io/component: controller
          app.kubernetes.io/name: prometheus-operator
          app.kubernetes.io/version: v0.41.1
        name: prometheus-operator
        namespace: default
geerlingguy commented 4 years ago

Now running into:

make docker-build
...
/bin/sh: 1: source: not found
/bin/sh: 1: fetch_envtest_tools: not found
/bin/sh: 1: setup_envtest_env: not found
make: *** [test] Error 1
geerlingguy commented 4 years ago

Hmm... actual error (and this is from the Go build and only happening in CI environment):

/home/runner/go/bin/controller-gen object:headerFile=\"hack/boilerplate.go.txt\" paths=\"./...\"
go fmt ./...
go vet ./...
/home/runner/go/bin/controller-gen \"crd:trivialVersions=true\" rbac:roleName=manager-role webhook paths=\"./...\" output:crd:artifacts:config=config/crd/bases
mkdir -p /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/testbin
test -f /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/testbin/setup-envtest.sh || curl -sSLo /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/testbin/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh
source /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/testbin/setup-envtest.sh; fetch_envtest_tools /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/testbin; setup_envtest_env /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/testbin; go test ./... -coverprofile cover.out
?     github.com/example/memcached-operator  [no test files]
?     github.com/example/memcached-operator/api/v1alpha1  [no test files]
Running Suite: Controller Suite
===============================
Random Seed: 1598289894
Will run 0 of 0 specs

STEP: bootstrapping test environment
2020-08-24T17:24:54.851Z  DEBUG  controller-runtime.test-env  starting control plane  {\"api server flags\": []}
2020-08-24T17:24:54.854Z  ERROR  controller-runtime.test-env  unable to start the controlplane  {\"tries\": 0, \"error\": \"fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory\"}
github.com/go-logr/zapr.(*zapLogger).Error
  /home/runner/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:279
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:241
github.com/example/memcached-operator/controllers.glob..func1
  /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/controllers/suite_test.go:61
reflect.Value.call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:460
reflect.Value.Call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:321
github.com/onsi/ginkgo/internal/leafnodes.newRunner.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:49
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runAsync.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:86
2020-08-24T17:24:54.854Z  ERROR  controller-runtime.test-env  unable to start the controlplane  {\"tries\": 1, \"error\": \"fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory\"}
github.com/go-logr/zapr.(*zapLogger).Error
  /home/runner/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:279
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:241
github.com/example/memcached-operator/controllers.glob..func1
  /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/controllers/suite_test.go:61
reflect.Value.call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:460
reflect.Value.Call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:321
github.com/onsi/ginkgo/internal/leafnodes.newRunner.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:49
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runAsync.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:86
2020-08-24T17:24:54.855Z  ERROR  controller-runtime.test-env  unable to start the controlplane  {\"tries\": 2, \"error\": \"fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory\"}
github.com/go-logr/zapr.(*zapLogger).Error
  /home/runner/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:279
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:241
github.com/example/memcached-operator/controllers.glob..func1
  /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/controllers/suite_test.go:61
reflect.Value.call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:460
reflect.Value.Call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:321
github.com/onsi/ginkgo/internal/leafnodes.newRunner.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:49
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runAsync.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:86
2020-08-24T17:24:54.855Z  ERROR  controller-runtime.test-env  unable to start the controlplane  {\"tries\": 3, \"error\": \"fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory\"}
github.com/go-logr/zapr.(*zapLogger).Error
  /home/runner/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:279
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:241
github.com/example/memcached-operator/controllers.glob..func1
  /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/controllers/suite_test.go:61
reflect.Value.call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:460
reflect.Value.Call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:321
github.com/onsi/ginkgo/internal/leafnodes.newRunner.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:49
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runAsync.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:86
2020-08-24T17:24:54.855Z  ERROR  controller-runtime.test-env  unable to start the controlplane  {\"tries\": 4, \"error\": \"fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory\"}
github.com/go-logr/zapr.(*zapLogger).Error
  /home/runner/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:279
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
  /home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/envtest/server.go:241
github.com/example/memcached-operator/controllers.glob..func1
  /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/controllers/suite_test.go:61
reflect.Value.call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:460
reflect.Value.Call
  /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:321
github.com/onsi/ginkgo/internal/leafnodes.newRunner.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:49
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runAsync.func1
  /home/runner/go/pkg/mod/github.com/onsi/ginkgo@v1.12.1/internal/leafnodes/runner.go:86
Failure [0.005 seconds]
[BeforeSuite] BeforeSuite
/home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/controllers/suite_test.go:52

  Unexpected error:
      <*fmt.wrapError | 0xc0000c2600>: {
          msg: \"failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory\",
          err: {
              Op: \"fork/exec\",
              Path: \"/usr/local/kubebuilder/bin/etcd\",
              Err: 0x2,
          },
      }
      failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
  occurred

  /home/runner/work/operator-sdk-performance-testing/operator-sdk-performance-testing/operator-sdk-samples/go/memcached-operator/controllers/suite_test.go:62
------------------------------

Ran 0 of 0 Specs in 0.005 seconds
FAIL! --  Passed |  Failed |  Pending |  Skipped
--- FAIL: TestAPIs (0.00s)
FAIL
coverage: 0.0% of statements
FAIL  github.com/example/memcached-operator/controllers  0.023s
FAIL
Makefile:31: recipe for target 'test' failed