Dependent Kustomizations and decomposed monorepo via ArtifactGenerator #5800
-
|
Hello, I am planning to adopt the ArtifactGenerator to decompose our large monorepo, which serves multiple clusters. However, we rely heavily on dependsOn to manage deployment order. For example, we ensure a shared service like an ingress controller is fully reconciled before the applications that depend on it are deployed. My Core Question: For example, would this work? Artifact-A is generated from the /infra/dev directory of my monorepo. Artifact-B is generated from the /apps/dev directory of my monorepo. # Deploys the infrastructure first
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: infrastructure
spec:
sourceRef:
kind: ExternalArtifact
name: artifact-A # <-- Source A
# ...
---
# Deploys the app, depending on the infrastructure
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: my-application
spec:
dependsOn:
- name: infrastructure # <-- Dependency on a Kustomization from a different source
sourceRef:
kind: ExternalArtifact
name: artifact-B # <-- Source B
# ...If dependsOn is not guaranteed to work across different generated ExternalArtifact sources, it would seem that the only way I can safely decompose my monorepo is to create one large artifact per cluster and have all my Kustomizations for that cluster refer to it. This would limit the benefits of source decomposition. Is my understanding correct, or does dependsOn work seamlessly regardless of the sourceRef? Thank you for your clarification! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
dependsOn at install time works no matter if the source differs, so in your case, the apps will not be deployed on a new clusters unless the ingress is ready. Same source is a requirement only for upgrades. |
Beta Was this translation helpful? Give feedback.
dependsOn at install time works no matter if the source differs, so in your case, the apps will not be deployed on a new clusters unless the ingress is ready. Same source is a requirement only for upgrades.