-
Can CUE prune resources in Kubernetes? Image my cue code creates 5 manifests today. I update my code now only 4 manifests get created. How to delete the one manifest which should not exist anymore? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Yes, you can model Kubernetes deployments/services/etc with CUE: https://github.com/cue-labs/cue-by-example/tree/main/003_kubernetes_tutorial If you want tighter integration with Kubernetes, there are projects built on CUE which specifically target that ecosystem, such as https://timoni.sh/ or https://holos.run/. |
Beta Was this translation helpful? Give feedback.
-
If you dump the manifests in a folder managed by flux and the configuration for flux has prune enabled then its automatic... I guess that you can do the same with argocd If you're asking about |
Beta Was this translation helpful? Give feedback.
-
I wonder if the ideal way to deploy k8s resources with CUE is to export the existing namespace as one key, and evaluate the new "target" namespace from CUE as another key, and diff them. Export new/modified manifests to a directory, export a list of delete commands for manifests in the existing namespace but missing from the CUE config. |
Beta Was this translation helpful? Give feedback.
-
Someone mentioned flux and argocd, you can also use We have a pattern of having a render.sh script in our apps and the build will call that script to render (with either helm template or cue cmd dump) and then kapp applies the output of that. |
Beta Was this translation helpful? Give feedback.
CUE is a general purpose configuration language; it does not have explicit support for k8s or pruning/deleting its resources. Hence why I tried helping by sharing links to projects which target k8s with CUE.
If you want CUE to have a "prune" feature, you'll have to elaborate further what you think that would look like for a general purpose configuration language, because I cannot picture it myself.