open-consul/agent/structs/config_entry_oss.go
R.B. Boyer 9778bee35a
structs: prohibit config entries from referencing more than one partition at a time (#10478)
affected kinds: service-defaults, ingress-gateway, terminating-gateway, service-intentions
2021-06-23 16:44:10 -05:00

37 lines
829 B
Go

// +build !consulent
package structs
import (
"fmt"
"strings"
"github.com/hashicorp/go-multierror"
)
func (e *ProxyConfigEntry) validateEnterpriseMeta() error {
return nil
}
func validateUnusedKeys(unused []string) error {
var err error
for _, k := range unused {
switch {
case k == "CreateIndex" || k == "ModifyIndex":
case k == "kind" || k == "Kind":
// The kind field is used to determine the target, but doesn't need
// to exist on the target.
case strings.HasSuffix(strings.ToLower(k), "namespace"):
err = multierror.Append(err, fmt.Errorf("invalid config key %q, namespaces are a consul enterprise feature", k))
default:
err = multierror.Append(err, fmt.Errorf("invalid config key %q", k))
}
}
return err
}
func validateInnerEnterpriseMeta(_, _ *EnterpriseMeta) error {
return nil
}