Skip to content

Commit b96f7a7

Browse files
authored
Emit v3 configs by default (#15)
1 parent 8af4336 commit b96f7a7

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var (
3737
"the gcp project number. If unknown, can be found via 'gcloud projects list'")
3838
vpcNetworkName = flag.String("vpc-network-name", "default", "VPC network name")
3939
localityZone = flag.String("locality-zone", "", "the locality zone to use, instead of retrieving it from the metadata server. Useful when not running on GCP and/or for testing")
40-
includeV3Features = flag.Bool("include-v3-features-experimental", false, "whether or not to generate configs which works with the xDS v3 implementation in TD. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
40+
includeV3Features = flag.Bool("include-v3-features-experimental", true, "whether or not to generate configs which works with the xDS v3 implementation in TD. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
4141
includePSMSecurity = flag.Bool("include-psm-security-experimental", false, "whether or not to generate config required for PSM security. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
4242
)
4343

main_test.go

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ func TestGenerate(t *testing.T) {
3333
wantOutput string
3434
}{
3535
{
36-
desc: "happy case",
36+
desc: "happy case with v3 config by default",
3737
input: configInput{
38-
xdsServerUri: "example.com:443",
39-
gcpProjectNumber: 123456789012345,
40-
vpcNetworkName: "thedefault",
41-
ip: "10.9.8.7",
42-
zone: "uscentral-5",
43-
metadataLabels: map[string]string{"k1": "v1", "k2": "v2"},
38+
xdsServerUri: "example.com:443",
39+
gcpProjectNumber: 123456789012345,
40+
vpcNetworkName: "thedefault",
41+
ip: "10.9.8.7",
42+
zone: "uscentral-5",
43+
metadataLabels: map[string]string{"k1": "v1", "k2": "v2"},
44+
includeV3Features: true,
4445
},
4546
wantOutput: `{
4647
"xds_servers": [
@@ -50,13 +51,17 @@ func TestGenerate(t *testing.T) {
5051
{
5152
"type": "google_default"
5253
}
54+
],
55+
"server_features": [
56+
"xds_v3"
5357
]
5458
}
5559
],
5660
"node": {
57-
"id": "52fdfc07-2182-454f-963f-5f0f9a621d72~10.9.8.7",
61+
"id": "projects/123456789012345/networks/thedefault/nodes/9566c74d-1003-4c4d-bbbb-0407d1e2c649",
5862
"cluster": "cluster",
5963
"metadata": {
64+
"INSTANCE_IP": "10.9.8.7",
6065
"TRAFFICDIRECTOR_GCP_PROJECT_NUMBER": "123456789012345",
6166
"TRAFFICDIRECTOR_NETWORK_NAME": "thedefault",
6267
"k1": "v1",
@@ -69,14 +74,14 @@ func TestGenerate(t *testing.T) {
6974
}`,
7075
},
7176
{
72-
desc: "happy case with v3 config",
77+
desc: "happy case with v2 config",
7378
input: configInput{
7479
xdsServerUri: "example.com:443",
7580
gcpProjectNumber: 123456789012345,
7681
vpcNetworkName: "thedefault",
7782
ip: "10.9.8.7",
7883
zone: "uscentral-5",
79-
includeV3Features: true,
84+
includeV3Features: false,
8085
},
8186
wantOutput: `{
8287
"xds_servers": [
@@ -86,17 +91,13 @@ func TestGenerate(t *testing.T) {
8691
{
8792
"type": "google_default"
8893
}
89-
],
90-
"server_features": [
91-
"xds_v3"
9294
]
9395
}
9496
],
9597
"node": {
96-
"id": "projects/123456789012345/networks/thedefault/nodes/9566c74d-1003-4c4d-bbbb-0407d1e2c649",
98+
"id": "52fdfc07-2182-454f-963f-5f0f9a621d72~10.9.8.7",
9799
"cluster": "cluster",
98100
"metadata": {
99-
"INSTANCE_IP": "10.9.8.7",
100101
"TRAFFICDIRECTOR_GCP_PROJECT_NUMBER": "123456789012345",
101102
"TRAFFICDIRECTOR_NETWORK_NAME": "thedefault"
102103
},
@@ -107,7 +108,7 @@ func TestGenerate(t *testing.T) {
107108
}`,
108109
},
109110
{
110-
desc: "happy case with v3 and security config",
111+
desc: "happy case with security config",
111112
input: configInput{
112113
xdsServerUri: "example.com:443",
113114
gcpProjectNumber: 123456789012345,

0 commit comments

Comments
 (0)