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

add new cluster condition: CompleteAPIEnablements #5400

Merged

Conversation

whitewindmills
Copy link
Member

@whitewindmills whitewindmills commented Aug 19, 2024

What type of PR is this?
/kind feature

What this PR does / why we need it:

since #5325 is closed, I open this PR to do it.

Which issue(s) this PR fixes:
Fixes #1804

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Introduced a new condition `CompleteAPIEnablements` to `Cluster` API to represent the API collection status.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 19, 2024
@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 19, 2024
@whitewindmills
Copy link
Member Author

@XiShanYongYe-Chang could you help with this PR?

@XiShanYongYe-Chang
Copy link
Member

Thanks @whitewindmills
/assign

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.

Project coverage is 34.15%. Comparing base (4dfff39) to head (3307a52).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...kg/controllers/status/cluster_status_controller.go 64.70% 6 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5400      +/-   ##
==========================================
+ Coverage   33.86%   34.15%   +0.29%     
==========================================
  Files         643      643              
  Lines       44509    44522      +13     
==========================================
+ Hits        15072    15206     +134     
+ Misses      28288    28160     -128     
- Partials     1149     1156       +7     
Flag Coverage Δ
unittests 34.15% <64.70%> (+0.29%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@whitewindmills whitewindmills force-pushed the apienablement-condition branch from 1a949d8 to 693d5ce Compare August 20, 2024 09:35
@whitewindmills
Copy link
Member Author

@XiShanYongYe-Chang PTAL

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

/lgtm
/cc @RainbowMango

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2024
@whitewindmills whitewindmills changed the title add new cluster condition: InvalidAPIEnablements add new cluster condition: IncompleteAPIEnablements Aug 21, 2024
@whitewindmills
Copy link
Member Author

/assign @RainbowMango

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.

I'm still thinking another approach:

In some cases, the controller can't collect a full list of API list continuously, such as there is a broken APIService in the member cluster, and thus will block the controller update the status of the Cluster object. And that's exactly the reason that we accept the partial list.

I'm thinking what if we just skip the .status.apiEnablements updating in case of we can't get full list of APIs? Is it doable?

pkg/apis/cluster/v1alpha1/types.go Outdated Show resolved Hide resolved
@whitewindmills
Copy link
Member Author

I'm thinking what if we just skip the .status.apiEnablements updating in case of we can't get full list of APIs? Is it doable?

yes, this pr won't block the controller update.

@whitewindmills whitewindmills force-pushed the apienablement-condition branch from 693d5ce to 30b32c5 Compare August 28, 2024 11:24
@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 28, 2024
@XiShanYongYe-Chang
Copy link
Member

I'm thinking what if we just skip the .status.apiEnablements updating in case of we can't get full list of APIs? Is it doable?

I had the same idea. Analyze the length of err or apienablements. Only update the status if err is not empty and apienablements is not empty.

@whitewindmills whitewindmills changed the title add new cluster condition: IncompleteAPIEnablements add new cluster condition: CompleteAPIEnablements Sep 3, 2024
@whitewindmills
Copy link
Member Author

I'm thinking what if we just skip the .status.apiEnablements updating in case of we can't get full list of APIs? Is it doable?

assuming this is the case, if a user installs a new CRD, this means that the new CRD will not be updated to the cluster state, resulting in the failure to propagate such CRs.

@whitewindmills
Copy link
Member Author

at least the current situation is that if an API exists in the cluster state, we can consider it reliable, but if an API does not exist, we cannot consider it reliable.

@chaunceyjiang
Copy link
Member

I'm thinking what if we just skip the .status.apiEnablements updating in case of we can't get full list of APIs? Is it doable?

Our scheduling plugin APIEnablement checks if the resource kind is present in cluster.status.apiEnablements. If not, it won't propagate to the member clusters.

@whitewindmills
Copy link
Member Author

ping @RainbowMango

@whitewindmills
Copy link
Member Author

@RainbowMango @XiShanYongYe-Chang @chaunceyjiang
could you help move it forward, it's very important for us.

@RainbowMango
Copy link
Member

Sure! Sorry, too many on my plate recently, it is also very important to the project.

@RainbowMango
Copy link
Member

Please help to rebase this as the test matrix changed after release-1.11.

@RainbowMango RainbowMango added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Sep 13, 2024
@RainbowMango
Copy link
Member

Also, we need a release notes for this, this kind of API change.

@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 Sep 13, 2024
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

Since no tests cover this so far, have you tested it locally?

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 13, 2024
@RainbowMango
Copy link
Member

I happen to see the conditions on my local environment:

  - lastTransitionTime: "2024-09-13T09:04:15Z"
    message: might collect partial APIEnablements(22) from the cluster
    reason: PartialAPIEnablements
    status: "False"
    type: CompleteAPIEnablements

And

  - lastTransitionTime: "2024-09-13T09:05:35Z"
    message: collected complete APIEnablements from the cluster
    reason: CompleteAPIEnablements
    status: "True"
    type: CompleteAPIEnablements

Do you think we should have a shorter reason? Like Complete/Partial/Empty?

@whitewindmills
Copy link
Member Author

Do you think we should have a shorter reason? Like Complete/Partial/Empty?

looks reasonable.

@whitewindmills
Copy link
Member Author

have you tested it locally?

yes, I did test it but forgot to paste the result here.

Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 13, 2024
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 Sep 14, 2024
@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 Sep 14, 2024
@karmada-bot karmada-bot merged commit e76ce63 into karmada-io:master Sep 14, 2024
12 checks passed
@whitewindmills whitewindmills deleted the apienablement-condition branch September 14, 2024 01:44
@RainbowMango
Copy link
Member

@yanfeng1992 @whitewindmills @chaunceyjiang
Although this PR includes API changes and seems unsuitable for backport, given the significant potential impact, I think it is necessary to backport it to the release branches. What do you think?

By the way, introducing the condition doesn't break backward compatibility, and @XiShanYongYe-Chang has run some tests with it.

@whitewindmills
Copy link
Member Author

sounds good!

karmada-bot added a commit that referenced this pull request Dec 11, 2024
…k-of-#5400-upstream-release-1.9

Automated cherry pick of #5400, #5216
karmada-bot added a commit that referenced this pull request Dec 11, 2024
…k-of-#5400-upstream-release-1.10

Automated cherry pick of #5400, #5216
karmada-bot added a commit that referenced this pull request Dec 11, 2024
…k-of-#5400-upstream-release-1.11

Automated cherry pick of #5400, #5216
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/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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.

6 participants