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

Consumed capacity info in SpaceProvisionerConfig #1109

Conversation

metlos
Copy link
Contributor

@metlos metlos commented Dec 6, 2024

This updates the status of the SpaceProvisionerConfig with "consumed capacity" info copied from ToolchainStatus.

This info is also used for readiness computation of the SPC. The logic is more or less duplicated in the capacity manager so no behavioral changes should happen to the optimal cluster selection logic.

In the forthcoming PRs the capacity manager will be simplified to take advantage of the new info in the SPC status.

Paired PRs:

Note to self:

metlos and others added 22 commits November 28, 2024 20:26
the corresponding cluster. The capacity manager is simplified to take this
fact into account, even though it needs to re-check the spacecount from
the cache to decrease the chance of placing spaces to full clusters just
because of the fact that the reconciliation of the SPC didn't happen yet.
The readiness reason will reflect the situation better in that case.
Co-authored-by: Francisc Munteanu <[email protected]>
Co-authored-by: Francisc Munteanu <[email protected]>
This simplifies the logic in the controller and doesn't increase the
complexity in the controller tests.
a test package and simplify how the SpaceCountGetter is obtained.
SpaceProvisionerConfig. This data is just for information purposes and is
not yet used anywhere else in the operator.
@metlos
Copy link
Contributor Author

metlos commented Dec 6, 2024

/retest

1 similar comment
@metlos
Copy link
Contributor Author

metlos commented Dec 9, 2024

/retest

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.

Nice, I have only two cosmetic comments 👍 🥇

@metlos
Copy link
Contributor Author

metlos commented Dec 16, 2024

/retest

2 similar comments
@metlos
Copy link
Contributor Author

metlos commented Dec 17, 2024

/retest

@metlos
Copy link
Contributor Author

metlos commented Dec 17, 2024

/retest

Copy link
Contributor

@fbm3307 fbm3307 left a comment

Choose a reason for hiding this comment

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

Great work , just some minor clarification.

toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"
"k8s.io/apimachinery/pkg/types"
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)

func MapToolchainClusterToSpaceProvisionerConfigs(ctx context.Context, cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request {
return func(context context.Context, obj runtimeclient.Object) []reconcile.Request {
func MapToolchainClusterToSpaceProvisionerConfigs(cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func MapToolchainClusterToSpaceProvisionerConfigs(cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request {
func mapToolchainClusterToSpaceProvisionerConfigs(cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request {

minor doubt- i don't see this function being used out of the package or in e2e, why is it declared global?

}
}

func MapToolchainStatusToSpaceProvisionerConfigs(cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func MapToolchainStatusToSpaceProvisionerConfigs(cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request {
func mapToolchainStatusToSpaceProvisionerConfigs(cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request {

Similarly for this function may be we don't require it to be global

Copy link

openshift-ci bot commented Dec 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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,metlos]

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

@metlos metlos merged commit 2b06cc8 into codeready-toolchain:master Jan 7, 2025
12 of 14 checks passed
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 82.85714% with 24 lines in your changes missing coverage. Please review.

Project coverage is 79.48%. Comparing base (1798976) to head (a514b81).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...isionerconfig/spaceprovisionerconfig_controller.go 83.96% 15 Missing and 2 partials ⚠️
controllers/spaceprovisionerconfig/mapper.go 81.81% 4 Missing and 2 partials ⚠️
main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1109      +/-   ##
==========================================
+ Coverage   79.44%   79.48%   +0.03%     
==========================================
  Files          78       78              
  Lines        7785     7876      +91     
==========================================
+ Hits         6185     6260      +75     
- Misses       1422     1436      +14     
- Partials      178      180       +2     
Files with missing lines Coverage Δ
main.go 0.00% <0.00%> (ø)
controllers/spaceprovisionerconfig/mapper.go 89.09% <81.81%> (-10.91%) ⬇️
...isionerconfig/spaceprovisionerconfig_controller.go 82.96% <83.96%> (+1.88%) ⬆️

... 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.

4 participants