Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Bump operator sdk v1.13.0 #376

Merged
merged 2 commits into from
Feb 2, 2022
Merged

Bump operator sdk v1.13.0 #376

merged 2 commits into from
Feb 2, 2022

Conversation

AKamyshnikova
Copy link
Contributor

Q A
Bug fix? []
New feature? [x]
API breaks? []
Deprecations? []
Related tickets fixes #X, partially #Y, mentioned in #Z
License Apache 2.0

What's in this PR?

Use latest operator-sdk version.

Fixes #351

Additional context

v1.x.x of operator-sdk contains several breaking changes and require massive refactor of operator structure.
https://sdk.operatorframework.io/docs/building-operators/golang/migration/

Checklist

  • [x ] Implementation tested
  • Logging code meets the guideline
  • User guide and development docs updated (if needed)
  • Append changelog

To Do

Work is still in progress.
Multi-casskop is not finally switched yet.

@AKamyshnikova
Copy link
Contributor Author

@cscetbon Hi! Could you upload newer version of casskop-build with v1.13.0 tag to orangeopensource? So I can update circleci settings as well.

@cscetbon
Copy link
Contributor

cscetbon commented Dec 1, 2021

@cscetbon Hi! Could you upload newer version of casskop-build with v1.13.0 tag to orangeopensource? So I can update circleci settings as well.

@AKamyshnikova Done ✅

@AKamyshnikova
Copy link
Contributor Author

@cscetbon Thanks!
I faced issues with update-crds - it passes locally, but fails in CI...
Why we need such workaround for updating CRDs?
Seems that v1alpha1 folders has been renamed to v2 and it broke compatibility, so we need to leave v1alpha1 folders for backward compatibility. Was this considered?

@cscetbon
Copy link
Contributor

cscetbon commented Dec 2, 2021

That was for existing clusters. If you have to get rid of v1 do it

@AKamyshnikova
Copy link
Contributor Author

@cscetbon
I just a little bit confused, I don't get any diff after running "make generate" locally. circleci/Dockerfile uses older controller-gen version, may be this is the problem. Sorry to bother, could you rebuild and upload casskop-build with v1.13.0 tag one more time? I've updated controller-gen version in latest commit.

@cscetbon
Copy link
Contributor

cscetbon commented Dec 7, 2021

@AKamyshnikova I just did it again 😉

Upgrade to operator-sdk 1.x version requires major structure
refactoring [1].
Current commit updates file structure.

[1] - https://sdk.operatorframework.io/docs/building-operators/golang/migration/

Signed-off-by: akamyshnikova <akamyshnikova@mirantis.com>
@AKamyshnikova
Copy link
Contributor Author

@cscetbon This pull request is ready for review.

@cscetbon
Copy link
Contributor

@AKamyshnikova it seems to be a big work. Not sure why kustomize is used but I started to review your PR, not done yet. But e2e tests are failing and you can fix them in the meantime ?

@AKamyshnikova
Copy link
Contributor Author

@cscetbon Yeah, will fix this. Kustomize is part of new things with v1.x https://sdk.operatorframework.io/docs/building-operators/golang/migration/#what-is-new

@cscetbon
Copy link
Contributor

@AKamyshnikova lmk when it's ready and I'll rerun the tests. You can try them locally using k3d like circle does

Copy link
Contributor

@cscetbon cscetbon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKamyshnikova a few comments. I like what you did. I would probably have done the renaming in a different PR to keep that one small but it's okay. thanks for your hard work !

.circleci/config.yml Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
api/v2/zz_generated.deepcopy.go Show resolved Hide resolved
controllers/cassandrabackup/cassandrabackup_controller.go Outdated Show resolved Hide resolved
controllers/suite_test.go Outdated Show resolved Hide resolved
multi-casskop/api/v2/cassandramulticluster_types.go Outdated Show resolved Hide resolved
@cscetbon
Copy link
Contributor

@AKamyshnikova trying to rerun tests on your branch I see that TestCassandraBackupAlreadyExists is failing. let me know when you think it's ready

@AKamyshnikova
Copy link
Contributor Author

@cscetbon I've updated client-go to v.22.0 and controller-runtime to v0.9.0 - it seems to break unittests. I reverted to use v.0.19.3 and v0.6.5, I think update of these dependencies can be done in separate pull request as requires some additional work. Now tests are passing.

@cscetbon
Copy link
Contributor

👏 @AKamyshnikova unit tests are fixed now. e2e tests are failing though because of an error with helm

