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
7a5461a1
Unverified
Commit
7a5461a1
authored
Nov 17, 2016
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require at least one version in ThirdPartyResource objects
parent
0f95b262
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
2 deletions
+8
-2
types.go
pkg/apis/extensions/types.go
+0
-2
validation.go
pkg/apis/extensions/validation/validation.go
+3
-0
zz_generated.openapi.go
pkg/generated/openapi/zz_generated.openapi.go
+2
-0
thirdparty.go
pkg/master/thirdparty/thirdparty.go
+3
-0
No files found.
pkg/apis/extensions/types.go
View file @
7a5461a1
...
...
@@ -124,7 +124,6 @@ type ThirdPartyResource struct {
Description
string
`json:"description,omitempty"`
// Versions are versions for this third party object
// +optional
Versions
[]
APIVersion
`json:"versions,omitempty"`
}
...
...
@@ -143,7 +142,6 @@ type ThirdPartyResourceList struct {
// TODO: we should consider merge this struct with GroupVersion in unversioned.go
type
APIVersion
struct
{
// Name of this version (e.g. 'v1').
// +optional
Name
string
`json:"name,omitempty"`
}
...
...
pkg/apis/extensions/validation/validation.go
View file @
7a5461a1
...
...
@@ -68,6 +68,9 @@ func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) field.ErrorL
allErrs
=
append
(
allErrs
,
apivalidation
.
ValidateObjectMeta
(
&
obj
.
ObjectMeta
,
false
,
ValidateThirdPartyResourceName
,
field
.
NewPath
(
"metadata"
))
...
)
versions
:=
sets
.
String
{}
if
len
(
obj
.
Versions
)
==
0
{
allErrs
=
append
(
allErrs
,
field
.
Required
(
field
.
NewPath
(
"versions"
),
"must specify at least one version"
))
}
for
ix
:=
range
obj
.
Versions
{
version
:=
&
obj
.
Versions
[
ix
]
if
len
(
version
.
Name
)
==
0
{
...
...
pkg/generated/openapi/zz_generated.openapi.go
View file @
7a5461a1
...
...
@@ -3245,6 +3245,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
},
},
},
Required
:
[]
string
{
"name"
},
},
},
Dependencies
:
[]
string
{},
...
...
@@ -4899,6 +4900,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
},
},
},
Required
:
[]
string
{
"versions"
},
},
},
Dependencies
:
[]
string
{
...
...
pkg/master/thirdparty/thirdparty.go
View file @
7a5461a1
...
...
@@ -246,6 +246,9 @@ func (m *ThirdPartyResourceServer) InstallThirdPartyResource(rsrc *extensions.Th
if
err
!=
nil
{
return
err
}
if
len
(
rsrc
.
Versions
)
==
0
{
return
fmt
.
Errorf
(
"ThirdPartyResource %s has no defined versions"
,
rsrc
.
Name
)
}
plural
,
_
:=
meta
.
KindToResource
(
unversioned
.
GroupVersionKind
{
Group
:
group
,
Version
:
rsrc
.
Versions
[
0
]
.
Name
,
...
...
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