rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.51k stars 227 forks source link

Bundle dependsOn Feature Should Pause/Wait on Bundles Deployed in Separate Git Repositories #486

Open dsmithbauer opened 3 years ago

dsmithbauer commented 3 years ago

When using the dependsOn feature, instead of continuing on to deploy Bundles that have unsatisfied dependencies that exist in separate Git repositories Fleet should pause/wait and not deploy. Ideally, it would be nice if Fleet did not go to an Err Applied state, but went to a Pause/Held state that would periodically check to see if the bundle dependencies had since been resolved, and if so would continue to deploy without a Force Update.

Please see the detailed use case below:

In reviewing the latest release candidate with this feature v0.3.6-rc9, I noticed that dependsOn does not seem to support waiting on Bundles that are deployed from other Git Repositories per the validation use case below:

Method One

Bundle becomes active even though the dependsOn field is populated. This works as intended since dependsOn only looks for bundles that exist.

In this implementation, it makes it much harder to divide Git infrastructure repositories into smaller chunks that can be deployed in different configurations to different clusters (using different labels, for example), reducing code duplication.

Given this hypothetical example, I think it would be beneficial to be able to dependOn bundles from different Git repos.

Git Repo 1: Common (Bundles include Docker Registry credentials, storage classes, etc.) Git Repo 2 (depends on Bundles in repo 1): Prometheus (Bundles include Prom Operator and required CRDs) Git Repo 3 (depends on Bundles in repo 2): Apps (app deployments that include Prometheus ServiceMonitor resources that will fail without the bundles from the first two repos)

So, essentially some of the bundles in repos 1, 2, and 3 will depend on bundles in the previously numbered Git repo - chained. 1 <- 2 <- 3

In a second cluster, I may want to swap out Git Repo 3 to deploy a separate set of applications that also require ServiceMonitor CRDs already be installed. Ideally, I would not want to have a single Git repo that includes all the Bundles for repos 1, 2, and 3, because now I need to duplicate all the code for repos 1 and 2 in the new 4th Git repo with the different apps.

One could potentially achieve reusability and reduce code duplication with Git submodules, but that can be cumbersome to maintain. I would like to see the ability to order deployments across Bundles deployed from different Git Repos when the previous Bundles do not exist using the dependsOn feature.

Thank you for your time and consideration of this request. Fleet is really awesome!

Originally posted by @dsmithbauer in https://github.com/rancher/fleet/issues/392#issuecomment-895188560

nickgerace commented 2 years ago

Note to maintainers: this would likely involve adding a new state to the GitRepos.

dsmithbauer commented 2 years ago

Bump. Any chance this could/may be worked soon?