mirror of https://github.com/status-im/consul.git
Disallow * as service-defaults name (#10069)
This commit is contained in:
parent
8331adbde4
commit
f265dd635f
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:breaking-change
|
||||||
|
connect: Disallow wildcard as name for service-defaults.
|
||||||
|
```
|
|
@ -157,6 +157,9 @@ func (e *ServiceConfigEntry) Validate() error {
|
||||||
if e.Name == "" {
|
if e.Name == "" {
|
||||||
return fmt.Errorf("Name is required")
|
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)
|
validationErr := validateConfigEntryMeta(e.Meta)
|
||||||
|
|
||||||
|
|
|
@ -1699,6 +1699,13 @@ func TestServiceConfigEntry_Validate(t *testing.T) {
|
||||||
expect *ServiceConfigEntry
|
expect *ServiceConfigEntry
|
||||||
expectErr string
|
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",
|
name: "upstream config override no name",
|
||||||
input: &ServiceConfigEntry{
|
input: &ServiceConfigEntry{
|
||||||
|
|
Loading…
Reference in New Issue