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

🌱 Skip upsynced resources in resource scheduling #2545

Conversation

davidfestal
Copy link
Member

Summary

Resources upsynced from a downstream cluster, and thus having the Upsync label should not be taken in account by resource scheduling.

Related issue(s)

No issue dedicated. Spotted while testing PR #2338

@openshift-ci openshift-ci bot requested review from csams and kylape January 4, 2023 17:27
@ncdc ncdc added the area/transparent-multi-cluster Related to scheduling of workloads into pclusters. label Jan 4, 2023
@davidfestal davidfestal force-pushed the skip-upsynced-resouces-in-resource-scheduling branch 2 times, most recently from 73b6c1d to 9b60665 Compare January 5, 2023 08:55
@davidfestal davidfestal requested a review from sttts January 5, 2023 08:55
@@ -47,6 +47,11 @@ func (c *Controller) reconcileResource(ctx context.Context, lclusterName logical
logger := logging.WithObject(logging.WithReconciler(klog.Background(), ControllerName), obj).WithValues("groupVersionResource", gvr.String(), "logicalCluster", lclusterName.String())
logger.V(4).Info("reconciling resource")

if isUpSynced(obj.GetLabels()) {
logger.Info("resource is in Upsync mode; ignoring")
Copy link
Member

Choose a reason for hiding this comment

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

verbosity at least 3, probably more like 4.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -486,6 +486,17 @@ func (c *Controller) enqueueSyncTargetKey(syncTargetKey string) {
}
}

// isUpSynced returns true if the labels of the resource contain at least
// one `ResourceState` label with the `Upsync` value.
func isUpSynced(labels map[string]string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

as a special helper only used in one stop, please move it into the other file.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@davidfestal davidfestal force-pushed the skip-upsynced-resouces-in-resource-scheduling branch from 9b60665 to a58e4ae Compare January 5, 2023 09:20
@davidfestal davidfestal force-pushed the skip-upsynced-resouces-in-resource-scheduling branch from a58e4ae to e7d5874 Compare January 5, 2023 09:23
@sttts
Copy link
Member

sttts commented Jan 5, 2023

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 5, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 5, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 5, 2023
@openshift-merge-robot openshift-merge-robot merged commit 5ebd9a0 into kcp-dev:main Jan 5, 2023
This pull request was closed.
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. area/transparent-multi-cluster Related to scheduling of workloads into pclusters. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants