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

✨ Only schedule to synctarget with compatible APIs #2329

Merged
merged 7 commits into from
Dec 1, 2022

Conversation

qiujian16
Copy link
Contributor

add a filter to filter out synctarget whose supported resouces do not include what in the apibindings.

Signed-off-by: Jian Qiu jqiu@redhat.com

Summary

filter the synctarget based on what is the supported resource in synctarget and what is the served apibindings relating to compute in this workspace.

Related issue(s)

Fixes #1779

@openshift-ci openshift-ci bot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Nov 9, 2022
@qiujian16 qiujian16 changed the title ✨ [wip] Only schedule to synctarget with compatible APIs ✨ Only schedule to synctarget with compatible APIs Nov 14, 2022
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 14, 2022
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 15, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2022
@davidfestal
Copy link
Member

/assign @sttts

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 17, 2022
@ncdc ncdc added the area/transparent-multi-cluster Related to scheduling of workloads into pclusters. label Nov 17, 2022
@qiujian16 qiujian16 force-pushed the schedule-compatible branch 2 times, most recently from c281b5e to d386672 Compare November 18, 2022 06:49
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 22, 2022
Signed-off-by: Jian Qiu <jqiu@redhat.com>
@davidfestal
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 29, 2022
)

const (
ControllerName = "kcp-api-export-extra-annotation-sync"
Copy link
Member

Choose a reason for hiding this comment

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

this looks like controller inflation. Why not add another reconciler to the existing apibinding controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

existing apibinding controller only update status using committer. committer cannot update label and status once, and cannot remove the label key. If we add another reconciler in the apibinding controller, I think it will make it a bit messy, since we need to patch labels separately in this reconciler then return the updated placement to let other reconciler update status.

Copy link
Member

Choose a reason for hiding this comment

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

we have precedence for that, see the clusterworkspaces controller. The only rules to follow:

  1. each reconciler either modifies status or spec, not both
  2. all status reconcilers come first, and reconciliation it stopped (+ requeued) when spec is changed.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 30, 2022
Signed-off-by: Jian Qiu <jqiu@redhat.com>
Signed-off-by: Jian Qiu <jqiu@redhat.com>
@davidfestal
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 1, 2022
@sttts
Copy link
Member

sttts commented Dec 1, 2022

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 1, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidfestal, 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 Dec 1, 2022
@openshift-merge-robot openshift-merge-robot merged commit c8a942c into kcp-dev:main Dec 1, 2022
@qiujian16 qiujian16 deleted the schedule-compatible branch December 1, 2022 11:49
if placement.Status.Phase == schedulingv1alpha1.PlacementPending || placement.Status.SelectedLocation == nil {
conditions.MarkFalse(placement,
Copy link
Member

Choose a reason for hiding this comment

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

this is a big 🔴 . Never ever mutate in a getter.

}

if len(filteredSyncTargets) == 0 {
conditions.MarkFalse(placement,
Copy link
Member

Choose a reason for hiding this comment

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

another one 🔴 . Don't mutate anything when it is not clearly expected by the function name.

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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schedule synctarget based on compatible API
5 participants