seaweedfs / seaweedfs-operator

seaweedfs kubernetes operator
Apache License 2.0
166 stars 41 forks source link

setup-envtest has been changed in master (script removed) #39

Open thiscantbeserious opened 3 years ago

thiscantbeserious commented 3 years ago

See - the script was removed and it is now installable via go directly:

https://github.com/kubernetes-sigs/controller-runtime/pull/1488

This also means that the current tests will fail since the setup-envtest.sh that is getting pulled simply contains "404"

Will see if I can do a pull request.

Would you rather just include the shell-script from the 0.8 release or call the go install in the Makefile?

thiscantbeserious commented 3 years ago

Seems to work with the new go install ... however there seem to be breaking changes in the tests regarding Ginko and there seems to be an hardcoded path to another part of the toolchain as well ...

go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
setup-envtest use 1.20.2
Version: 1.20.2
OS/Arch: linux/amd64
Path: /home/doh/.local/share/kubebuilder-envtest/k8s/1.20.2-linux-amd64
go test ./... -coverprofile cover.out
?       github.com/seaweedfs/seaweedfs-operator [no test files]
?       github.com/seaweedfs/seaweedfs-operator/api/v1  [no test files]
Running Suite: Controller Suite
===============================
Random Seed: 1623166431
Will run 1 of 1 specs

Followed by:

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

  /home/doh/git/seaweedfs-operator/controllers/suite_test.go:63
------------------------------

Ran 1 of 0 Specs in 0.004 seconds
FAIL! -- 0 Passed | 1 Failed | 0 Pending | 0 Skipped
You're using deprecated Ginkgo functionality:
=============================================
Ginkgo 2.0 is under active development and will introduce (a small number of) breaking changes.
To learn more, view the migration guide at https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md
To comment, chime in at https://github.com/onsi/ginkgo/issues/711

  You are passing a Done channel to a test node to test asynchronous behavior.  This is deprecated in Ginkgo V2.  Your test will run synchronously and the timeout will be ignored.
  Learn more at: https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md#removed-async-testing
    /home/doh/git/seaweedfs-operator/controllers/suite_test.go:53
  You are using a custom reporter.  Support for custom reporters will likely be removed in V2.  Most users were using them to generate junit or teamcity reports and this functionality will be merged into the core reporter.  In addition, Ginkgo 2.0 will support emitting a JSON-formatted report that users can then manipulate to generate custom reports.

  If this change will be impactful to you please leave a comment on https://github.com/onsi/ginkgo/issues/711
  Learn more at: https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md#removed-custom-reporters

--- FAIL: TestAPIs (0.00s)
FAIL
coverage: 0.0% of statements
FAIL    github.com/seaweedfs/seaweedfs-operator/controllers     0.038s
?       github.com/seaweedfs/seaweedfs-operator/controllers/label       [no test files]
?       github.com/seaweedfs/seaweedfs-operator/controllers/swadmin     [no test files]
FAIL
make: *** [Makefile:34: test] Error 1

So /usr/local/kubebuilder/bin/etcd -> needs to be adjusted for binary install (?) and Test need to be adjusted for changes

chrislusf commented 3 years ago

this operator was scaffolded by https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/

Need to see what is the latest output and try to merge the changes.

My local version:

operator-sdk version
operator-sdk version: "v0.19.0", commit: "8e28aca60994c5cb1aec0251b85f0116cc4c9427", kubernetes version: "v1.18.2", go version: "go1.14.5 darwin/amd64"

According to https://sdk.operatorframework.io/docs/building-operators/golang/migration/ , we need to migrate the code. Could you please help?

thiscantbeserious commented 3 years ago

Will see what I can do.

From a quick glance only the tests seem broken.

Successfully deployed it on a 3 node Kubernetes v1.21.1+k3s1 cluster with the included example config (go test simply commented out)

Self-Heals manually deleted deployments for master/filer/volume as long as the Seaweed resource is deployed.

This could really need a general cleanup, also since the scafolded template itself is somewhat confusing.

I could also add a Jenkins config for auto-test, auto-tagging and deploy to Dockerhub - but I'd only do that if you plan to use it. Not a fan of tying myself to much to deeply to a single service like Github Actions (Jenkins configuration can be migrated elswhere)

chrislusf commented 3 years ago

Great! Just let me know if you need any help.

how to use Jenkins config on github?

thiscantbeserious commented 3 years ago

Will do - mixed up Jenkins (we're using that for our builds) with Travis.

I've been doing that here:

https://github.com/thiscantbeserious/k8dash/blob/master/.travis.yml

In that case Jenkins is building on each commit - and then uploads the resulting images to Dockerhub tagged by commit-id.

However you could also use a fixed version number in a config-file of course.

All it needs is a little bit of setup in Travis to store your credentials.

https://www.travis-ci.com/github/thiscantbeserious/k8dash/builds/149534376

chrislusf commented 3 years ago

I have added testing .travis.yml file and authorizations. I also invited you to maintain this repo.