-
Notifications
You must be signed in to change notification settings - Fork 187
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
Improve HelmRepository type switching from default to oci #1016
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
darkowlzz
force-pushed
the
condn-checker-with-t
branch
4 times, most recently
from
February 2, 2023 21:39
8fb5a1e
to
481a36a
Compare
hiddeco
reviewed
Feb 2, 2023
darkowlzz
changed the title
[Draft] test: Use condition checker with gomega WithT
Improve HelmRepository type switching from default to oci
Feb 2, 2023
darkowlzz
added
area/helm
Helm related issues and pull requests
area/oci
OCI related issues and pull requests
labels
Feb 2, 2023
darkowlzz
force-pushed
the
condn-checker-with-t
branch
3 times, most recently
from
February 6, 2023 10:43
206f751
to
b87ac82
Compare
I've added log and event for when HelmRepositoryOCIReconciler encounters an object with unmanaged conditions. This will make the scenario more visible for users and administrators if and when this happens. {"level":"info","ts":"2023-02-06T16:10:12.432+0530","msg":"object contains conditions managed by other reconciler","controller":"helmrepository","controllerGroup":"source.toolkit.fluxcd.io","controllerKind":"HelmRepository","HelmRepository":{"name":"example","namespace":"test-1"},"namespace":"test-1","name":"example","reconcileID":"40a0dd49-0cf1-44b0-88bb-e912fc4c272d"} Events: LAST SEEN TYPE REASON OBJECT MESSAGE
42s Normal NewArtifact helmrepository/example stored fetched index of size 40.9kB from 'https://stefanprodan.github.io/podinfo'
11s Normal IncompleteTransition helmrepository/example object contains conditions managed by other reconciler
11s Normal GarbageCollectionSucceeded helmrepository/example garbage collected artifacts for deleted resource
10s Normal Succeeded helmrepository/example Helm repository is ready Introduced a new event reason |
This allows using the condition checker as a test helper with proper test like assertion failure and stacktrace. Signed-off-by: Sunny <darkowlzz@protonmail.com>
When a HelmRepository with "default" spec.type is switched to "oci", the existing HelmRepository is processed by HelmRepositoryReconciler by running reconcileDelete() which removes all the previous status information and allows the HelmRepositoryOCIReconciler to process the object and add its own status data. But at times, when HelmRepositoryOCIReconciler starts processing a HelmRepository with stale status data from the client cache, it contains the stale conditions that are owned only by HelmRepositoryReconciler and isn't managed by HelmRepositoryOCIReconciler. This results in situations where Ready is marked as True with the latest generation of the object and the unmanaged stale conditions remain in the previous generation, resulting in unexpected status conditions. In the observed flaky tests, `TestHelmRepositoryReconciler_ReconcileTypeUpdatePredicateFilter` would fail because of stale ArtifactInStorage condition with previous generation value. This change adds a check in the HelmRepositoryOCIReconciler to start processing the object only once the stale unmanaged conditions have been removed. Signed-off-by: Sunny <darkowlzz@protonmail.com>
darkowlzz
force-pushed
the
condn-checker-with-t
branch
from
February 7, 2023 14:42
b87ac82
to
42bc3e8
Compare
hiddeco
approved these changes
Feb 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/helm
Helm related issues and pull requests
area/oci
OCI related issues and pull requests
area/testing
Testing related issues and pull requests
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on fluxcd/pkg#458When a HelmRepository with "default"
spec.type
is switched to "oci", theexisting HelmRepository is processed by HelmRepositoryReconciler by
running
reconcileDelete()
which removes all the previous statusinformation and allows the HelmRepositoryOCIReconciler to process the
object and add its own status data. But at times, when
HelmRepositoryOCIReconciler starts processing a HelmRepository with
stale status data from the client cache, it contains the stale
conditions that are owned only by HelmRepositoryReconciler and isn't
managed by HelmRepositoryOCIReconciler. This results in situations where
Ready is marked as True with the latest generation of the object and the
unmanaged stale conditions remain in the previous generation, resulting
in unexpected status conditions.
In the observed flaky tests,
TestHelmRepositoryReconciler_ReconcileTypeUpdatePredicateFilter
wouldfail because of the stale
ArtifactInStorage
condition with previousgeneration value.
This change adds a check in the HelmRepositoryOCIReconciler to start
processing the object only once the stale unmanaged conditions have been
removed.