-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# entries is a list of entries to include in | ||
# release notes and/or the migration guide | ||
entries: | ||
- description: > | ||
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. | ||
kind: "bugfix" | ||
|
||
# Is this a breaking change? | ||
breaking: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
- hosts: localhost | ||
gather_facts: no | ||
collections: | ||
- kubernetes.core | ||
- operator_sdk.util | ||
|
||
tasks: | ||
- debug: | ||
msg: "Pausing until configmap exists" | ||
|
||
- name: Wait for configmap | ||
k8s_info: | ||
api_version: v1 | ||
kind: ConfigMap | ||
name: finalizer-concurrency-results | ||
namespace: osdk-test | ||
wait: yes | ||
wait_sleep: 10 | ||
wait_timeout: 30 | ||
|
||
- name: Update configmap | ||
k8s: | ||
state: present | ||
force: yes | ||
definition: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: finalizer-concurrency-results | ||
namespace: osdk-test | ||
data: | ||
finalizer: "success" | ||
wait: yes |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a reason the file is There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
k8s: | ||
state: present | ||
definition: | ||
apiVersion: test.example.com/v1alpha1 | ||
kind: FinalizerConcurrencyTest | ||
metadata: | ||
name: finalizer-concurrency-test | ||
namespace: '{{ namespace }}' | ||
wait: no | ||
|
||
- name: While reconcile is paused, delete the CR | ||
k8s: | ||
state: absent | ||
definition: | ||
apiVersion: test.example.com/v1alpha1 | ||
kind: FinalizerConcurrencyTest | ||
metadata: | ||
name: finalizer-concurrency-test | ||
namespace: '{{ namespace }}' | ||
wait: no | ||
|
||
- name: Create a configmap to allow reconciliation to unpause | ||
k8s: | ||
state: present | ||
definition: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: finalizer-concurrency-results | ||
namespace: osdk-test | ||
wait: no | ||
|
||
- name: Wait for the custom resource to be deleted | ||
k8s_info: | ||
api_version: test.example.com/v1alpha1 | ||
kind: FinalizerConcurrencyTest | ||
namespace: osdk-test # TODO(asmacdo) Fixme | ||
name: finalizer-concurrency-test | ||
register: cr | ||
retries: 10 | ||
delay: 6 | ||
until: not cr.resources | ||
failed_when: cr.resources | ||
|
||
- name: Retrive the cm | ||
k8s_info: | ||
api_version: v1 | ||
kind: ConfigMap | ||
name: finalizer-concurrency-results | ||
namespace: osdk-test | ||
register: finalizer_test | ||
|
||
- name: Assert that finalizer ran | ||
assert: | ||
that: finalizer_test.resources.0.data.finalizer== 'success' |
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.
@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.