-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
⚠️ ComponentConfig Implementation #891
⚠️ ComponentConfig Implementation #891
Conversation
81234da
to
8b9e5ad
Compare
@mtaufen @stealthybox @shawn-hurley @djzager @joelanford I would love a review of this implementation, as stated in the PR desc if this seems like a reasonable approach before this is merged I will update the design document again. |
00ac7f7
to
cef7fb6
Compare
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.
Thank you for this. It matches what I expected it to look like and the more I see UpdateOptionsFromComponentConfig
the more I prefer it over NewFromComponentConfig
given the flexibility it provides (and how easy it is to add New
if we decide later that is what we want).
@djzager Thanks for that. It's interesting after implementing With update it looks more like this:
and the weird UX I didn't like is if you set values on |
5cd614f
to
e861afb
Compare
e861afb
to
40f9306
Compare
@joelanford @djzager I've updated this PR to use I've also adjusted the structure of I'm open to discussion about the naming of
WDYT? |
I explored this a bit over the weekend and familiarized myself with the kubelet config code as a reference. Generally LGTM. The interface is a little large, albeit simple, it'd be nice to see if we can do anything clever to reduce the size or default somehow (maybe something inject-y? idk). +1 for NewFromComponentConfig and the intuition around updating/initializing options. |
Musings... ... On the Subject of Options from ComponentConfigI wonder if we can actually invert ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{Scheme: scheme}.AndFrom(cfg)) cfg could be either cfg, err := config.FromFile("cfg.yaml") or, for maximum inline (and probably the normal pattern): ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
}.AndFrom(config.FromFileOrDie("path"))) This means that we keep structured argument (i.e. no "scheme" positional argument floating around in the super-long-named ... On the Subject of GetConfigOrDieWe probably want to be able to RESTConfig from componentconfig no? Or is that always separate? Can definitely figure that out in a follow-up, but I'm curious what other things do. P.S. sorry for not suggesting these during design review :-/ |
Oooh, also: can we get an example in the examples folder and in the Would make the overall UX easier to see from the user side of things |
I had a good chat with @mtaufen about the multiple approaches and if there is a standard, I committed to writing a doc that explains the three different approaches we're viewing for getting this information out of the config file. Including using apimachinery conversions, using the kubebuilder webhook style conversions - POC - christopherhein@878f3cb and last using this interface style and discussing pros and cons of each approach. |
I can definitely do that, a quick example if you want to see sooner than that I've implemented this in one of my test controllers - https://github.com/christopherhein/github-controller/pull/6/files I will write up an example in that file too. |
@DirectXMan12 some replies inline. I like the angle you are coming from. That leads to a really nice UX. One thing I've been considering is what the long-term plan is with this, I believe this is only the first step, with my hope that we can in a major release that we can replace Options with the component config type, I've started to document a couple steps to get there - #895
This feels simple, I could see how this would support flag overrides. Worth exploring.
I really like this instead of
Agreed. This is a really clean way of handling it.
Yea, there is a way we can do this, I hadn't implemented it in this PR, trying to keep it simple and add this on later once we had more of the structure in-place. It generally should be pretty easy, we can use https://github.com/kubernetes/component-base/blob/master/config/v1alpha1/types.go#L69-L82 to setup some of the structure and then we'll just need to create the client in the
No worries, I know you are incredibly busy. 🙏 thank you for giving it a thorough review. |
/hold |
Cool. Was mainly looking at seeing the process of integrating custom configuration fields (didn't see that on the linked PR, but I might've missed something)
Cool, can definitely do that in a follow-up, just want to make sure we plan how that interacts with things API ergonomics-wise -- do we have folks pass Thanks for the awesome work. Looking forward to this :-) |
433aa34
to
5887ade
Compare
/test pull-controller-runtime-test-master |
fc60e2f
to
ae18ac6
Compare
4b5c35e
to
9842992
Compare
adf52a6
to
e6c7242
Compare
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.
minor questions and one oversight it looks like. looks pretty good though.
8bce846
to
c99fe1c
Compare
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.
/approve
Last changes LGTM, leaving the last word to @DirectXMan12 @alvaroaleman |
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.
One comment about naming, other than that lgtm
pkg/config/config.go
Outdated
|
||
// ControllerConfiguration defines the functions necessary to parse a config file | ||
// and to configure the Options struct for the ctrl.Manager | ||
type ControllerConfiguration interface { |
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.
I think a better name would be Controller_Manager_Configuration
, none of the settings are controller-level settings. Same comment applies for the types
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.
Snake case like that?
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.
No sorry, the underscores where just to highlight the difference
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.
Great, I'll get this updated. Thanks for the feedback :)
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.
All updated. Thanks again, @alvaroaleman
Signed-off-by: Chris Hein <[email protected]>
Signed-off-by: Chris Hein <[email protected]>
c99fe1c
to
7ce57c5
Compare
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.
/lgtm
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, christopherhein, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This implements #818 but does not follow the design to the tee. Differences are called out below and the design doc will be updated once more eyes have been on the implementation.
Example Implementation
Example main.go