Browse Source

Disallow * as service-defaults name (#10069)

pull/9991/head
Freddy 4 years ago committed by GitHub
parent
commit
f265dd635f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .changelog/10069.txt
  2. 3
      agent/structs/config_entry.go
  3. 7
      agent/structs/config_entry_test.go

3
.changelog/10069.txt

@ -0,0 +1,3 @@
```release-note:breaking-change
connect: Disallow wildcard as name for service-defaults.
```

3
agent/structs/config_entry.go

@ -157,6 +157,9 @@ func (e *ServiceConfigEntry) Validate() error {
if e.Name == "" {
return fmt.Errorf("Name is required")
}
if e.Name == WildcardSpecifier {
return fmt.Errorf("service-defaults name must be the name of a service, and not a wildcard")
}
validationErr := validateConfigEntryMeta(e.Meta)

7
agent/structs/config_entry_test.go

@ -1699,6 +1699,13 @@ func TestServiceConfigEntry_Validate(t *testing.T) {
expect *ServiceConfigEntry
expectErr string
}{
{
name: "wildcard name is not allowed",
input: &ServiceConfigEntry{
Name: WildcardSpecifier,
},
expectErr: `must be the name of a service, and not a wildcard`,
},
{
name: "upstream config override no name",
input: &ServiceConfigEntry{

Loading…
Cancel
Save