go: unknown environment setting GO111MODULE=true
helm install ******* helm/cassandra-operator --set image.tag=trigger-integration
Error: INSTALLATION FAILED: failed to install CRD crds/*.yaml: no objects visited
make: *** [Makefile:279: kuttl-test-fix-arg] Error 1

@AKamyshnikova
Copy link
Contributor Author

@cscetbon Seems I accidentally created file helm/cassandra-operator/crds/*.yaml :( I dropped it now.

@cscetbon
Copy link
Contributor

Helm install doesn't fail anymore but e2e are failing. It seems it can't find the status key in the object for some reason

@AKamyshnikova
Copy link
Contributor Author

@cscetbon One of changes is that ready is dropped https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.0.0/#removed-package-pkgready I missed that helm templates require update for this, fixed now.

@cscetbon
Copy link
Contributor

e2e Tests ran again. Still missing status key in k8s object

@AKamyshnikova
Copy link
Contributor Author

e2e Tests ran again. Still missing status key in k8s object

I run tests locally and don't get missing .status I'm not sure how to debug this for now.

@AKamyshnikova
Copy link
Contributor Author

@cscetbon Hi! Could you allow running rest of the checks? I dropped +kubebuilder:subresource:status in latest patch set, may be this was a problem.

@cscetbon
Copy link
Contributor

@cscetbon Hi! Could you allow running rest of the checks? I dropped +kubebuilder:subresource:status in latest patch set, may be this was a problem.

Better now. There is one remaining task failing but I'm not sure it's on you this time. I'm gonna review it. If in the meantime you think the failing test is on you don't hesitate to fix it 😉

@AKamyshnikova
Copy link
Contributor Author

I checked and was some strange diff in two website/static/slides*.js files, hopefully fixed now.

Copy link
Contributor

@cscetbon cscetbon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hard work. A few comments and changes asked. Also do you know what would be the impact for a person who's already running the current version to move to this one ?

config/crd/kustomization.yaml Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: cassandraclusters.db.orange.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do those files have any impact on an existing cluster ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will drop this, this is not enabled via kustomization.yaml so do not effect anything.

config/samples/db.orange.com_v2_cassandrarestore.yaml Outdated Show resolved Hide resolved
docker/circleci/Dockerfile Show resolved Hide resolved
main.go Show resolved Hide resolved
multi-casskop/.gitignore Outdated Show resolved Hide resolved
@@ -25,7 +25,7 @@ kubectl create namespace cassandra-demo
kubectl config set-context $(kubectl config current-context) --namespace=cassandra-demo

echo "Create CRD"
kubectl apply -f deploy/crds/db.orange.com_cassandraclusters_crd.yaml
kubectl apply -f config/crd/bases/db.orange.com_cassandraclusters.yaml

echo "configure helm"
helm init
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use dind anymore. We use k3d, let's get rid of dind files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKamyshnikova it's still present 👆

@AKamyshnikova
Copy link
Contributor Author

Thanks for the hard work. A few comments and changes asked. Also do you know what would be the impact for a person who's already running the current version to move to this one ?

While I was testing this pull request I've updated my test cluster (which use casskop v2.0.2 and has cassandra clusters) with this version and things work in the same way. So, from user perspective it would be just update to latest version, no additional steps will be needed.
Thanks for review! I will try to resolve comments soon.

Refactor pkg/apis and pkg/controller folders

Signed-off-by: akamyshnikova <akamyshnikova@mirantis.com>
@cscetbon
Copy link
Contributor

@AKamyshnikova please try to not force push anymore, it's hard for me to review your last changes. As soon as a review has started you shouldn't force push anymore, that way only the changes can be reviewed and not the whole thing every time.

@cscetbon
Copy link
Contributor

Thanks for review! I will try to resolve comments soon.

Let me know when it's ready for review. Also I tried to rerun an old PR tests and the deploy works there. So there must be something wrong on your branch. Take a look at https://app.circleci.com/pipelines/github/Orange-OpenSource/casskop/1840/workflows/ef53e126-ec4b-453c-959d-2d3c20a7b52c/jobs/18369

@AKamyshnikova
Copy link
Contributor Author

@cscetbon Sorry, I'm not used to github review process. Always has gerrit review for this :) Will keep that in mind.

@AKamyshnikova
Copy link
Contributor Author

Yes, it is ready for review. Can you suggest how I can fix this branch?

@fdehay
Copy link
Member

fdehay commented Feb 1, 2022

hello @AKamyshnikova ,
I fixed the circle-ci to github connection issue. It should be ok to run the tests now I think
Thanks for your hard work!

@AKamyshnikova
Copy link
Contributor Author

@fdehay Thank you!

@@ -25,7 +25,7 @@ kubectl create namespace cassandra-demo
kubectl config set-context $(kubectl config current-context) --namespace=cassandra-demo

echo "Create CRD"
kubectl apply -f deploy/crds/db.orange.com_cassandraclusters_crd.yaml
kubectl apply -f config/crd/bases/db.orange.com_cassandraclusters.yaml

echo "configure helm"
helm init
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKamyshnikova it's still present 👆

@cscetbon cscetbon merged commit ea18f98 into Orange-OpenSource:master Feb 2, 2022
@cscetbon
Copy link
Contributor

cscetbon commented Feb 2, 2022

Thanks @AKamyshnikova I'll take care of the few minor things I've seen. We'll try to test it more before making any new release and open issues if we find some

@cscetbon cscetbon mentioned this pull request Mar 9, 2022
@cscetbon
Copy link
Contributor

@AKamyshnikova any idea why in that PR you've renamed the CRD file ?

diff --git a/multi-casskop/deploy/crds/db.orange.com_multicasskops.yaml b/multi-casskop/config/crd/bases/multicluster_v1alpha1_cassandramulticluster_crd.yaml
similarity index 100%
rename from multi-casskop/deploy/crds/db.orange.com_multicasskops.yaml
rename to multi-casskop/config/crd/bases/multicluster_v1alpha1_cassandramulticluster_crd.yaml

You might want to create a PR to fix that PR. If yes, I moved the repo to https://github.com/cscetbon/casskop. You can be the 1st to create a PR there. I still need to create a PR here to redirect to my repo as I'm taking over from there.

@AKamyshnikova
Copy link
Contributor Author

@cscetbon It is the name that is generated by controller-gen.
File with such name will always be created, to save old name we can only drop the one that are generated.
Something like this I did in PR with dump to 0.19
9c60518#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R185

@cscetbon
Copy link
Contributor

But why does it have v1alpha1 in its name ? I'm also fixing an issue in the backup/restore that was introduced by the upgrade of the sdk operator.

@AKamyshnikova
Copy link
Contributor Author

I guess because when I start working on PR it was v1alpha1, I send PR with fixes cscetbon/casskop#29
Please point to issues you found and I will try to help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to latest operator-sdk
3 participants