karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.47k stars 885 forks source link

[lfx-mentorship-2023-Sep-Nov] supports promote dependent resources automatically #3842

Closed XiShanYongYe-Chang closed 1 year ago

XiShanYongYe-Chang commented 1 year ago

CNCF LFX mentorship https://github.com/cncf/mentoring/tree/main/programs/lfx-mentorship/2023/03-Sep-Nov

Mentor: @jwcesign Backup: @RainbowMango

What would you like to be added: Provide an automatic promotion mechanism for dependent resources in karmadactl. When promoting a resource, all the resources that it depends on will be automatically promoted as well. For example, promoting the Secret that is dependent by a Deployment.

Why is this needed:

Related issue: #1862

Tasks:

TDB

zhy76 commented 1 year ago

I am interested in this and would like to apply for lfx.

XiShanYongYe-Chang commented 1 year ago

Now we are still in the project proposal stage. According to the timeline, mentees can start applying at the time Wed Aug 16 - Tues Aug 29, 5:00 PM PDT.

AdiAkhileshSingh15 commented 1 year ago

Hey, I'm interested in this project and I plan to apply as a Mentee once LFX Fall applications are open. Also, I'm curious to know if there are any beginner-friendly issues available for me to start contributing and get to know more about the project.

Any help would be highly appreciated. Thanks!

YashPimple commented 1 year ago

Hello @jwcesign @RainbowMango I am interested in learning about this project and want to work on this project under LFX Mentorship Karmada supports promote dependent resources automatically also, this issue seems like a great starting point for getting started with a contribution to the Karmada. Landed here from the CNCF mentorship repository

I liked how everything is very well documented. I look forward to applying to this project for this term.

tamil07 commented 1 year ago

Hi, I am interested to contribute to this project but not as a Mentee but just as a part time as I don't wish to get paid. Would it be possible to so?

XiShanYongYe-Chang commented 1 year ago

Hi, I am interested to contribute to this project but not as a Mentee but just as a part time as I don't wish to get paid. Would it be possible to so?

Hi @tamil07, thank you very much for participating in the open-source activities of the Karmada community. I believe that you can contribute to the entire project, such as solution design, code review, test design and execution, documentation writing and promotion, and so on.

AvineshTripathi commented 1 year ago

Hey @XiShanYongYe-Chang wrt to this issue I looked after the normal promote feature PR with -d=true flag and based on discussion I can see the main task is to give support for CRD and for not only promote command with dep but also advance scheduling that cannot be done as finding dependency is a problem(https://karmada.io/docs/v1.3/userguide/globalview/customizing-resource-interpreter/#interpretdependency)

I tried looking for ways to get dependecies for CRDS but still have no success finding one! wanted to ask if there are any discussions wrt to it where any rough solutions was discussed so that I can deep dive those and work in similar direction for possible solutions

XiShanYongYe-Chang commented 1 year ago

cc the owner @jwcesign to help take an answer.

jwcesign commented 1 year ago

To automatically promote the dependency resource, we need to identify the specific resources on which it depends. There are two methods for parsing these dependencies: through a webhook or using Lua. Here are the steps involved in each approach:

  1. Using a webhook:

    • karmadactl sends a request to the webhook and parses the dependencies.
    • Based on this information, it creates the corresponding resource template and PropagationPolicy in the karmada control plane.
    • Note that requesting the webhook may pose difficulties, such as requiring port-forwarding.
  2. Using Lua configuration:

/cc @AvineshTripathi

AvineshTripathi commented 1 year ago

Thanks @jwcesign for the description I'll look into the lua interpretor today. Does that also find dependency or does it only generates the template?

jwcesign commented 1 year ago

Does that also find dependency or does it only generates the template?

Hi, @AdiAkhileshSingh15 , It only finds the dependencies. The related code: https://github.com/karmada-io/karmada/blob/9f7215a7bf6a62f8a57f7bd566c3f6d05853f456/pkg/util/interpreter/rule.go#L327

AvineshTripathi commented 1 year ago

Oh thanks let me try that as well! would check out today

AvineshTripathi commented 1 year ago

Hey mentors I have submitted my application for this issue and with my cover later I have added a bit about my understanding of the issue and problems we are facing and finally a little bit about solutions. Please have a look into it and do let me know if you have some more question or you need me to add more details. Thank you!

zhy76 commented 1 year ago

I have a question after studying this problem. Karmada already supports two methods of interpreting crd:

  1. webhook interpreter.
  2. configuration interpreter.

Both methods can query the dependencies of resources. It seems that we only need to get the obj of the resources that need to be promoted in the member cluster during the promotion process, call ResourceInterpreter.GetDependencies(obj) to get the dependency information of the resources, create resource template and corresponding PP for each dependency. Is my understanding correct? What points need to be paid attention to in this process? Thanks~

jwcesign commented 1 year ago

Hi @zhy76, the main issue is how to implement it with karmadactl. From the perspective of karmada components, this is not difficult:

  1. webhook interpreter - call the webhook service from the Karmada components.
  2. configuration interpreter - call it with Luva engine. (The functionality could be integrated into karmadactl.)

But with karmadactl, How can we call the service in the clusters?

zhy76 commented 1 year ago

Task to be done:

zhy76 commented 1 year ago

/assign

jwcesign commented 1 year ago

Hi, we need a proposal first. Can we add it to tasks?

XiShanYongYe-Chang commented 1 year ago

Hi @jwcesign @zhy76 The current issue is used for the release of LFX tasks. A new issue can be submitted to manage tasks.

zhy76 commented 1 year ago

Hi @jwcesign @zhy76 The current issue is used for the release of LFX tasks. A new issue can be submitted to manage tasks.

OK, I will submit a new issue.

XiShanYongYe-Chang commented 1 year ago

Thank you to everyone interested in Karmada. Next year, the lfx Karmada community will also apply for more projects. Please continue to stay tuned.

It will be tracked by #4036. /close

karmada-bot commented 1 year ago

@XiShanYongYe-Chang: Closing this issue.

In response to [this](https://github.com/karmada-io/karmada/issues/3842#issuecomment-1707922293): >Thank you to everyone interested in Karmada. Next year, the lfx Karmada community will also apply for more projects. Please continue to stay tuned. > >It will be tracked by #4036. >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.