Kubelet responds to ConfigMap mutations for dynamic Kubelet config#63221
Kubelet responds to ConfigMap mutations for dynamic Kubelet config#63221k8s-github-robot merged 1 commit intokubernetes:masterfrom
Conversation
| // NewRemoteConfigSource constructs a RemoteConfigSource from a v1/NodeConfigSource object. | ||
| // We assume the source has been validated beforehand - e.g. by an API server. | ||
| func NewRemoteConfigSource(source *apiv1.NodeConfigSource) RemoteConfigSource { | ||
| return &remoteConfigMap{source} |
There was a problem hiding this comment.
actually still need to check not all known fields nil, wrt old clients against a new API server that allows a new config source type failing cleanly (i.e. not crashing due to nil pointer dereference).
87f5ade to
7ec2708
Compare
7ec2708 to
fd0b29e
Compare
849c93e to
a7eb158
Compare
dashpole
left a comment
There was a problem hiding this comment.
Looks good with a couple of nits.
There was a problem hiding this comment.
nit: It seems like the interface for (r *remoteConfigMap) Informer() could be a bit cleaner, as addFunc, updateFunc, and deleteFunc arent really well-defined in the interface. Rather than defining them, I would suggest either replacing these inputs with a cache.ResourceEventHandlerFuncs parameter, or assuming the caller of Informer() will add their desired ResourceEventHanderFuncs to the informer returned by Informer().
There was a problem hiding this comment.
Makes sense, I'll replace them with cache.ResourceEventHandlerFuncs.
There was a problem hiding this comment.
nit: Prefer describing what is returned, rather than behavior: e.g. ResourceVersion returns the resource version of the most recently downloaded payload targeted by the source.
There was a problem hiding this comment.
nit: similar to above about describing internal behavior
There was a problem hiding this comment.
Actually, I think Payload() may be a better interface. The fact that it downloads and caches it on disk can be an implementation detail?
There was a problem hiding this comment.
Scratch that. Downloading the payload locally is an important part of the function.
There was a problem hiding this comment.
This is slightly confusing to me. Why are we overwriting the UID and ResourceVersion of one ConfigMap with the UID and ResourceVersion of another ConfigMap? Do we use the rest of the Stored ConfigMap, or just these fields? If we only use those two fields, why store the whole thing, and if we use the whole configmap, it seems potentially confusing to insert a different UID and ResourceVersion...
There was a problem hiding this comment.
r.source.ConfigMap is a ConfigMapNodeConfigSource, we are resolving the reference (namespace, name, kubeletConfigKey) by adding the additional details (uid, resourceVersion) that identify a version of that resource
There was a problem hiding this comment.
oh, right. I forgot it wasn't an actual configmap.
|
just looking at the description, for the current and last-known-good configs, where is the resolved uid/resourceVersion recorded (to be able to look up the correct dir in checkpoints)? is there any expectation that multiple objects will need to be pulled in/checkpointed in the future for a node config (e.g. a configmap and some set of secrets)? should that inform our config/checkpoint disk structure? |
@liggitt in the
Not yet. If we added this, I'd expect |
ah, so those are enhanced versions of what is in the Node API object
That makes sense |
| @@ -142,6 +145,8 @@ func (s *nodeConfigStatus) Sync(client clientset.Interface, nodeName string) { | |||
| return | |||
There was a problem hiding this comment.
I realize this isn't part of this PR, but is there a reason you chose to use a periodic, jittered check rather than just a long-running loop?
for _ := range s.syncCh {
utillog.Infof("updating Node.Status.Config")
...
}
|
/lgtm |
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dashpole, dchen1107, mtaufen The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Automatic merge from submit-queue (batch tested with PRs 63881, 64046, 63409, 63402, 63221). If you want to cherry-pick this change to another branch, please follow the instructions here. |
|
I think we may need to update the node e2e framework. Tests using dynamic kubelet config are failing with the error: |
|
That's surprising, bad merge? |
|
Ah, misread, you said tests using dynamic config, not the dynamic config tests. |
|
Yup, probably have to do that. |
This PR makes dynamic Kubelet config easier to reason about by leaving less room for silent skew scenarios. The new behavior is as follows:
This PR also makes a small change to the config checkpoint file tree structure, because ResourceVersion is now taken into account when saving checkpoints. The new structure is as follows:
fixes: #61643