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
cbab337b
Commit
cbab337b
authored
Jun 25, 2016
by
k8s-merge-robot
Committed by
GitHub
Jun 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #27242 from smarterclayton/discovery_prefix
Automatic merge from submit-queue Make discovery client parameterizable to legacy prefix
parents
7d3d7846
158d8521
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
discovery_client.go
pkg/client/typed/discovery/discovery_client.go
+10
-7
No files found.
pkg/client/typed/discovery/discovery_client.go
View file @
cbab337b
...
...
@@ -81,6 +81,8 @@ type SwaggerSchemaInterface interface {
// versions and resources.
type
DiscoveryClient
struct
{
*
restclient
.
RESTClient
LegacyPrefix
string
}
// Convert unversioned.APIVersions to unversioned.APIGroup. APIVersions is used by legacy v1, so
...
...
@@ -105,7 +107,7 @@ func apiVersionsToAPIGroup(apiVersions *unversioned.APIVersions) (apiGroup unver
func
(
d
*
DiscoveryClient
)
ServerGroups
()
(
apiGroupList
*
unversioned
.
APIGroupList
,
err
error
)
{
// Get the groupVersions exposed at /api
v
:=
&
unversioned
.
APIVersions
{}
err
=
d
.
Get
()
.
AbsPath
(
"/api"
)
.
Do
()
.
Into
(
v
)
err
=
d
.
Get
()
.
AbsPath
(
d
.
LegacyPrefix
)
.
Do
()
.
Into
(
v
)
apiGroup
:=
unversioned
.
APIGroup
{}
if
err
==
nil
{
apiGroup
=
apiVersionsToAPIGroup
(
v
)
...
...
@@ -135,8 +137,9 @@ func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (r
url
:=
url
.
URL
{}
if
len
(
groupVersion
)
==
0
{
return
nil
,
fmt
.
Errorf
(
"groupVersion shouldn't be empty"
)
}
else
if
groupVersion
==
"v1"
{
url
.
Path
=
"/api/"
+
groupVersion
}
if
len
(
d
.
LegacyPrefix
)
>
0
&&
groupVersion
==
"v1"
{
url
.
Path
=
d
.
LegacyPrefix
+
"/"
+
groupVersion
}
else
{
url
.
Path
=
"/apis/"
+
groupVersion
}
...
...
@@ -245,8 +248,8 @@ func (d *DiscoveryClient) SwaggerSchema(version unversioned.GroupVersion) (*swag
return
nil
,
fmt
.
Errorf
(
"API version: %v is not supported by the server. Use one of: %v"
,
version
,
groupVersions
)
}
var
path
string
if
version
==
v1
.
SchemeGroupVersion
{
path
=
"/swaggerapi
/api
/"
+
version
.
Version
if
len
(
d
.
LegacyPrefix
)
>
0
&&
version
==
v1
.
SchemeGroupVersion
{
path
=
"/swaggerapi
"
+
d
.
LegacyPrefix
+
"
/"
+
version
.
Version
}
else
{
path
=
"/swaggerapi/apis/"
+
version
.
Group
+
"/"
+
version
.
Version
}
...
...
@@ -285,7 +288,7 @@ func NewDiscoveryClientForConfig(c *restclient.Config) (*DiscoveryClient, error)
return
nil
,
err
}
client
,
err
:=
restclient
.
UnversionedRESTClientFor
(
&
config
)
return
&
DiscoveryClient
{
client
},
err
return
&
DiscoveryClient
{
RESTClient
:
client
,
LegacyPrefix
:
"/api"
},
err
}
// NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. If
...
...
@@ -301,7 +304,7 @@ func NewDiscoveryClientForConfigOrDie(c *restclient.Config) *DiscoveryClient {
// New creates a new DiscoveryClient for the given RESTClient.
func
NewDiscoveryClient
(
c
*
restclient
.
RESTClient
)
*
DiscoveryClient
{
return
&
DiscoveryClient
{
c
}
return
&
DiscoveryClient
{
RESTClient
:
c
,
LegacyPrefix
:
"/api"
}
}
func
stringDoesntExistIn
(
str
string
,
slice
[]
string
)
bool
{
...
...
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