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

KUBESAW-147: Space controller updates tier-hash label based on the NSTemplateTier.Status.Revisions field #454

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fbm3307
Copy link
Contributor

@fbm3307 fbm3307 commented Feb 5, 2025

This PR is to update the space controller to compute the tier-hash label value using the NSTemplateTier.Status.Revisions field so that it can match outdated spaces using the new revisions mechanism.

Jira-Link - KUBESAW-147

Related PR

…TemplateTier.Status.Revisions field

Signed-off-by: Feny Mehta <[email protected]>
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.44%. Comparing base (a9c24d8) to head (97d0884).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #454      +/-   ##
==========================================
- Coverage   78.47%   78.44%   -0.03%     
==========================================
  Files          49       49              
  Lines        2471     2468       -3     
==========================================
- Hits         1939     1936       -3     
  Misses        478      478              
  Partials       54       54              
Files with missing lines Coverage Δ
pkg/hash/hash.go 74.28% <100.00%> (-2.04%) ⬇️

pkg/hash/hash.go Outdated
Comment on lines 19 to 28
refs = append(refs, ns.TemplateRef)
refs = append(refs, tier.Status.Revisions[ns.TemplateRef])
}
if tier.Spec.ClusterResources != nil {
refs = append(refs, tier.Spec.ClusterResources.TemplateRef)
refs = append(refs, tier.Status.Revisions[tier.Spec.ClusterResources.TemplateRef])
Copy link
Contributor

Choose a reason for hiding this comment

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

As it is mentioned in the Jira and also in the design document, we should use the whole revisions map to collect the refs and compute the hash, not only specific references.
It was also mentioned in the other threads that the current logic has a bug that it doesn't include the refs of the role templates - this should be fixed by collecting all revisions from the map

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently we have extra values and we do not have the logic of delete/clean up of revisions field, thats the reason i did this https://github.com/codeready-toolchain/toolchain-common/pull/454/files#diff-1da09bec2a4b26b257932b06c7ea839cc44492e089bd8276e4ae348bc6772b78R20

if i dont do it and if there are extra values, it will mess with the hash , thats my understanding .
Thats the reason i did the specific check for now and then probably change it once we have the clean-up logic for revisions.
WDYT?

Copy link

sonarqubecloud bot commented Feb 6, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
60.0% Duplication on New Code (required ≤ 30%)

See analysis details on SonarQube Cloud

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.

2 participants