server: Add special k8s label to infra containers
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
49c1fd27ac
commit
138a40540f
8 changed files with 359 additions and 1 deletions
|
@ -24,7 +24,9 @@ import (
|
|||
"golang.org/x/sys/unix"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
"k8s.io/kubernetes/pkg/kubelet/leaky"
|
||||
"k8s.io/kubernetes/pkg/kubelet/network/hostport"
|
||||
"k8s.io/kubernetes/pkg/kubelet/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -217,6 +219,9 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
|
||||
// add labels
|
||||
labels := req.GetConfig().GetLabels()
|
||||
|
||||
// Add special container name label for the infra container
|
||||
labels[types.KubernetesContainerNameLabel] = leaky.PodInfraContainerName
|
||||
labelsJSON, err := json.Marshal(labels)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -493,6 +498,8 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
return nil, err
|
||||
}
|
||||
|
||||
s.addInfraContainer(container)
|
||||
|
||||
s.ContainerStateToDisk(container)
|
||||
|
||||
resp = &pb.RunPodSandboxResponse{PodSandboxId: id}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue