mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 01:50:55 +00:00
Merge pull request #107821 from liggitt/kubelet-secret-manager
Move kubelet secret and configmap manager calls to sync_Pod functions
This commit is contained in:
@@ -1603,6 +1603,16 @@ func (kl *Kubelet) syncPod(ctx context.Context, updateType kubetypes.SyncPodType
|
||||
return fmt.Errorf("%s: %v", NetworkNotReadyErrorMsg, err)
|
||||
}
|
||||
|
||||
// ensure the kubelet knows about referenced secrets or configmaps used by the pod
|
||||
if !kl.podWorkers.IsPodTerminationRequested(pod.UID) {
|
||||
if kl.secretManager != nil {
|
||||
kl.secretManager.RegisterPod(pod)
|
||||
}
|
||||
if kl.configMapManager != nil {
|
||||
kl.configMapManager.RegisterPod(pod)
|
||||
}
|
||||
}
|
||||
|
||||
// Create Cgroups for the pod and apply resource parameters
|
||||
// to them if cgroups-per-qos flag is enabled.
|
||||
pcm := kl.containerManager.NewPodContainerManager()
|
||||
@@ -1832,6 +1842,14 @@ func (kl *Kubelet) syncTerminatedPod(ctx context.Context, pod *v1.Pod, podStatus
|
||||
}
|
||||
klog.V(4).InfoS("Pod termination unmounted volumes", "pod", klog.KObj(pod), "podUID", pod.UID)
|
||||
|
||||
// After volume unmount is complete, let the secret and configmap managers know we're done with this pod
|
||||
if kl.secretManager != nil {
|
||||
kl.secretManager.UnregisterPod(pod)
|
||||
}
|
||||
if kl.configMapManager != nil {
|
||||
kl.configMapManager.UnregisterPod(pod)
|
||||
}
|
||||
|
||||
// Note: we leave pod containers to be reclaimed in the background since dockershim requires the
|
||||
// container for retrieving logs and we want to make sure logs are available until the pod is
|
||||
// physically deleted.
|
||||
|
Reference in New Issue
Block a user