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

chore: remove the pod group #9

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

Vacant2333
Copy link
Contributor

for now, we didnt need the pod group, we can use resourcebinding to managet hte tasks, and implement the worklaod interface, we can supports more resource like deployment

Signed-off-by: Vacant2333 <vacant2333@gmail.com>

// This map contains the workload that we can handle now, the controllers will create PodGroup for them.
var workloadGVKMap = map[schema.GroupVersionKind]struct{}{
var workloadGVKMap = map[schema.GroupVersionKind]NewWorkloadFunc{
Copy link
Member

Choose a reason for hiding this comment

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

Do we need expose a method to let other workloads register themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we can register each workload ourselves to the workloadGVKMap, how do u think?

return nil, err
}

resource, err := dc.dynamicClient.Resource(mapping.Resource).Namespace(ref.Namespace).Get(context.Background(), ref.Name, metav1.GetOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way that we can get resource directly and avoid API request, seems it's heavy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't find a better way because we had to get the corresponding resources from rb, but in dispatcher we weren't sure which resources to handle

Copy link
Member

Choose a reason for hiding this comment

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

OK.

@Monokaix
Copy link
Member

Monokaix commented Dec 28, 2024

It's better to add ut, can submit a seperate pr.

@@ -77,7 +78,7 @@ func ResourceBindings(ar admissionv1.AdmissionReview) *admissionv1.AdmissionResp
}

// Check if its workload, skip suspend if not.
isWorkload, err := utils.IsWorkload(rb.Spec.Resource)
isWorkload, _, err := workload.TryGetNewWorkloadFunc(rb.Spec.Resource)
Copy link
Member

Choose a reason for hiding this comment

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

Should we depend on this condition to check whether rb reference to a workload? In Karmada, based on rb.spec.Replicas>0 to determine whether it is a workload, but now this judgment is based on whether the workload has been registered, if there is no registration of workload judgment result is wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the workload means the workloads we support, like volcano job, when we support the other workload like deployment, then we can handle it, else we should't suspend it

@Vacant2333
Copy link
Contributor Author

It's better to add ut, can submit a seperate pr.

ok, i will submit a ut pr for it after this pr

@Monokaix
Copy link
Member

/lgtm

Copy link
Member

@william-wang william-wang left a comment

Choose a reason for hiding this comment

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

/lgtm

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: william-wang

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

@volcano-sh-bot volcano-sh-bot merged commit 9411dbf into volcano-sh:main Jan 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants