File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ import (
23
23
"strings"
24
24
25
25
"github.com/markbates/inflect"
26
+
27
+ "k8s.io/apimachinery/pkg/util/validation"
26
28
)
27
29
28
30
var (
31
33
ResourceVersionRegexp = regexp .MustCompile ("^v[1-9][0-9]*((alpha|beta)[1-9][0-9]*)?$" )
32
34
// ResourceKindRegexp matches Kubernetes API Kind's.
33
35
ResourceKindRegexp = regexp .MustCompile ("^[A-Z]{1}[a-zA-Z0-9]+$" )
34
- // ResourceGroupRegexp matches Kubernetes API Group's.
35
- ResourceGroupRegexp = regexp .MustCompile ("^[a-z0-9]+$" )
36
36
)
37
37
38
38
// Resource contains the information required to scaffold files for a resource.
@@ -127,8 +127,8 @@ func (r *Resource) checkAndSetGroups() error {
127
127
r .FullGroup = fg [0 ]
128
128
r .Group = g [0 ]
129
129
130
- if ! ResourceGroupRegexp . MatchString (r .Group ) {
131
- return errors . New ("group should consist of lowercase alphabetical characters" )
130
+ if err := validation . IsDNS1123Subdomain (r .Group ); err != nil {
131
+ return fmt . Errorf ("group name is invalid: %v" , err )
132
132
}
133
133
return nil
134
134
}
You can’t perform that action at this time.
0 commit comments