fluxcd / kustomize-controller

The GitOps Toolkit Kustomize reconciler
https://fluxcd.io
Apache License 2.0
254 stars 181 forks source link

Support partial apply #1231

Open cwrau opened 3 months ago

cwrau commented 3 months ago

Often one installs dependent configuration at the same time, think postgres-operator and the application with the postgresql.

With flux this is, currently, not possible, as the kustomize-controller fails with

Warning  ReconciliationFailed  3m23s  kustomize-controller  postgresql/discourse/discourse-db dry-run failed: no matches for kind "postgresql" in version "acid.zalan.do/v1"

The current solutions would be to

  1. create the resources step-by-step, splitting up normal PRs to multiple:
    1. install postgres-operator
    2. apply application
  2. apply the intermediate resources by hand every time

Both of these solutions have the disadvantage to not work with a full recovery with an existing repo.

In my opinion, an option with partialApply: true would be amazing, which would just apply everything that's possible and ignore what's not working, but still failing at the end.

And during the next reconciliation trying again, which,, in time,, would result in a complete working cluster.

stefanprodan commented 3 months ago

There is spec.dependsOn made for this, see here how to use it: https://github.com/fluxcd/flux2-kustomize-helm-example?tab=readme-ov-file#infrastructure

cwrau commented 3 months ago

There is spec.dependsOn made for this

But what if I don't have anything that can use depensOn or the dependee can't be depended upon?

Imagine the following scenario;

that won't work with the dependsOn (or need the solution below)

, see here how to use it: fluxcd/flux2-kustomize-helm-example#infrastructure

And in this example, I'd need to have multiple kustomizations, which,, in my use-case,, really only serve the purpose for ordering