Skip to content
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

Fix ansible-operator finalizer concurrency issue #5678

Merged

Conversation

asmacdo
Copy link
Member

@asmacdo asmacdo commented Apr 25, 2022

For ansible-based operators, this change fixes an issue that caused
finalizers to fail to run if the watched resource (CR) is deleted during
reconciliation.

Fixes #4909

Signed-off-by: Austin Macdonald austin@redhat.com

Description of the change:

Motivation for the change:

Checklist

If the pull request includes user-facing changes, extra documentation is required:

For ansible-based operators, this change fixes an issue that caused
finalizers to fail to run if the watched resource (CR) is deleted during
reconciliation.

Fixes operator-framework#4909

Signed-off-by: Austin Macdonald <austin@redhat.com>
@asmacdo asmacdo force-pushed the 4909-fix-ansible-finalizer-race branch from ff4991c to 5d3b1c3 Compare April 25, 2022 14:51
Signed-off-by: Austin Macdonald <austin@redhat.com>
Signed-off-by: Austin Macdonald <austin@redhat.com>
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

The changes look good and make sense to me, but because I feel I don't know enough about Ansible operators I will leave explicit approval to someone more knowledgeable.

Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

/lgtm

Just a couple nits but they can be fixed later if we want. The biggest one is the makefile targets should be in a .PHONY.

Makefile Outdated Show resolved Hide resolved
@@ -0,0 +1,58 @@
---
# TODO(asmacdo) this should be the only task. the other is getting magiced in
- name: Create the test.example.com/v1alpha1.FinalizerConcurrencyTest
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason the file is finalizerconcurrencytest_test? vs finalizerconcurrency_test?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but its not a good one. The testdata generation takes the Kind name "FinalizerConcurrenctTest" and automagically creates a verify task finalizerconcurrencytest_test. Rather than delete that and put mine in place, I just clobbered it.

hack/tests/e2e-ansible-molecule.sh Outdated Show resolved Hide resolved
@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Apr 27, 2022
@asmacdo asmacdo added this to the v1.20.0 milestone Apr 28, 2022
@asmacdo asmacdo force-pushed the 4909-fix-ansible-finalizer-race branch from 6143ae2 to 518595e Compare April 28, 2022 15:26
Signed-off-by: Austin Macdonald <austin@redhat.com>
@asmacdo asmacdo force-pushed the 4909-fix-ansible-finalizer-race branch from 518595e to 18936db Compare April 28, 2022 15:37
@@ -156,10 +156,16 @@ e2e_targets := test-e2e $(e2e_tests)
export KIND_CLUSTER := osdk-test

KUBEBUILDER_ASSETS = $(PWD)/$(shell go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest && $(shell go env GOPATH)/bin/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir tools/bin/ -p path)
test-e2e-setup: build
test-e2e-setup:: build dev-install cluster-create
Copy link
Member Author

@asmacdo asmacdo Apr 28, 2022

Choose a reason for hiding this comment

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

@ryantking Since you just changed this thought you might want to have a look. After digging in, the memcached-molecule test needs to create its own cluster, so I had to separate the make targets.

@asmacdo asmacdo modified the milestones: v1.20.0, v1.21.0 Apr 28, 2022
Signed-off-by: Austin Macdonald <austin@redhat.com>
Copy link
Member

@laxmikantbpandhare laxmikantbpandhare left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 28, 2022
@asmacdo asmacdo modified the milestones: v1.21.0, v1.20.0 Apr 28, 2022
@asmacdo asmacdo merged commit fee9778 into operator-framework:master Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ansible operator finalizer is not called when CR is deleted during a reconcile
4 participants