Skip to content

Commit

Permalink
add ClientDefaultListenerResourceNameTemplate when used with --includ…
Browse files Browse the repository at this point in the history
…e-xdstp-name-in-lds-experimental (#57)
  • Loading branch information
arvindbr8 authored Feb 9, 2024
1 parent 2bf1b5e commit c53528b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func generate(in configInput) ([]byte, error) {
// xdstp://<authority>/envoy.config.listener.v3.Listener/<project_number>/<(network)|(mesh:mesh_name)>/id
ClientListenerResourceNameTemplate: fmt.Sprintf("xdstp://%s/envoy.config.listener.v3.Listener/%d/%s/%%s", tdAuthority, in.gcpProjectNumber, networkIdentifier),
}
c.ClientDefaultListenerResourceNameTemplate = fmt.Sprintf("xdstp://%s/envoy.config.listener.v3.Listener/%d/%s/%%s", tdAuthority, in.gcpProjectNumber, networkIdentifier)
}

c2pAuthority := "traffic-director-c2p.xds.googleapis.com"
Expand Down Expand Up @@ -462,11 +463,12 @@ func getFromMetadata(urlStr string) ([]byte, error) {
}

type config struct {
XdsServers []server `json:"xds_servers,omitempty"`
Authorities map[string]Authority `json:"authorities,omitempty"`
Node *node `json:"node,omitempty"`
CertificateProviders map[string]certificateProviderConfig `json:"certificate_providers,omitempty"`
ServerListenerResourceNameTemplate string `json:"server_listener_resource_name_template,omitempty"`
XdsServers []server `json:"xds_servers,omitempty"`
Authorities map[string]Authority `json:"authorities,omitempty"`
Node *node `json:"node,omitempty"`
CertificateProviders map[string]certificateProviderConfig `json:"certificate_providers,omitempty"`
ServerListenerResourceNameTemplate string `json:"server_listener_resource_name_template,omitempty"`
ClientDefaultListenerResourceNameTemplate string `json:"client_default_listener_resource_name_template,omitempty"`
}

type server struct {
Expand Down
3 changes: 2 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ func TestGenerate(t *testing.T) {
}
}
},
"server_listener_resource_name_template": "grpc/server?xds.resource.listening_address=%s"
"server_listener_resource_name_template": "grpc/server?xds.resource.listening_address=%s",
"client_default_listener_resource_name_template": "xdstp://traffic-director-global.xds.googleapis.com/envoy.config.listener.v3.Listener/123456789012345/thedefault/%s"
}`,
},
}
Expand Down

0 comments on commit c53528b

Please sign in to comment.