Skip to content

Commit acbe515

Browse files
committed
Fix issue regarding full domain API groups
1 parent 9baa4f4 commit acbe515

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

fixtures/full_domain_group.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
kind: RoleBinding
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: tiller-binding
5+
namespace: dev2
6+
subjects:
7+
- kind: ServiceAccount
8+
name: tiller
9+
namespace: dev2
10+
roleRef:
11+
kind: Role
12+
name: tiller-manager
13+
apiGroup: rbac.authorization.k8s.io

kubeval/kubeval.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,16 @@ func determineSchema(kind string, apiVersion string) string {
106106

107107
var kindSuffix string
108108

109-
versionParts := strings.Split(apiVersion, "/")
109+
groupParts := strings.Split(apiVersion, "/")
110+
versionParts := strings.Split(groupParts[0], ".")
110111

111112
if OpenShift {
112113
kindSuffix = ""
113114
} else {
114-
if len(versionParts) == 1 {
115+
if len(groupParts) == 1 {
115116
kindSuffix = "-" + strings.ToLower(versionParts[0])
116117
} else {
117-
kindSuffix = fmt.Sprintf("-%s-%s", strings.ToLower(versionParts[0]), strings.ToLower(versionParts[1]))
118+
kindSuffix = fmt.Sprintf("-%s-%s", strings.ToLower(versionParts[0]), strings.ToLower(groupParts[1]))
118119
}
119120
}
120121

kubeval/kubeval_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ func TestValidateValidInputs(t *testing.T) {
2525
"null_array.yaml",
2626
"quantity.yaml",
2727
"extra_property.yaml",
28+
"full_domain_group.yaml",
2829
}
2930
for _, test := range tests {
3031
filePath, _ := filepath.Abs("../fixtures/" + test)
3132
fileContents, _ := ioutil.ReadFile(filePath)
3233
_, err := Validate(fileContents, test)
3334
if err != nil {
34-
t.Errorf("Validate should pass when testing valid configuration in" + test)
35+
t.Errorf("Validate should pass when testing valid configuration in " + test)
3536
}
3637
}
3738
}

0 commit comments

Comments
 (0)