-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(operator-sdk): upgrade operator sdk version to 1.22.2 #430
Conversation
59447d0
to
b9234bc
Compare
Hi @ebaron, in our unit tests, when Cryostat CR is being deleted, we call
which, I think, adds a delete-timestamp and calls Then, in test spec, we call check if finalizers are absent.
But in this case, would cryostat CR already be deleted since its finalizers are resolved so the finalizer checks failed to get cryostat CR as here? should remove the finalizer [It]
/home/thvo/workspace/cryostat-operator/internal/controllers/cryostat_controller_test.go:969
Unexpected error:
<*errors.StatusError | 0xc000178aa0>: {
ErrStatus: {
TypeMeta: {Kind: "", APIVersion: ""},
ListMeta: {
SelfLink: "",
ResourceVersion: "",
Continue: "",
RemainingItemCount: nil,
},
Status: "Failure",
Message: "cryostats.operator.cryostat.io \"cryostat\" not found",
Reason: "NotFound",
Details: {
Name: "cryostat",
Group: "operator.cryostat.io",
Kind: "cryostats",
UID: "",
Causes: nil,
RetryAfterSeconds: 0,
},
Code: 404,
},
}
cryostats.operator.cryostat.io "cryostat" not found
occurred |
Release
|
Ah, that explains the behaviour you saw then. In our existing tests, we would use the DeletionTimestamp to simulate the Cryostat CR being deleted, but nothing actually followed through with the deletion. I suppose now the tests should be updated to ensure the object is deleted instead of testing whether the finalizer is absent. |
hi @ebaron, It looks like we update
Fail test:
|
It seems this only happens after bumping to cryostat-operator/internal/test/resources.go Line 1684 in 5ceb7db
But I wonder if we need to update their labels/annotations in
|
With new upgrades, a |
I did $ git status
HEAD detached at thvo/upgrade-operator-sdk
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: bundle/manifests/operator.cryostat.io_cryostats.yaml
modified: bundle/manifests/operator.cryostat.io_flightrecorders.yaml
modified: bundle/manifests/operator.cryostat.io_recordings.yaml
modified: config/crd/bases/operator.cryostat.io_cryostats.yaml
modified: config/crd/bases/operator.cryostat.io_flightrecorders.yaml
modified: config/crd/bases/operator.cryostat.io_recordings.yaml
modified: config/rbac/role.yaml
no changes added to commit (use "git add" and/or "git commit -a")
|
Oh hmm that's weird. There appears no changes on my end. I am using operator-sdk |
$ go version
go version go1.18.4 linux/amd64
$ operator-sdk version
operator-sdk version: "v1.22.2", commit: "da3346113a8a75e11225f586482934000504a60f", kubernetes version: "1.24.1", go version: "go1.18.4", GOOS: "linux", GOARCH: "amd64" I'm in the middle of building and testing this PR as a bundle so I have some other changes that got made locally, modifying image tags and such. I'll post the diff of what I found earlier when this is out of the way. |
Ohh would it be |
Good hunch, but $ ./bin/controller-gen --version
Version: v0.9.0
$ ./bin/kustomize version
{Version:kustomize/v3.8.7 GitCommit:ad092cc7a91c07fdf63a2e4b7f13fa588a39af4f BuildDate:2020-11-11T23:14:14Z GoOs:linux GoArch:amd64} These were freshly retrieved since this is my first time doing an operator build on my new laptop. |
Oh myy actually it is my setup that is out of date! Still on |
Cool, just manually testing out deploying things using this new build looks good. I didn't go too in-depth but I was able to install the operator via bundle, create a Cryostat CR with a configuration for a report sidecar, and that got deployed as usual. Then I edited the CR to remove the report sidecar and the deployment was adjusted accordingly. |
Makes sense: diff --git a/bundle/manifests/operator.cryostat.io_cryostats.yaml b/bundle/manifests/operator.cryostat.io_cryostats.yaml
index d2fa0f6..c55b204 100644
--- a/bundle/manifests/operator.cryostat.io_cryostats.yaml
+++ b/bundle/manifests/operator.cryostat.io_cryostats.yaml
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.7.0
+ controller-gen.kubebuilder.io/version: v0.9.0 |
Nice, after your latest commit all the generated files appear to be up-to-date for me too. |
I think this makes sense to do. In the future I would like the Deployment and Pod Template's labels and annotations to managed from the Cryostat CRD, but this seems like a good solution for now. I'm still a bit confused what has changed in controller-runtime to cause this test failure. |
Sure I will fix add the label and annotation merge for
The changelog could not really help :(( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.6.1
:* Update tls configuration for metrics endpoint (though still disabled).
I think we might want this (commented out) for completeness: https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.6.1/#manifestsv2-add-a-kustomize-patch-to-remove-the-cert-manager-volumevolumemount-from-your-csv
Oh yes sure I might have been confused with our manually adding cert-manager. Will update now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Makefile addition would be useful as well: https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.6.1/#gov2-gov3-ansiblev1-helmv1-add-opm-and-catalog-build-makefile-targets
We can skip the catalog-push
target since we don't have any other *-push
targets in our Makefile. We'd also want to change --container-tool docker
to --container-tool podman
. We also don't seem to have an IMAGE_TAG_BASE
in our Makefile, but you can substitute it with $(IMAGE_NAMESPACE)/$(OPERATOR_NAME)
.
Ah, In our case, feel free to define: |
ae31505
to
ded5684
Compare
@tthvo I have to apologize. It seems the Makefile tool download targets are not working as I expected. Since they all have a prerequisite of The fix coming upstream from Kubebuilder is very similar to what you had before, only using Could you add |
Actually this Kubebuilder fix looks odd. It seems like instead of using |
Ohh no problem at all! I just saw the exact same behavior when running it too and about to ask! I would just add it back with |
Right! I guess we can just use |
I think so, unless I'm missing something. Same for the other binaries. |
I am thinking whether only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! @tthvo thanks for taking on this substantial and overdue change!
Thanks a lot @ebaron for helping me in this! Its great to learn a lot more from this issue! |
I was glad to help! |
Fixes #287
Fixes #431
Related to #433
Upgraded operator-sdk to
v1.22.2
. (Actual) Changes for each version:1.6.1
:build-catalog
target to build an index image.1.7.1
:SHELL
in Makefile.v0.8.3
and k8s deps tov0.20.0
.1.8.0
: No migration1.9.0
: No migration1.10.0
: No migration1.11.0
:containerPort
field in manifest (i.e. setting to TCP).1.12.0
: No migration1.13.0
: No migration1.14.0
:controller-gen
to0.7.0
.v0.10.0
and k8s deps tov0.22.1
.0.9.0
v0.10.0
removessetup-envtest.sh
)go install
does not work with Kustomize. Issue is filed here.1.10.*
.1.15.0
: No migration1.16.0
:kubectl.kubernetes.io/default-container
to specify default manager container.undeploy/uninstall
targets.1.17.0
:0.8.0
.0.23.0
and controller-runtime to0.11.0
.0.11.0
.1.18.0
:replace
directive for gogo/protobuf since client-go new pulls1.3.2
.1.19.0
:1.20.0
: No migration1.21.0
:0.11.2
and k8s deps to0.23.5
.kube-rbac-proxy
image to0.11.0
.1.22.0
:1.18
.0.9.0
.0.12.1
and k8s deps to0.24.0
.1.20.1
: No migration1.20.2
: No migrationOthers:
go install
instead ofgo get
(deprecated) to download and build binaries.ginkgo
tov1.16.5
(having deprecated warnings - currently add env var to silence) andgomega
tov1.18.1
.1.22.0
, go version requirement is bump to1.18
.spec.selector
should be updated only on creation.1.18.*
and operator-sdk1.22.2
.