kcl-lang / flux-kcl-controller

Flux KCL Controller
https://kcl-lang.io
Apache License 2.0
23 stars 7 forks source link

[Feature] Add `.spec.path` field to KCLRun resource #68

Closed ron1 closed 2 months ago

ron1 commented 4 months ago

Feature Request

Describe the feature you'd like: I would like to deploy three different configs of a workload to different environments, prod, qa, and dev. The configuration of different environments is maintained by KCL code where different environments correspond to different folders. Currently, I believe such a deployment would require 3 different Flux GitRepository resources and 3 accompanying KCLRun resources. Adding field .spec.path to the KCLRun resource would give it comparable functionality to that offered by the Flux Kustomization resource described here: https://fluxcd.io/flux/components/kustomize/kustomizations/#path.

Peefy commented 4 months ago

Hello. Thanks for the feature request #69, #68 and your use cases.

Essentially, there are two GitOps approaches here.

  1. Upload KCL compiled artifacts (usually YAML that satisfies the Kubernetes specifications) to OCI through CI, and then publish them through Flux OCIRepository and Kustomization resources
  2. Simply using KCLRun resources and Flux GitRepository resources for publishing, of course, this requires the ability of the flux kcl controller, as mentioned in this issue. However, this does not mean that complete redevelopment is required, only importing the package of the flux kustomize controller for consumption.

In short, this is a reasonable requirement, PRs also welcome. ❤️

ovk commented 2 months ago

Was recently evaluating KCL and this Flux controller and found this limitation, which, in my opinion, greatly diminishes the value that KCL could provide.

For those who consider making a PR to address this limitation, could you perhaps provide some high level implementation guidance? At first glance, it seems just need to allow compilation in kclrun_controller.go to take path into account (and extend CRD with .spec.path of course). But maybe there's something else that needs to be done (apart from usual tests/docs)?

Peefy commented 2 months ago

Hello @ovk Thanks for the feedback.

The original goal was to provide KCL Controller and Kusomize Controller with the same even more features, and the implementation of the Flux KCL Controller will also reference Kusomize Controller. However, in terms of bandwidth, the community is currently working on it.

Issues and PRs are also welcome. ❤️