migrate to kubebuilder 2.3.1#655
Conversation
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Replace build/Dockerfile with a symlink because we still have CI jobs and quay.io configurations using the file from that location. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dhellmann The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test-integration |
ccc7854 to
027f718
Compare
|
/test-integration |
8a3c783 to
b993195
Compare
|
/test-integration |
There was a problem hiding this comment.
this seems really similar idea to k8s.io/apimachinery/pkg/util/wait
There was a problem hiding this comment.
Interesting. @andfasano @zaneb I wonder if we would gain anything by using the apimachinery code?
There was a problem hiding this comment.
Good to know! I had a quick look at the apimachinery code, but most of the implementation is based on timer, whereas we rely on the RequeueAfter re-enqueueing period field. Very likely the only reusable piece could the Backoff type, not sure if it's worth given the simplicity of the current implementation
b993195 to
22513b3
Compare
|
/test-integration |
|
It looks like we now have two copies of the CRD (in |
@maelk and I are going to look at cleaning up the kustomize files from the |
|
/test-integration |
1 similar comment
|
/test-integration |
0d2ffe6 to
c54c8a7
Compare
Move the files into the kubebuilder locations, without modifying them, to make tracking changes in the files easier. Remove auto-generated code that we won't be using after the migration. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Add the BareMetalHost API and controller. Move command line flags controlling which provisioner is used to main.go and make ProvisionerFactory a public member of the reconciler. Move logic for determining the concurrency level to the point at runtime where the reconciler is added to the manager. This lets us return an error instead of forcing an exit. Remove the suite_test.go file generated by kubebuilder, since we don't use that test framework. Fix up unit tests so they work. Minor changes: - Replace r.client calls. - Replace reconcile.Result with ctrl.Result. - Fix package name in controller code - Move controller test setup to one init() since it changes global state $ kubebuilder create api --group metal3.io --version v1alpha1 --kind BareMetalHost Create Resource [y/n] y Create Controller [y/n] y Writing scaffold for you to edit... apis/metal3.io/v1alpha1/baremetalhost_types.go controllers/metal3.io/baremetalhost_controller.go $ rm controllers/metal3.io/suite_test.go Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Use the latest release and pass the arguments we need to allow us to use the float64 field for clock speed and to generate output consistent with what we had from the operator-sdk. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
- Bring version numbers back to what they were before the migration. - Include a make target to tidy and verify them. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
generate.sh: files to watch have moved and expanded gofmt.sh: list go packages to find directories to scan gosec.sh: scan all local packages Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Since we don't have any webhooks, don't configure the server to listen. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Update the manager_auth_proxy_patch.yaml to set the metrics address to the same value used by default in main.go. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
We no longer need to tell people to install the operator-sdk, or to use it to run the tests. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
e767c4c to
ba7625e
Compare
|
/test-integration |
| ifeq (, $(shell which controller-gen)) | ||
| @{ \ | ||
| set -e ;\ | ||
| CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\ | ||
| cd $$CONTROLLER_GEN_TMP_DIR ;\ | ||
| go mod init tmp ;\ | ||
| go get sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) ;\ | ||
| rm -rf $$CONTROLLER_GEN_TMP_DIR ;\ | ||
| } | ||
| CONTROLLER_GEN=$(GOBIN)/controller-gen | ||
| else | ||
| CONTROLLER_GEN=$(shell which controller-gen) | ||
| endif |
There was a problem hiding this comment.
This does not ensure that we are running with a specific version of controller-gen. If the user has an outdated controller-gen installed on his machine, it might result in confusing behaviour. Should the executable be placed in a dedicated location, and referred as such, like Kustomize ?
There was a problem hiding this comment.
We discussed this today in the community meeting and agreed that I will make this change as a follow-up PR.
|
/lgtm |
|
Looks good to me! |
This implements the work described in
https://github.com/metal3-io/metal3-docs/blob/master/design/baremetal-operator/kubebuilder-migration.md
It deviates a bit from the work list, because it turns out not to be
necessary to fork controller-tools now that they have added a flag to
support "unsafe" types like our float64 field.
Replaces #650
Fixes #651