feat(#344): add sub helmfiles explicit selectors#567
Conversation
|
I forgot to update the readme, I'll do so soon |
|
This seems good. I also like the EXPERIMENTAL flag, but having only one Boolean value feels like it has only one purpose. What about using an identifier like EXPERIMENTAL=selectors ? That way the env var can be used to introduce simultaneous experimental features, controlled by one flag (probably allowing coma separated identifiers). |
|
Year that's a good idea. |
|
in fact I like the idea of enabling all experimental feature at once, so I guess I'll provide both identifiers and a "true" value to enable them all. |
e142839 to
923f7da
Compare
|
all done, waiting for review. |
|
|
||
| ## Experimental features | ||
| Some experimental features may be available for testing in perspective of being (or not) included in a future release. | ||
| Those features are set using the environment variable `EXPERIMENTAL`. Here is the current experimental feature : |
There was a problem hiding this comment.
Nice. As I read this though, I think that EXPERIMENTAL alone cries for name clashes. Can we prefix with HELMFILE_ to remove this potential clash?
mumoshu
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
Looks awesome overall, but if I can wish one thing, I would love the sub-helmfile path to be denoted by the dedicated path setting, rather than the dictionary key.
That would make it extra clear that you can have only one path per sub-helmfile.
helmfiles:
- path: helmfile.d/a*.yaml
selectors:
- name=prometheus
- name!=zipkin
- helmfile.d/b*.yaml
- path: helmfile.d/c*.yaml
selectors: {}
|
@mumoshu but if I do this (which would have been much easier for parsing) we will loose the backward compatibily that I did maintain with the current PR, or am I missing something ? |
|
or do think this is not an issue to maintain backward compatiblity ? |
|
@sgandon I do want to keep backward-compatibility, and it looked possible as your implementation is handling it in https://github.com/roboll/helmfile/pull/567/files#diff-f6be34387a141f652301c16cf7a5e36cR1411 That being said, the type switch there wouldn't change. In my example, the first and the third sub-helmfile should be handled with the |
|
ha sorry I did not see this example, so yes we can have both :) |
ce5356f to
59b254e
Compare
5d54b18 to
8db0021
Compare
|
@mumoshu could you help me out with the test failure on circle-ci please ? the command |
|
I believe I found the issue, map range does not guaranty the order. I'll fix that. |
| switch selectors := value.(type) { | ||
| case string: //check the string is `inherits` else error | ||
| if selectors == InheritsYamlValue { | ||
| hf.Inherits = true |
There was a problem hiding this comment.
Can be a nit but I'd suggest using:
helmfiles:
- path: path/to/subhelmfile.yaml
selectorsInherited: true
So that the implementation becomes a bit simpler without the overloading of selectors.
| Inherits bool //do the sub helmfiles inherits from parent selectors | ||
| } | ||
|
|
||
| const InheritsYamlValue = "inherits" |
There was a problem hiding this comment.
Nit: Can be SelectorsInherits so that it looks a bit more consistent with golang community's convention that uses Where + What for const names
There was a problem hiding this comment.
This can be removed completely if we go this way https://github.com/roboll/helmfile/pull/567/files#r281003831
| if err := extractSelectorContent(hf, v); err != nil { | ||
| return err | ||
| } | ||
| } else { |
There was a problem hiding this comment.
Can you by any chance remove this implementation of "dict key as the path to a subhelmfile" in favor of path, so that the implementation becomes simpler, and there's fewer ways to achieve the same goal?
mumoshu
left a comment
There was a problem hiding this comment.
Added a few comments mostly about names and clean-ups, but this looks awesome at this point!
And I feel like merging early makes it easier to maintain the feature without less possibility to introduce another code conflict before merging.
Thanks a lot for your great work and the contribution @sgandon!
Fixes #344 by allowing explicit selectors to be specified for composed helmfiles using the following structure
2 modes here :