Skip to content

Commit a84e463

Browse files
authored
Make server_features a child of xds_servers (#12)
1 parent db69be2 commit a84e463

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func generate(in configInput) ([]byte, error) {
154154
// xDS v2 implementation in TD expects the IP address to be encoded in the
155155
// id field while the v3 implementation expects this in the metadata.
156156
c.Node.Metadata["INSTANCE_IP"] = in.ip
157-
c.ServerFeatures = append(c.ServerFeatures, "xds_v3")
157+
c.XdsServers[0].ServerFeatures = append(c.XdsServers[0].ServerFeatures, "xds_v3")
158158
}
159159
if in.includePSMSecurity {
160160
c.CertificateProviders = map[string]certificateProviderConfig{
@@ -247,12 +247,12 @@ type config struct {
247247
Node *node `json:"node,omitempty"`
248248
CertificateProviders map[string]certificateProviderConfig `json:"certificate_providers,omitempty"`
249249
GRPCServerResourceNameID string `json:"grpc_server_resource_name_id,omitempty"`
250-
ServerFeatures []string `json:"server_features,omitempty"`
251250
}
252251

253252
type server struct {
254-
ServerUri string `json:"server_uri,omitempty"`
255-
ChannelCreds []creds `json:"channel_creds,omitempty"`
253+
ServerUri string `json:"server_uri,omitempty"`
254+
ChannelCreds []creds `json:"channel_creds,omitempty"`
255+
ServerFeatures []string `json:"server_features,omitempty"`
256256
}
257257

258258
type creds struct {

main_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ func TestGenerate(t *testing.T) {
8686
{
8787
"type": "google_default"
8888
}
89+
],
90+
"server_features": [
91+
"xds_v3"
8992
]
9093
}
9194
],
@@ -100,10 +103,7 @@ func TestGenerate(t *testing.T) {
100103
"locality": {
101104
"zone": "uscentral-5"
102105
}
103-
},
104-
"server_features": [
105-
"xds_v3"
106-
]
106+
}
107107
}`,
108108
},
109109
{
@@ -125,6 +125,9 @@ func TestGenerate(t *testing.T) {
125125
{
126126
"type": "google_default"
127127
}
128+
],
129+
"server_features": [
130+
"xds_v3"
128131
]
129132
}
130133
],
@@ -151,10 +154,7 @@ func TestGenerate(t *testing.T) {
151154
}
152155
}
153156
},
154-
"grpc_server_resource_name_id": "grpc/server",
155-
"server_features": [
156-
"xds_v3"
157-
]
157+
"grpc_server_resource_name_id": "grpc/server"
158158
}`,
159159
},
160160
}

0 commit comments

Comments
 (0)