@@ -31,11 +31,6 @@ import (
3131 "google.golang.org/grpc"
3232)
3333
34- const (
35- // k8sNamespace is the namespace we use to connect containerd.
36- k8sNamespace = "k8s.io"
37- )
38-
3934type client struct {
4035 containerService containersapi.ContainersClient
4136 taskService tasksapi.TasksClient
@@ -52,13 +47,12 @@ var once sync.Once
5247var ctrdClient containerdClient = nil
5348
5449const (
55- address = "/run/containerd/containerd.sock"
5650 maxBackoffDelay = 3 * time .Second
5751 connectionTimeout = 2 * time .Second
5852)
5953
6054// Client creates a containerd client
61- func Client () (containerdClient , error ) {
55+ func Client (address , namespace string ) (containerdClient , error ) {
6256 var retErr error
6357 once .Do (func () {
6458 tryConn , err := net .DialTimeout ("unix" , address , connectionTimeout )
@@ -75,7 +69,7 @@ func Client() (containerdClient, error) {
7569 grpc .WithBackoffMaxDelay (maxBackoffDelay ),
7670 grpc .WithTimeout (connectionTimeout ),
7771 }
78- unary , stream := newNSInterceptors (k8sNamespace )
72+ unary , stream := newNSInterceptors (namespace )
7973 gopts = append (gopts ,
8074 grpc .WithUnaryInterceptor (unary ),
8175 grpc .WithStreamInterceptor (stream ),
0 commit comments