diff --git a/cmd/agent/main.go b/cmd/agent/main.go index e505bdea6..801da119f 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -77,7 +77,7 @@ type GrpcProxyAgentOptions struct { serviceAccountTokenPath string } -func (o *GrpcProxyAgentOptions) ClientSetConfig(dialOption grpc.DialOption) *agent.ClientSetConfig { +func (o *GrpcProxyAgentOptions) ClientSetConfig(dialOption ...grpc.DialOption) *agent.ClientSetConfig { return &agent.ClientSetConfig{ Address: fmt.Sprintf("%s:%d", o.proxyServerHost, o.proxyServerPort), AgentID: o.agentID, diff --git a/pkg/agent/clientset.go b/pkg/agent/clientset.go index f64a6bfbc..f0292ad71 100644 --- a/pkg/agent/clientset.go +++ b/pkg/agent/clientset.go @@ -43,7 +43,7 @@ type ClientSet struct { // proxy server. probeInterval time.Duration // The interval by which the agent // periodically checks if its connections to the proxy server is ready. - dialOption grpc.DialOption + dialOption []grpc.DialOption // file path contains service account token serviceAccountTokenPath string // channel to signal shutting down the client set. Primarily for test. @@ -110,7 +110,7 @@ type ClientSetConfig struct { AgentID string SyncInterval time.Duration ProbeInterval time.Duration - DialOption grpc.DialOption + DialOption []grpc.DialOption ServiceAccountTokenPath string } @@ -128,7 +128,7 @@ func (cc *ClientSetConfig) NewAgentClientSet(stopCh <-chan struct{}) *ClientSet } func (cs *ClientSet) newAgentClient() (*AgentClient, int, error) { - return newAgentClient(cs.address, cs.agentID, cs, cs.dialOption) + return newAgentClient(cs.address, cs.agentID, cs, cs.dialOption...) } func (cs *ClientSet) resetBackoff() *wait.Backoff { diff --git a/tests/proxy_test.go b/tests/proxy_test.go index 9017c0d44..9c49142ce 100644 --- a/tests/proxy_test.go +++ b/tests/proxy_test.go @@ -364,7 +364,7 @@ func runAgentWithID(agentID, addr string, stopCh <-chan struct{}) *agent.ClientS AgentID: agentID, SyncInterval: 100 * time.Millisecond, ProbeInterval: 100 * time.Millisecond, - DialOption: grpc.WithInsecure(), + DialOption: []grpc.DialOption{grpc.WithInsecure()}, } client := cc.NewAgentClientSet(stopCh) client.Serve()