-
Notifications
You must be signed in to change notification settings - Fork 859
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
Align federated CloneSet's observedGeneration semantics with its native #5057
Conversation
/assign @yike21 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #5057 +/- ##
==========================================
- Coverage 28.22% 28.22% -0.01%
==========================================
Files 632 632
Lines 43553 43553
==========================================
- Hits 12293 12291 -2
- Misses 30364 30366 +2
Partials 896 896
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thanks for the contribution! Can you help update the testdata files? Just like this:
This will allow the test data to characterize the new customizations.
# testdata/desired-cloneset-nginx.yaml
apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
metadata:
labels:
app: sample
name: sample
namespace: test-cloneset
generation: 1
spec:
replicas: 4
selector:
matchLabels:
app: sample
test: cloneset
template:
metadata:
labels:
app: sample
test: cloneset
spec:
volumes:
- name: configmap
configMap:
name: my-sample-config
containers:
- name: nginx
image: nginx:alpine
env:
- name: logData
valueFrom:
configMapKeyRef:
name: mysql-config
key: log
- name: lowerData
valueFrom:
configMapKeyRef:
name: mysql-config
key: lower
# testdata/observed-cloneset-nginx.yaml
apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
metadata:
annotations:
resourcetemplate.karmada.io/generation: "1"
labels:
app: sample
name: sample
namespace: test-cloneset
generation: 1
spec:
replicas: 2
selector:
matchLabels:
app: sample
test: cloneset
template:
metadata:
labels:
app: sample
test: cloneset
spec:
volumes:
- name: configmap
configMap:
name: my-sample-config
containers:
- name: nginx
image: nginx:alpine
env:
- name: logData
valueFrom:
configMapKeyRef:
name: mysql-config
key: log
- name: lowerData
valueFrom:
configMapKeyRef:
name: mysql-config
key: lower
status:
availableReplicas: 2
collisionCount: 0
currentRevision: sample-59df6bd888
expectedUpdatedReplicas: 2
labelSelector: app=sample,test=cloneset
observedGeneration: 1
readyReplicas: 2
replicas: 2
updateRevision: sample-59df6bd888
updatedReadyReplicas: 2
updatedReplicas: 2
# status-file.yaml
applied: true
clusterName: member1
health: Healthy
status:
availableReplicas: 2
currentRevision: sample-59df6bd888
expectedUpdatedReplicas: 2
generation: 1
labelSelector: app=sample,test=cloneset
observedGeneration: 1
readyReplicas: 2
replicas: 2
resourceTemplateGeneration: 1
updateRevision: sample-59df6bd888
updatedReadyReplicas: 2
updatedReplicas: 2
---
applied: true
clusterName: member3
health: Healthy
status:
availableReplicas: 2
currentRevision: sample-59df6bd888
expectedUpdatedReplicas: 2
generation: 1
labelSelector: app=sample,test=cloneset
observedGeneration: 1
readyReplicas: 2
replicas: 2
resourceTemplateGeneration: 1
updateRevision: sample-59df6bd888
updatedReadyReplicas: 2
updatedReplicas: 2
/lgtm |
It would be best if we could add this in the same PR. Other PRs can also follow this template to facilitate testing. |
|
||
-- handle resource generation report | ||
status.generation = observedObj.metadata.generation | ||
if observedObj.metadata == nil or observedObj.metadata.annotations == nil then |
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.
Shouldn't this judgment observedObj.metadata == nil
be placed two lines before the previous?
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.
fixed @XiShanYongYe-Chang
d0ce0e8
to
c2dd8a0
Compare
done. /cc @XiShanYongYe-Chang @yike21 |
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.
Thanks~
LGTM
Ask an agin review from @yike21
Hi @veophi, would you mind changing your commit user to English? It might be a more common setting. |
ok |
20adeb4
to
9abb88d
Compare
/cc @yike21 |
@@ -47,4 +49,4 @@ status: | |||
replicas: 2 | |||
updateRevision: sample-59df6bd888 | |||
updatedReadyReplicas: 2 | |||
updatedReplicas: 2 | |||
updatedReplicas: 2 |
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.
Just a format error: there should be a blank line at the end of the file.
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.
Here need a blank line at the end of the file.
valueFrom: | ||
configMapKeyRef: | ||
name: mysql-config | ||
key: lowerr |
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.
Note that the .status.observedGeneration
of the federated resource has been value 1
when the scenario with the current test data is formed ( .status.observedGeneration
of both member resource is value 1
, which means that a previous update existed that made the field for federal resource value 1
), so that the .status.observedGeneration
of the test result obtained by executing karmadactl interpret -f customizations.yaml --operation aggregateStatus --desired-file testdata/desired-cloneset-nginx.yaml --status-file testdata/status-file.yaml
will be value 1
as well. Otherwise we get value 0
by executing test-command.
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.
fixed @yike21
currentRevision = '' | ||
labelSelector = '' | ||
if desiredObj.status.observedGeneration == nil then | ||
desiredObj.status.observedGeneration = 0 |
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.
Note that .status.observedGeneration
of federated resource will be 0 when resourceTemplateGeneration == generation and memberGeneration == memberObservedGeneration
is failed.
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.
Note that
.status.observedGeneration
of federated resource will be 0 whenresourceTemplateGeneration == generation and memberGeneration == memberObservedGeneration
is failed.
I think it should be 0
if desiredObj.status.observedGeneration == nil
and resourceTemplateGeneration == generation and memberGeneration == memberObservedGeneration
is failed.
9abb88d
to
d9648e3
Compare
Signed-off-by: veophi <sunweixiang@xiaohongshu.com>
d9648e3
to
f2ad6e5
Compare
Thanks for your contribution! @veophi |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Part of #4870, #5021
Special notes for your reviewer:
Does this PR introduce a user-facing change?: