-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mergeWithUnion generator #14560
Labels
Comments
Maybe related: #11952 |
I do think both problems could have similar solutions i.e. generators:
- merge:
mode: {whatever this merge mode ends up being called} I think this use case might not be describing a left-join however. I think what this effectively requires is that in the first operation we merge
and then, when merging that result with
so that cluster-1 is represented by:
|
I agree with this, merge generator is too limited with only one way to merge. |
cyclingwithelephants
changed the title
mergeWithUnion generator?
mergeWithUnion generator
Sep 2, 2023
5 tasks
14 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Summary
Since the merge generator discards non-matched applications, it's difficult to express things like "everything in directory 1, overriding from directory 2" and it would be nice to have some kind of merge which does not discard non-matched items
Motivation
I am trying to adopt gitops patterns for a group of clusters which are currently very heterogenous. As such, there are a significant amount of cluster specific overrides. Following an example from @alexmt I have got a directory tree looking like
Following the example above, if I used merge as per the linked example, neither applications
c
ord
would be generated since the merge generator discards non-matched items. To work around this, I would need to generate stubs ofc
andd
in the base directory, and a stub ofd
in theenv-1
directory.It would be nice if there were a way to merge in such a way that effectively does a merge, and then a union with the remaining items - I'll define this as
mergeWithUnion
for this discussion. For example,mergeWithUnion(base, env-1)
from the directory tree above would generate applicationsa
,b
, andc
- overridinga
andb
frombase
, and generatingc
from scratchGiven how I've defined
mergeWithUnion
, I'd like the ability to expressmergeWithUnion(mergeWithUnion(base, env-1),cluster-1)
This would allow environmental and cluster specific differences (where they exist) to be a bit more obvious and reduce the need for stubbing, but also means an implicit inheritance that might not be so obvious to developers contributing to the repo (and hence potentially dangerous).
I also hope that this will simplify the process of diffing over time to further homogenise clusters since it'll be immediately obvious when there are no diffs.
Proposal
There could be a new mergeWithUnion generator, or there could be some backwards compatible option set in the existing merge generator.
If this is a poor approach to solve this problem, I'd greatly appreciate some guidance on how best to handle this.
The text was updated successfully, but these errors were encountered: