-
Notifications
You must be signed in to change notification settings - Fork 137
/
name.go
22 lines (17 loc) · 833 Bytes
/
name.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package edgeconnect
import (
"context"
"fmt"
"github.com/Dynatrace/dynatrace-operator/pkg/api/v1alpha1/edgeconnect"
)
const (
errorNameTooLong = `The length limit for the name of a EdgeConnect is %d, because it is the base for the name of resources related to the EdgeConnect.
The limit is necessary because kubernetes uses the name of some resources for the label value, which has a limit of 63 characters. (see https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set)`
)
func nameTooLong(_ context.Context, _ *edgeconnectValidator, edgeConnect *edgeconnect.EdgeConnect) string {
edgeConnectName := edgeConnect.Name
if edgeConnectName != "" && len(edgeConnectName) > edgeconnect.MaxNameLength {
return fmt.Sprintf(errorNameTooLong, edgeconnect.MaxNameLength)
}
return ""
}