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 #1135

Merged
merged 31 commits into from
Feb 25, 2025

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

Paired PR

…TemplateTier.Status.Revisions field

Signed-off-by: Feny Mehta <[email protected]>
@fbm3307 fbm3307 requested a review from jrosental as a code owner February 17, 2025 10:18
@fbm3307
Copy link
Contributor Author

fbm3307 commented Feb 19, 2025

/test e2e
updated e2e tests with a fix

@fbm3307
Copy link
Contributor Author

fbm3307 commented Feb 20, 2025

/test-e2e
looks like flaky test failure, since paired e2e test passed

@fbm3307
Copy link
Contributor Author

fbm3307 commented Feb 20, 2025

/test e2e
unrelated failure or flaky test failure, since paired e2e test passed

Copy link
Contributor

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

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

overall looks good, I have a few comments to improve the code

@@ -49,8 +50,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, memberClusters map[strin
// watch Spaces in the host cluster
For(&toolchainv1alpha1.Space{}, builder.WithPredicates(predicate.Or(predicate.GenerationChangedPredicate{}, predicate.AnnotationChangedPredicate{}))).
Watches(&toolchainv1alpha1.NSTemplateTier{},
handler.EnqueueRequestsFromMapFunc(MapNSTemplateTierToSpaces(r.Namespace, r.Client)),
builder.WithPredicates(predicate.GenerationChangedPredicate{})).
Copy link
Contributor

Choose a reason for hiding this comment

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

as soon as we introduce the conditions, we should add a predicate to watch only ready NSTemplateSets

Copy link
Contributor Author

@fbm3307 fbm3307 Feb 20, 2025

Choose a reason for hiding this comment

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

if predicates are there, it only reconciles when there is change in spec and does not reconcile for the changes in status.revisions ,and hence the hash of space is not being updated, thats the reason i removed the predicates, ( it failed in e2e test for different hash of space label due to old hash)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or you mean some other predicate ?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I had another predicate in mind. But my comment was for later improvement, not for now. We still don't set/manage conditions in NSTemplateTiers.
cc @mfrancisc

Copy link
Contributor

Choose a reason for hiding this comment

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

@MatousJobanek what type of predicate did you had in mind for the ready condition ?

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

@mfrancisc mfrancisc left a comment

Choose a reason for hiding this comment

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

Great Job 🚀

Copy link
Contributor

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

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

could you please take a look at the CodeCov comments in pkg/templates/nstemplatetiers/nstemplatetier_refs.go file?

Signed-off-by: Feny Mehta <[email protected]>
Signed-off-by: Feny Mehta <[email protected]>
@fbm3307
Copy link
Contributor Author

fbm3307 commented Feb 24, 2025

could you please take a look at the CodeCov comments in pkg/templates/nstemplatetiers/nstemplatetier_refs.go file?

it didnt have unit tests.
i have added it now

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

openshift-ci bot commented Feb 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fbm3307, MatousJobanek, mfrancisc

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:
  • OWNERS [MatousJobanek,fbm3307,mfrancisc]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fbm3307 fbm3307 merged commit d291504 into codeready-toolchain:master Feb 25, 2025
12 of 14 checks passed
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 98.50746% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.66%. Comparing base (473c632) to head (920bf0d).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
controllers/space/space_controller.go 93.75% 1 Missing ⚠️

❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1135      +/-   ##
==========================================
+ Coverage   79.47%   79.66%   +0.19%     
==========================================
  Files          81       82       +1     
  Lines        8130     8154      +24     
==========================================
+ Hits         6461     6496      +35     
+ Misses       1481     1467      -14     
- Partials      188      191       +3     
Files with missing lines Coverage Δ
controllers/nstemplatetier/label_selector.go 55.00% <100.00%> (+55.00%) ⬆️
...ollers/nstemplatetier/nstemplatetier_controller.go 79.13% <100.00%> (-2.16%) ⬇️
...g/templates/nstemplatetiers/nstemplatetier_refs.go 100.00% <100.00%> (ø)
test/nstemplatetier/nstemplatetier.go 76.54% <100.00%> (+2.04%) ⬆️
controllers/space/space_controller.go 85.98% <93.75%> (+0.45%) ⬆️

... and 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants