Skip to content
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

Increase .metadata.generation once desired state of the Cluster object is changed. #3241

Conversation

XiShanYongYe-Chang
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang commented Mar 6, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

We should set the generation field of the Cluster object. When the spec part of the Cluster object changes, the generation value should increase. Its value begins with 1.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Do we need to pay attention to the changes in labels and annotations of the Cluster object?

Does this PR introduce a user-facing change?:

`karmada-aggregated-apiserver`: Increase `.metadata.generation` once desired state of the `Cluster` object is changed.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 6, 2023
@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 6, 2023
pkg/registry/cluster/strategy.go Show resolved Hide resolved
pkg/registry/cluster/strategy.go Outdated Show resolved Hide resolved
@XiShanYongYe-Chang XiShanYongYe-Chang force-pushed the add-generation-id-for-cluster branch from 0f5d06d to ccbd947 Compare March 7, 2023 01:50
@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 7, 2023
@XiShanYongYe-Chang XiShanYongYe-Chang force-pushed the add-generation-id-for-cluster branch from ccbd947 to 5324ff3 Compare March 7, 2023 08:38
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 7, 2023
pkg/registry/cluster/strategy.go Show resolved Hide resolved
pkg/registry/cluster/strategy.go Show resolved Hide resolved
pkg/scheduler/event_handler.go Outdated Show resolved Hide resolved
Signed-off-by: changzhen <changzhen5@huawei.com>
@XiShanYongYe-Chang XiShanYongYe-Chang force-pushed the add-generation-id-for-cluster branch from 5324ff3 to a4753cd Compare March 9, 2023 07:05
@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 9, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #3241 (a4753cd) into master (fa0791e) will increase coverage by 0.05%.
The diff coverage is 93.33%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3241      +/-   ##
==========================================
+ Coverage   49.15%   49.20%   +0.05%     
==========================================
  Files         206      206              
  Lines       18377    18388      +11     
==========================================
+ Hits         9033     9048      +15     
+ Misses       8856     8853       -3     
+ Partials      488      487       -1     
Flag Coverage Δ
unittests 49.20% <93.33%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/scheduler/event_handler.go 26.15% <0.00%> (ø)
pkg/registry/cluster/strategy.go 61.33% <100.00%> (+6.64%) ⬆️
pkg/search/proxy/store/util.go 93.83% <0.00%> (+0.47%) ⬆️
pkg/search/proxy/store/store.go 68.42% <0.00%> (+3.15%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@RainbowMango
Copy link
Member

@Garrybest @chaunceyjiang Do you have any other comments?

Add generation filed for Cluster object.

You are not adding a field to Cluster.

@XiShanYongYe-Chang XiShanYongYe-Chang changed the title add generation for cluster object set the generation field of Cluster object Mar 9, 2023
@RainbowMango RainbowMango changed the title set the generation field of Cluster object karmada-aggregated-apiserver: Increase .metadata.generation once desired state of the Cluster object is changed. Mar 10, 2023
@RainbowMango RainbowMango changed the title karmada-aggregated-apiserver: Increase .metadata.generation once desired state of the Cluster object is changed. Increase .metadata.generation once desired state of the Cluster object is changed. Mar 10, 2023
@RainbowMango
Copy link
Member

@XiShanYongYe-Chang Have you tested it? Please share a test report here.

@chaunceyjiang
Copy link
Member

@Garrybest @chaunceyjiang Do you have any other comments?

No, LGTM

@XiShanYongYe-Chang
Copy link
Member Author

Before update:

apiVersion: cluster.karmada.io/v1alpha1
kind: Cluster
metadata:
  creationTimestamp: "2023-03-06T12:24:41Z"
  finalizers:
  - karmada.io/cluster-controller
  generation: 5
  name: member1
  resourceVersion: "804"
  uid: c2b697d0-d9cc-4e32-982b-eb7c3f50082d
spec:
  apiEndpoint: https://172.18.0.4:6443
  id: 668b5146-f8f3-4592-847a-a79c34106193
  impersonatorSecretRef:
    name: member1-impersonator
    namespace: karmada-cluster
  ...

When I update the cluster apiEndpoint field, after:

apiVersion: cluster.karmada.io/v1alpha1
kind: Cluster
metadata:
  creationTimestamp: "2023-03-06T12:24:41Z"
  finalizers:
  - karmada.io/cluster-controller
  generation: 6
  name: member1
  resourceVersion: "844527"
  uid: c2b697d0-d9cc-4e32-982b-eb7c3f50082d
spec:
  apiEndpoint: https://172.18.0.4:6444
  id: 668b5146-f8f3-4592-847a-a79c34106193
  impersonatorSecretRef:
    name: member1-impersonator
    namespace: karmada-cluster
  ...

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 10, 2023
@karmada-bot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 10, 2023
@karmada-bot karmada-bot merged commit 83c7862 into karmada-io:master Mar 10, 2023
@XiShanYongYe-Chang XiShanYongYe-Chang deleted the add-generation-id-for-cluster branch March 15, 2023 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants