Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
f6b66c70
Commit
f6b66c70
authored
Oct 13, 2017
by
Antoine Pelisse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not crash when groupVersion doesn't have a group
parent
97e00235
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
util.go
pkg/kubectl/apply/parse/util.go
+8
-5
No files found.
pkg/kubectl/apply/parse/util.go
View file @
f6b66c70
...
@@ -18,11 +18,12 @@ package parse
...
@@ -18,11 +18,12 @@ package parse
import
(
import
(
"fmt"
"fmt"
"reflect"
"strings"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kubernetes/pkg/kubectl/apply"
"k8s.io/kubernetes/pkg/kubectl/apply"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
"reflect"
"strings"
)
)
// nilSafeLookup returns the value from the map if the map is non-nil
// nilSafeLookup returns the value from the map if the map is non-nil
...
@@ -152,9 +153,11 @@ func getGroupVersionKind(config map[string]interface{}) (schema.GroupVersionKind
...
@@ -152,9 +153,11 @@ func getGroupVersionKind(config map[string]interface{}) (schema.GroupVersionKind
if
!
ok
{
if
!
ok
{
return
gvk
,
fmt
.
Errorf
(
"Expected string for apiVersion, found %T"
,
gv
)
return
gvk
,
fmt
.
Errorf
(
"Expected string for apiVersion, found %T"
,
gv
)
}
}
groupversion
:=
strings
.
Split
(
casted
,
"/"
)
s
:=
strings
.
Split
(
casted
,
"/"
)
gvk
.
Group
=
groupversion
[
0
]
if
len
(
s
)
!=
1
{
gvk
.
Version
=
groupversion
[
1
]
gvk
.
Group
=
s
[
0
]
}
gvk
.
Version
=
s
[
len
(
s
)
-
1
]
}
else
{
}
else
{
return
gvk
,
fmt
.
Errorf
(
"Missing apiVersion in Kind %v"
,
config
)
return
gvk
,
fmt
.
Errorf
(
"Missing apiVersion in Kind %v"
,
config
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment