Skip to content

Commit

Permalink
Emit v3 configs by default (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars authored Mar 19, 2021
1 parent 8af4336 commit b96f7a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
"the gcp project number. If unknown, can be found via 'gcloud projects list'")
vpcNetworkName = flag.String("vpc-network-name", "default", "VPC network name")
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")
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.")
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.")
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.")
)

Expand Down
33 changes: 17 additions & 16 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ func TestGenerate(t *testing.T) {
wantOutput string
}{
{
desc: "happy case",
desc: "happy case with v3 config by default",
input: configInput{
xdsServerUri: "example.com:443",
gcpProjectNumber: 123456789012345,
vpcNetworkName: "thedefault",
ip: "10.9.8.7",
zone: "uscentral-5",
metadataLabels: map[string]string{"k1": "v1", "k2": "v2"},
xdsServerUri: "example.com:443",
gcpProjectNumber: 123456789012345,
vpcNetworkName: "thedefault",
ip: "10.9.8.7",
zone: "uscentral-5",
metadataLabels: map[string]string{"k1": "v1", "k2": "v2"},
includeV3Features: true,
},
wantOutput: `{
"xds_servers": [
Expand All @@ -50,13 +51,17 @@ func TestGenerate(t *testing.T) {
{
"type": "google_default"
}
],
"server_features": [
"xds_v3"
]
}
],
"node": {
"id": "52fdfc07-2182-454f-963f-5f0f9a621d72~10.9.8.7",
"id": "projects/123456789012345/networks/thedefault/nodes/9566c74d-1003-4c4d-bbbb-0407d1e2c649",
"cluster": "cluster",
"metadata": {
"INSTANCE_IP": "10.9.8.7",
"TRAFFICDIRECTOR_GCP_PROJECT_NUMBER": "123456789012345",
"TRAFFICDIRECTOR_NETWORK_NAME": "thedefault",
"k1": "v1",
Expand All @@ -69,14 +74,14 @@ func TestGenerate(t *testing.T) {
}`,
},
{
desc: "happy case with v3 config",
desc: "happy case with v2 config",
input: configInput{
xdsServerUri: "example.com:443",
gcpProjectNumber: 123456789012345,
vpcNetworkName: "thedefault",
ip: "10.9.8.7",
zone: "uscentral-5",
includeV3Features: true,
includeV3Features: false,
},
wantOutput: `{
"xds_servers": [
Expand All @@ -86,17 +91,13 @@ func TestGenerate(t *testing.T) {
{
"type": "google_default"
}
],
"server_features": [
"xds_v3"
]
}
],
"node": {
"id": "projects/123456789012345/networks/thedefault/nodes/9566c74d-1003-4c4d-bbbb-0407d1e2c649",
"id": "52fdfc07-2182-454f-963f-5f0f9a621d72~10.9.8.7",
"cluster": "cluster",
"metadata": {
"INSTANCE_IP": "10.9.8.7",
"TRAFFICDIRECTOR_GCP_PROJECT_NUMBER": "123456789012345",
"TRAFFICDIRECTOR_NETWORK_NAME": "thedefault"
},
Expand All @@ -107,7 +108,7 @@ func TestGenerate(t *testing.T) {
}`,
},
{
desc: "happy case with v3 and security config",
desc: "happy case with security config",
input: configInput{
xdsServerUri: "example.com:443",
gcpProjectNumber: 123456789012345,
Expand Down

0 comments on commit b96f7a7

Please sign in to comment.