apple / pkl-k8s

Templates for using Pkl with Kubernetes
Apache License 2.0
110 stars 7 forks source link

Pkl integration with `ArgoCD` / `Flux` ? #2

Open ggjulio opened 9 months ago

ggjulio commented 9 months ago

Do you think pkl could be integrated with gitops tools like argocd / flux an alternative to helm and kustomize ?

There is a similar project named timoni that tackle helm drawbacks. Timoni can already be used with flux, and may end up with proper integration for both argocd and flux :

So I wonder if pkl could also play nicely with argocd/flux. Pkl could integrate with argocd in the first place using config managements plugins.
For Flux support, it seem that a custom controller using the gitops toolkit api is the recommended way.

inoc603 commented 8 months ago

For anyone interested in using pkl with argocd, I wrote a simple argocd configuration management plugin for pkl: https://github.com/inoc603/argocd-pkl

holzensp commented 8 months ago

There is no reason why Pkl couldn't play nice with any other system, especially when it's currently implemented with a static format like JSON or YAML. If this is an ask for us to build that integration, I don't foresee that in the near future. Happy to assist anyone with issues they run into while building this, though, but I don't believe @inoc603 needed any help rolling their ArgoCD integration (awesome, btw)

jstrachan commented 7 months ago

an easy way to use pkl with ArgoCD or FluxCD is when you merge a change to your source repository, generate the all the YAML files and check them into your GitOps repository/branch that ArgoCD / FluxCD watch

e.g.

# on a merge to main branch do this in CI.:
pkl eval -m releaseDir $(find . -name "*.pkl")
git add releaseDir
git commit -a -m "new release ofYAML files"

then ArgoCD and FluxCD can just work with canonical YAML files and not worry about grokking pkl

holzensp commented 6 months ago

That certainly is a valid way to hold Pkl for these sorts of systems, but it's worth pointing out that does mean you're relying on reliable surfacing of errors in that chain. In other words: if, for whatever reason, Pkl wasn't run in that scenario, will you detect that?