Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Sep 26, 2023
1 parent a5ef175 commit eb017bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/rke2/spw.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,18 @@ func checkManifestDeployed(ctx context.Context, cRuntime runtimeapi.RuntimeServi

// Use kubelet runtime logic to find the latest pod sandbox
newSandboxNeeded, _, sandboxID := runtimeutil.PodSandboxChanged(pod, podStatus)
logrus.Infof("Checking pod sandbox for %s: newSandboxNeeded=%v sandboxID=%v", pod.Name, newSandboxNeeded, sandboxID)

// Remove any pod sandboxes that are not the latest
var sandboxRemoved bool
for _, podSandbox := range resp.Items {
if podSandbox.Labels["io.kubernetes.pod.uid"] != string(pod.UID) || (sandboxID != "" && sandboxID != podSandbox.Id) {
if podSandbox.Labels["io.kubernetes.pod.uid"] != string(pod.UID) ||
(sandboxID != "" && sandboxID != podSandbox.Id) {
sandboxRemoved = true
if _, err := cRuntime.RemovePodSandbox(ctx, &runtimeapi.RemovePodSandboxRequest{PodSandboxId: podSandbox.Id}); err != nil {
logrus.Warnf("Failed to remove old %s pod sandbox: %v", pod.Name, err)
} else {
logrus.Infof("Removed old %s pod sandbox: %s (%v)", pod.Name, podSandbox.Id, podSandbox.State)
}
}
}
Expand Down

0 comments on commit eb017bd

Please sign in to comment.