Skip to content

Commit

Permalink
Support multiple grpc dial options for agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefftree committed Oct 16, 2020
1 parent 727b66f commit 822a3ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions pkg/agent/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -110,7 +110,7 @@ type ClientSetConfig struct {
AgentID string
SyncInterval time.Duration
ProbeInterval time.Duration
DialOption grpc.DialOption
DialOption []grpc.DialOption
ServiceAccountTokenPath string
}

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 822a3ab

Please sign in to comment.