-
Notifications
You must be signed in to change notification settings - Fork 20
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
Propagate node configuration through kubernetes api #258
Conversation
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 work @berkayoz - did a first pass on the propagation part
package types | ||
|
||
type NodeConfig struct { | ||
CloudProvider string `mapstructure:"cloud-provider,omitempty"` |
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 need to pull in mapstructure - just use json
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.
We can technically use json
but wouldn't that mean doing a Marshal
and Unmarshal
just to convert between map[string]string
and NodeConfig
. Seems a bit inefficient/hacky imo.
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 work so far, but needs some improvements
src/k8s/pkg/k8sd/app/hooks_start.go
Outdated
|
||
configController := controllers.NewNodeConfigurationController() | ||
go configController.Run(s.Context, snap) | ||
|
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'd love us to have an option like --disable-node-configuration-controller
in k8sd. Just a note for the future, don't do this just yet
select { | ||
case <-ctx.Done(): | ||
return nil | ||
default: | ||
} |
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.
change the time.Sleep()
at the end of the loop with a <-time.After(3 * time.Second)
here. This interval should be something larger like 10 seconds (or more?). That way you don't need multiple time.Sleep()
s in the loop, and you don't have to wait for sleep to finish to see that the context has been canceled.
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'm not exactly sure if the interval should be something larger. Mainly 2 concerns:
- The initial start of the controller might be a bit delayed, which increases the time for nodes to settle.
- If for some reason the
Watch
fails, it will take 10 seconds to recover
I think a small interval is okay, the only worry I would have is for the failure on getting a kubernetes client when the cluster is not bootstrapped/joined. Especially in the scenario where someone installed the k8s
snap and never interacted with it. We would print an error message into the logs every 3 seconds, that can eventually exhaust disk space.
595bd5c
to
0213732
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, how is this tested? Is there value in having an e2e test for this? Join a control plane and a worker, update a config like the dns.service-ip, and check that all nodes eventually use 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.
LGTM
Added
NodeConfigurationController
that handles watching and reconciling arguments on services.Restructured components(functionalities) to reduce code duplication and help with updating node config(
k8sd-config
configmap)