kptdev / kpt

Automate Kubernetes Configuration Editing
https://kpt.dev
Apache License 2.0
1.69k stars 226 forks source link

[Feature Request] Support functions written by KCL and its SDKs for KPT #3671

Open Peefy opened 1 year ago

Peefy commented 1 year ago

Describe your problem

Please describe your problem and specific use case, providing as much context as possible. As a general rule, it is more effective to focus on describing the problem instead of asking for a specific solution. This ensures the following:

  1. We understand WHY you are asking for this.

I was very glad to find the KPT project and browse all its documents. I found that it coincided with what we wanted to do.

Specifically, we have just opened our domain language project KCL, which is specifically used for configuration writing and policy verification in cloud-native and kubernetes scenarios. However, it is obviously not enough to use only one language for kubernetes configuration management until we find KPT. We want to develop KCL plug-ins and SDKs for KPT to write KPT functions, so we want to keep in touch with you through this issue. Because I am new to KPT, I want to know where I can get help documents if I want to develop a new language SDK for KPT.

  1. We can pattern match across multiple users with this problem.
  2. Allow design freedom for addressing the problem given various trade-offs and UX considerations.
droot commented 1 year ago

Thanks for reaching out @Peefy

At the moment, we do not have documentation for writing a new language SDK for kpt. But you can take a look at our docs for Developing Functons and see the docs for the three SDK (Go, Typescript, Starlark) to get an idea how function authors use the SDKs. Hopefully that should get you started.

Peefy commented 1 year ago

Thanks for reaching out @Peefy

At the moment, we do not have documentation for writing a new language SDK for kpt. But you can take a look at our docs for Developing Functons and see the docs for the three SDK (Go, Typescript, Starlark) to get an idea how function authors use the SDKs. Hopefully that should get you started.

Are there plans to support other languages? I will follow kpt for a long time. 😄😄

droot commented 1 year ago

Are there plans to support other languages?

Not at the moment. we are stretched thin even to support the three we do currently. So contributors are welcome :)

Peefy commented 1 year ago

Are there plans to support other languages?

Not at the moment. we are stretched thin even to support the three we do currently. So contributors are welcome :)

Of course, I am very willing to contribute and participate in the kpt project. If I can, I will continue to pay attention to kpt and browse all documents and codes and give my design.

droot commented 1 year ago

Are there plans to support other languages?

Not at the moment. we are stretched thin even to support the three we do currently. So contributors are welcome :)

Of course, I am very willing to contribute and participate in the kpt project. If I can, I will continue to pay attention to kpt and browse all documents and codes and give my design.

Great to hear!

Peefy commented 1 year ago

@droot Hi, I'm sorry for waiting so long. I have preliminarily designed the KPT KCL SDK in the KCL repo, and I am pleased to receive your feedback. https://github.com/KusionStack/KCLVM/issues/434

Peefy commented 1 year ago

@droot Hi, I'm sorry for waiting so long. I have preliminarily designed the KPT KCL SDK in the KCL repo, and I am pleased to receive your feedback. KusionStack/KCLVM#434

Here is a one-line KCL transformer.

# kcl-fn-config.yaml
apiVersion: fn.kpt.dev/v1alpha1
kind: KCLRun
metadata:
  name: set-annotation
source: |
   # One line KCL transformer.
   [item | {metadata.annotations: {"managed-by" = "kcl-kpt"}} for item in option("resource_list").items]
Peefy commented 1 year ago

Hello. I have completed the initial version of the kpt KCL function, and I hope you can give some suggestions. If possible, I am willing to contribute to the KPT community.

natasha41575 commented 1 year ago

@yuwenma assigning to you as the area lead of function sdk

yuwenma commented 1 year ago

added @droot who initiates the discussions with Peefy.

Peefy commented 1 year ago

Hi @droot. Long time no contact. I am excited to report on the progress to you. and we have completed the KPT KCL Function PoC and expected to contribute to the community, there is no additional demand for kpt fn.

droot commented 1 year ago

Sorry @Peefy for not responding earlier. I plan to review it next week. Will share the feedback then. Thanks for the update.