-
Notifications
You must be signed in to change notification settings - Fork 105
Fix dry runs (--check) erroneously reporting changes #99
Conversation
OPS-3453 - Pass dry_run=All to OpenShift when check mode is enabled.
Codecov Report
@@ Coverage Diff @@
## main #99 +/- ##
==========================================
- Coverage 42.50% 42.37% -0.14%
==========================================
Files 4 4
Lines 614 616 +2
Branches 122 123 +1
==========================================
Hits 261 261
- Misses 306 307 +1
- Partials 47 48 +1
Continue to review full report at Codecov.
|
@shaunsmiley-xevo - Would #84 resolve this issue as well? |
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.
Since this will require an updated version of the openshift
client to work properly, would it be possible to fall back to the old behavior unless you have openshift >= 0.11.1
?
edit: Also I believe dryRun was added in kubernetes 1.18, so we should probably fall back to the old behavior for kubernetes versions < 1.18
as well
@fabianvf given that this passes all test cases, we should probably ensure we have more test cases for check mode |
We tested this and #84 didn't fix the dry run issue. |
We are working on a fix to revert back to the old logic if the |
@mgogoi makes sense, thanks a ton! |
My thoughts on this are that this is usually a bug in our implementation of apply in the openshift library and all such bugs should be eliminated there (or here where it's not a bug in the openshift library). If there are outstanding test cases, then I'd be interested to see them (the test suite for apply is getting more and more extensive as I eliminate such bugs as I find them). I'm already running |
Revert back to the old logic when openshift version < 0.11.1
@mgogoi's PR on our fork to revert behavior if openshift version is < 0.11.1 has been tested on our end and merged. It is now included in this PR. |
@willthames I think if we can use the dry run API it makes sense to, it can only be more accurate than whatever we do client side |
Can we have some tests that exercise this? Not really sure how best to test the matrix of old and new openshift versions and old and new kubernetes clusters automatically but the tests would be a start, can always run the variations manually. |
@willthames - I am a bit unsure how to execute those tests. Could you please help me run those before I could add some new ones? |
@mgogoi sure, happy to help. Basically you need any kubernetes cluster (e.g. docker desktop, minikube, KinD) up and running. Install |
SUMMARY
Fix --check mode reporting changes when there are none.
These issues are possibly related:
Previously -
Now -
#189
#190
ISSUE TYPE
COMPONENT NAME
raw.py
ADDITIONAL INFORMATION
We know that we can run an ansible playbook using the k8s module over and over and see no changes (i.e. reports OK, not CHANGED). However, we decided to add an additional step to validate which k8s tasks would change and what the changes were before executing with --check mode.
We found that when we turned --check mode on from the cli, the k8s module reported changes every time, even when there would be no changes. We confirmed this by running again without check mode seeing everything show OK (for 20+ different k8s manifests) then seeing everything show CHANGED with --check mode enabled.
This fix also required a fix in the openshift lib. That PR is here: openshift/openshift-restclient-python#360
We are using both patches locally, and have tested internally that it is now working as expected.