fix propagation bug when resource create before lazy policy applied
What type of PR is this?
/kind bug
What this PR does / why we need it:
fix propagation bug when resource create before lazy policy applied:
first create a deployment and then create a lazy policy(activationPreference=lazy)
if then we delete this lazy policy, then this deployment will never be matched by any following new policies.
detail refers to #5348
Which issue(s) this PR fixes:
Fixes #5348
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
Attention: Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
Project coverage is 29.34%. Comparing base (
052b06e) to head (e9e14aa). Report is 38 commits behind head on master.
| Files | Patch % | Lines |
|---|---|---|
| pkg/detector/detector.go | 0.00% | 26 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #5349 +/- ##
==========================================
+ Coverage 28.45% 29.34% +0.89%
==========================================
Files 632 632
Lines 43856 43878 +22
==========================================
+ Hits 12481 12878 +397
+ Misses 30472 30067 -405
- Partials 903 933 +30
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 29.34% <0.00%> (+0.89%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Just recording, not related to this PR...
CI failure: https://github.com/karmada-io/karmada/actions/runs/10331176206/job/28601118594?pr=5349
Work (member2)
"status": {
"conditions": [
{
"type": "Dispatching",
"status": "True",
"lastTransitionTime": "2024-08-10T11:34:37Z",
"reason": "Dispatching",
"message": "Work is being dispatched to member clusters."
},
{
"type": "Applied",
"status": "False",
"lastTransitionTime": "2024-08-10T11:34:38Z",
"reason": "AppliedFailed",
"message": "Failed to apply all manifests (0/1): Operation cannot be fulfilled on deployments.apps \"deploy-4ptf8\": the object has been modified; please apply your changes to the latest version and try again"
}
],
"manifestStatuses": [
{
"identifier": {
"ordinal": 0,
"group": "apps",
"version": "v1",
"kind": "Deployment",
"resource": "",
"namespace": "karmadatest-ndw6b",
"name": "deploy-4ptf8"
},
"status": {
"availableReplicas": 2,
"generation": 3,
"observedGeneration": 3,
"readyReplicas": 2,
"replicas": 2,
"resourceTemplateGeneration": 4,
"updatedReplicas": 2
},
"health": "Healthy"
}
]
}
RB
"aggregatedStatus": [
{
"clusterName": "member1",
"status": {
"availableReplicas": 2,
"generation": 4,
"observedGeneration": 4,
"readyReplicas": 2,
"replicas": 2,
"resourceTemplateGeneration": 4,
"updatedReplicas": 2
},
"applied": true,
"health": "Healthy"
},
{
"clusterName": "member2",
"appliedMessage": "Failed to apply all manifests (0/1): Operation cannot be fulfilled on deployments.apps \"deploy-4ptf8\": the object has been modified; please apply your changes to the latest version and try again",
"health": "Unknown"
}
]
}
Deployment
"status": {
"availableReplicas": 2,
"observedGeneration": 3,
"readyReplicas": 2,
"replicas": 2,
"updatedReplicas": 2
}
logs
2024-08-10T11:34:38.390330198Z stderr F E0810 11:34:38.390157 1 objectwatcher.go:169] Failed to update resource(kind=Deployment, karmadatest-ndw6b/deploy-4ptf8) in cluster member2, err: Operation cannot be fulfilled on deployments.apps "deploy-4ptf8": the object has been modified; please apply your changes to the latest version and try again.
2024-08-10T11:34:38.390560231Z stderr F E0810 11:34:38.390505 1 execution_controller.go:208] Failed to create or update resource(karmadatest-ndw6b/deploy-4ptf8) in the given member cluster member2, err is Operation cannot be fulfilled on deployments.apps "deploy-4ptf8": the object has been modified; please apply your changes to the latest version and try again
2024-08-10T11:34:38.527329822Z stderr F E0810 11:34:38.488605 1 execution_controller.go:150] Failed to sync work(karmada-es-member2/deploy-4ptf8-654d4fb84c) to cluster(member2), err: Operation cannot be fulfilled on deployments.apps "deploy-4ptf8": the object has been modified; please apply your changes to the latest version and try again
2024-08-10T11:34:38.527710748Z stderr F E0810 11:34:38.527386 1 controller.go:324] "Reconciler error" err="Operation cannot be fulfilled on deployments.apps \"deploy-4ptf8\": the object has been modified; please apply your changes to the latest version and try again" controller="work" controllerGroup="work.karmada.io" controllerKind="Work" Work="karmada-es-member2/deploy-4ptf8-654d4fb84c" namespace="karmada-es-member2" name="deploy-4ptf8-654d4fb84c" reconcileID="975444f0-24cb-4faf-af39-8aeee758f3ad"
...
2024-08-10T11:34:38.532659245Z stderr F I0810 11:34:38.532592 1 execution_controller.go:76] Reconciling Work karmada-es-member2/deploy-4ptf8-654d4fb84c
2024-08-10T11:34:38.550410018Z stderr F I0810 11:34:38.550334 1 objectwatcher.go:173] Updated the resource(kind=Deployment, karmadatest-ndw6b/deploy-4ptf8) on cluster(member2).
2024-08-10T11:34:38.551362429Z stderr F I0810 11:34:38.551304 1 execution_controller.go:155] Sync work(karmada-es-member2/deploy-4ptf8-654d4fb84c) to cluster(member2) successful.
/retest
/cc @chaunceyjiang can you please help reviewing it?
/cc @XiShanYongYe-Chang can you please help reviewing it?
Thanks @chaosi-zju /assign
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from xishanyongye-chang. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment