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

Simplify handling of GitRepo status resources #13244

Merged
merged 11 commits into from
Feb 17, 2025

Conversation

aruiz14
Copy link
Contributor

@aruiz14 aruiz14 commented Jan 30, 2025

Summary

Change how the GitRepo status info is obtained and processed, by consuming the new fields exposed by Fleet.

Occurred changes and/or fixed issues

Fixes #13243

Technical notes summary

This PR changes (again, see #12896) the way that bundles state is processed, by iterating over the list of bundles, for simplicity.
Also:

  • It uses the new PerClusterResourceCounts status field
  • Uses the new format for Resources.perClusterState in order to build the GitRepo's resource table, getting rid of BundleDeployments altogether.
  • Fixes the resource counts in the summary of GitRepo detail pages.

Areas or cases that should be tested

Areas which could experience regressions

There is a small regression in the Resources table for GitRepos, since the info backing the Age column is no longer available. However, this field was often blank as it's not always available.

Screenshot/Video

Screenshot 2025-02-05 at 16 55 24

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

Sorry, something went wrong.

@aruiz14 aruiz14 added this to the v2.11.1 milestone Jan 30, 2025
@rancher-ui-project-bot rancher-ui-project-bot bot modified the milestones: v2.11.1, v2.11.0 Jan 30, 2025
@aruiz14 aruiz14 force-pushed the fleet-resources-rework branch from 0c7cec3 to 8de803e Compare January 31, 2025 10:26
@aruiz14 aruiz14 marked this pull request as ready for review February 5, 2025 15:58
@aruiz14 aruiz14 force-pushed the fleet-resources-rework branch from 8de803e to 25273f0 Compare February 6, 2025 15:48
Comment on lines +5 to +36
const getResourcesDefaultState = (labelGetter, stateKey) => {
return [
STATES_ENUM.READY,
STATES_ENUM.NOT_READY,
STATES_ENUM.WAIT_APPLIED,
STATES_ENUM.MODIFIED,
STATES_ENUM.MISSING,
STATES_ENUM.ORPHANED,
STATES_ENUM.UNKNOWN,
].reduce((acc, state) => {
acc[state] = {
count: 0,
color: STATES[STATES_ENUM.READY].color,
label: labelGetter(`${ stateKey }.${ STATES_ENUM.READY }`, null, STATES[STATES_ENUM.READY].label ),
status: STATES_ENUM.READY
},
info: {
count: 0,
color: STATES[STATES_ENUM.INFO].color,
label: labelGetter(`${ stateKey }.${ STATES_ENUM.INFO }`, null, STATES[STATES_ENUM.INFO].label ),
status: STATES_ENUM.INFO
},
warning: {
count: 0,
color: STATES[STATES_ENUM.WARNING].color,
label: labelGetter(`${ stateKey }.${ STATES_ENUM.WARNING }`, null, STATES[STATES_ENUM.WARNING].label ),
status: STATES_ENUM.WARNING
},
notready: {
count: 0,
color: STATES[STATES_ENUM.NOT_READY].color,
label: labelGetter(`${ stateKey }.${ STATES_ENUM.NOT_READY }`, null, STATES[STATES_ENUM.NOT_READY].label ),
status: STATES_ENUM.NOT_READY
},
error: {
count: 0,
color: STATES[STATES_ENUM.ERROR].color,
label: labelGetter(`${ stateKey }.${ STATES_ENUM.ERROR }`, null, STATES[STATES_ENUM.ERROR].label ),
status: STATES_ENUM.ERROR
},
errapplied: {
count: 0,
color: STATES[STATES_ENUM.ERR_APPLIED].color,
label: labelGetter(`${ stateKey }.${ STATES_ENUM.ERR_APPLIED }`, null, STATES[STATES_ENUM.ERR_APPLIED].label ),
status: STATES_ENUM.ERR_APPLIED,
},
waitapplied: {
count: 0,
color: STATES[STATES_ENUM.WAIT_APPLIED].color,
label: labelGetter(`${ stateKey }.${ STATES_ENUM.WAIT_APPLIED }`, null, STATES[STATES_ENUM.WAIT_APPLIED].label ),
status: STATES_ENUM.WAIT_APPLIED
},
unknown: {
color: STATES[state].color,
label: labelGetter(`${ stateKey }.${ state }`, null, STATES[state].label ),
status: state
};
return acc;
}, {});
};
const getBundlesDefaultState = (labelGetter, stateKey) => {
return [
STATES_ENUM.READY,
STATES_ENUM.INFO,
STATES_ENUM.WARNING,
STATES_ENUM.NOT_READY,
STATES_ENUM.ERROR,
STATES_ENUM.ERR_APPLIED,
STATES_ENUM.WAIT_APPLIED,
STATES_ENUM.UNKNOWN,
].reduce((acc, state) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bundles and resources can have different states (e.g. missing and orphaned, which do not make sense for bundles). The result is:
Screenshot 2025-02-06 at 16 44 47
Screenshot 2025-02-06 at 16 44 53

@aruiz14 aruiz14 force-pushed the fleet-resources-rework branch from 25273f0 to 762359e Compare February 6, 2025 16:01
@aruiz14 aruiz14 force-pushed the fleet-resources-rework branch from 56f94e2 to 23e53a9 Compare February 7, 2025 09:02
Copy link
Member

@torchiaf torchiaf left a comment

Choose a reason for hiding this comment

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

I found some regressions, let's check together offline.

@aruiz14 aruiz14 requested a review from torchiaf February 11, 2025 17:49
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
Copy link
Member

@torchiaf torchiaf left a comment

Choose a reason for hiding this comment

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

LGTM

@torchiaf torchiaf merged commit 0b764f8 into rancher:master Feb 17, 2025
30 checks passed
@aruiz14 aruiz14 deleted the fleet-resources-rework branch February 24, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify handling of GitRepo status resources
2 participants