Skip to content

Commit d6baaf7

Browse files
authored
Rename --config-scope-exerimental to --config-mesh-experimental (#26)
This also includes a change from a "scope:" prefix in the node ID to a "mesh:" prefix instead.
1 parent aa4d3f7 commit d6baaf7

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var (
4747
gkePodName = flag.String("gke-pod-name-experimental", "", "GKE pod name to use, instead of reading it from $HOSTNAME or /etc/hostname file. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
4848
gkeNamespace = flag.String("gke-namespace-experimental", "", "GKE namespace to use. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
4949
gceVM = flag.String("gce-vm-experimental", "", "GCE VM name to use, instead of reading it from the metadata server. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
50-
configScope = flag.String("config-scope-experimental", "", "Scope dictating which application networking configuration to use. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
50+
configMesh = flag.String("config-mesh-experimental", "", "Dictates which Mesh resource to use. This flag is EXPERIMENTAL and may be changed or removed in a later release.")
5151
)
5252

5353
func main() {
@@ -130,7 +130,7 @@ func main() {
130130
secretsDir: *secretsDir,
131131
metadataLabels: nodeMetadata,
132132
deploymentInfo: deploymentInfo,
133-
configScope: *configScope,
133+
configMesh: *configMesh,
134134
}
135135

136136
if err := validate(input); err != nil {
@@ -181,13 +181,13 @@ type configInput struct {
181181
secretsDir string
182182
metadataLabels map[string]string
183183
deploymentInfo map[string]string
184-
configScope string
184+
configMesh string
185185
}
186186

187187
func validate(in configInput) error {
188188
re := regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9-]{0,63}$`)
189-
if in.configScope != "" && !re.MatchString(in.configScope) {
190-
return fmt.Errorf("config-scope may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length")
189+
if in.configMesh != "" && !re.MatchString(in.configMesh) {
190+
return fmt.Errorf("config-mesh may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length")
191191
}
192192

193193
return nil
@@ -224,8 +224,8 @@ func generate(in configInput) ([]byte, error) {
224224
// the metadata field while the v3 implementation expects these in the id
225225
// field.
226226
networkIdentifier := in.vpcNetworkName
227-
if in.configScope != "" {
228-
networkIdentifier = fmt.Sprintf("scope:%s", in.configScope)
227+
if in.configMesh != "" {
228+
networkIdentifier = fmt.Sprintf("mesh:%s", in.configMesh)
229229
}
230230

231231
c.Node.Id = fmt.Sprintf("projects/%d/networks/%s/nodes/%s", in.gcpProjectNumber, networkIdentifier, uuid.New().String())

main_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestValidate(t *testing.T) {
3434
wantError string
3535
}{
3636
{
37-
desc: "fails when config-scope has too many characters",
37+
desc: "fails when config-mesh has too many characters",
3838
input: configInput{
3939
xdsServerUri: "example.com:443",
4040
gcpProjectNumber: 123456789012345,
@@ -43,12 +43,12 @@ func TestValidate(t *testing.T) {
4343
zone: "uscentral-5",
4444
metadataLabels: map[string]string{"k1": "v1", "k2": "v2"},
4545
includeV3Features: true,
46-
configScope: strings.Repeat("a", 65),
46+
configMesh: strings.Repeat("a", 65),
4747
},
48-
wantError: "config-scope may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length",
48+
wantError: "config-mesh may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length",
4949
},
5050
{
51-
desc: "fails when config-scope does not start with an alphabetic letter",
51+
desc: "fails when config-mesh does not start with an alphabetic letter",
5252
input: configInput{
5353
xdsServerUri: "example.com:443",
5454
gcpProjectNumber: 123456789012345,
@@ -57,12 +57,12 @@ func TestValidate(t *testing.T) {
5757
zone: "uscentral-5",
5858
metadataLabels: map[string]string{"k1": "v1", "k2": "v2"},
5959
includeV3Features: true,
60-
configScope: "4foo",
60+
configMesh: "4foo",
6161
},
62-
wantError: "config-scope may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length",
62+
wantError: "config-mesh may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length",
6363
},
6464
{
65-
desc: "fails when config-scope contains characters besides letters, numbers, and hyphens.",
65+
desc: "fails when config-mesh contains characters besides letters, numbers, and hyphens.",
6666
input: configInput{
6767
xdsServerUri: "example.com:443",
6868
gcpProjectNumber: 123456789012345,
@@ -71,9 +71,9 @@ func TestValidate(t *testing.T) {
7171
zone: "uscentral-5",
7272
metadataLabels: map[string]string{"k1": "v1", "k2": "v2"},
7373
includeV3Features: true,
74-
configScope: "h*x8",
74+
configMesh: "h*x8",
7575
},
76-
wantError: "config-scope may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length",
76+
wantError: "config-mesh may only contain letters, numbers, and '-'. It must begin with a letter and must not exceed 64 characters in length",
7777
},
7878
}
7979

@@ -275,7 +275,7 @@ func TestGenerate(t *testing.T) {
275275
}`,
276276
},
277277
{
278-
desc: "configScope specified",
278+
desc: "configMesh specified",
279279
input: configInput{
280280
xdsServerUri: "example.com:443",
281281
gcpProjectNumber: 123456789012345,
@@ -291,7 +291,7 @@ func TestGenerate(t *testing.T) {
291291
"INSTANCE-IP": "10.9.8.7",
292292
"GCE-VM": "test-gce-vm",
293293
},
294-
configScope: "testscope",
294+
configMesh: "testmesh",
295295
},
296296
wantOutput: `{
297297
"xds_servers": [
@@ -308,7 +308,7 @@ func TestGenerate(t *testing.T) {
308308
}
309309
],
310310
"node": {
311-
"id": "projects/123456789012345/networks/scope:testscope/nodes/9566c74d-1003-4c4d-bbbb-0407d1e2c649",
311+
"id": "projects/123456789012345/networks/mesh:testmesh/nodes/9566c74d-1003-4c4d-bbbb-0407d1e2c649",
312312
"cluster": "cluster",
313313
"metadata": {
314314
"INSTANCE_IP": "10.9.8.7",
@@ -330,15 +330,15 @@ func TestGenerate(t *testing.T) {
330330
}`,
331331
},
332332
{
333-
desc: "configScope specified with v2 config",
333+
desc: "configMesh specified with v2 config",
334334
input: configInput{
335335
xdsServerUri: "example.com:443",
336336
gcpProjectNumber: 123456789012345,
337337
vpcNetworkName: "thedefault",
338338
ip: "10.9.8.7",
339339
zone: "uscentral-5",
340340
includeV3Features: false,
341-
configScope: "testscope",
341+
configMesh: "testmesh",
342342
},
343343
wantOutput: `{
344344
"xds_servers": [

0 commit comments

Comments
 (0)