-
Notifications
You must be signed in to change notification settings - Fork 32
Description
It can get ip from a providing pod, but if we look into agent-sandbox project, we can see if no warmpool used, the sandbox created by agentcube will be be patched SanboxPodNameAnnotation, that means no pod can be found from it.
agentcube/pkg/workloadmanager/handlers.go
Lines 204 to 208 in 86841e5
| if podName, exists := createdSandbox.Annotations[controllers.SanboxPodNameAnnotation]; exists { | |
| sandboxPodName = podName | |
| } | |
| podIP, err := s.k8sClient.GetSandboxPodIP(ctx, sandbox.Namespace, sandbox.Name, sandboxPodName) |
The GetSandboxPodIP falls back to list by label selector
agentcube/pkg/workloadmanager/k8s_client.go
Line 318 in eb947f5
| pods, err := c.podLister.Pods(namespace).List(labels.SelectorFromSet(map[string]string{SandboxNameLabelKey: sandboxName})) |
Yes, for sandbox creating, it set SandboxNameLabelKey
| sandbox.Spec.PodTemplate.ObjectMeta.Labels[SandboxNameLabelKey] = params.sandboxName |
But for sandboxClaim case, we donot set this label.
There will be a case, like sandboxclaim is created, but we cannot find the pod
agentcube/pkg/workloadmanager/k8s_client.go
Line 311 in eb947f5
| pod, err := c.podLister.Pods(namespace).Get(podName) |
I think #185 is related @YaoZengzeng