-
Notifications
You must be signed in to change notification settings - Fork 568
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
feat(#344): add sub helmfiles explicit selectors #567
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. |
README.md
Outdated
@@ -805,6 +826,12 @@ Once you download all required charts into your machine, you can run `helmfile c | |||
It basically run only `helm upgrade --install` with your already-downloaded charts, hence no Internet connection is required. | |||
See #155 for more information on this topic. | |||
|
|||
## 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutly !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I'll do that
Inherits bool //do the sub helmfiles inherits from parent selectors | ||
} | ||
|
||
const InheritsYamlValue = "inherits" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I'll do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :