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
d70d2d20
Commit
d70d2d20
authored
Mar 27, 2015
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add params for the proxy when installing the API.
parent
b9499b8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
api_installer.go
pkg/apiserver/api_installer.go
+7
-3
No files found.
pkg/apiserver/api_installer.go
View file @
d70d2d20
...
@@ -181,6 +181,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
...
@@ -181,6 +181,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
allowWatchList
:=
isWatcher
&&
isLister
// watching on lists is allowed only for kinds that support both watch and list.
allowWatchList
:=
isWatcher
&&
isLister
// watching on lists is allowed only for kinds that support both watch and list.
scope
:=
mapping
.
Scope
scope
:=
mapping
.
Scope
nameParam
:=
ws
.
PathParameter
(
"name"
,
"name of the "
+
kind
)
.
DataType
(
"string"
)
nameParam
:=
ws
.
PathParameter
(
"name"
,
"name of the "
+
kind
)
.
DataType
(
"string"
)
pathParam
:=
ws
.
PathParameter
(
"path:*"
,
"path to the resource"
)
.
DataType
(
"string"
)
params
:=
[]
*
restful
.
Parameter
{}
params
:=
[]
*
restful
.
Parameter
{}
actions
:=
[]
action
{}
actions
:=
[]
action
{}
...
@@ -193,6 +194,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
...
@@ -193,6 +194,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
resourcePath
=
itemPath
resourcePath
=
itemPath
}
}
nameParams
:=
append
(
params
,
nameParam
)
nameParams
:=
append
(
params
,
nameParam
)
proxyParams
:=
append
(
nameParams
,
pathParam
)
namer
:=
rootScopeNaming
{
scope
,
a
.
group
.
Linker
,
gpath
.
Join
(
a
.
prefix
,
itemPath
)}
namer
:=
rootScopeNaming
{
scope
,
a
.
group
.
Linker
,
gpath
.
Join
(
a
.
prefix
,
itemPath
)}
// Handler for standard REST verbs (GET, PUT, POST and DELETE).
// Handler for standard REST verbs (GET, PUT, POST and DELETE).
...
@@ -206,7 +208,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
...
@@ -206,7 +208,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
actions
=
appendIf
(
actions
,
action
{
"DELETE"
,
itemPath
,
nameParams
,
namer
},
isDeleter
)
actions
=
appendIf
(
actions
,
action
{
"DELETE"
,
itemPath
,
nameParams
,
namer
},
isDeleter
)
actions
=
appendIf
(
actions
,
action
{
"WATCH"
,
"watch/"
+
itemPath
,
nameParams
,
namer
},
isWatcher
)
actions
=
appendIf
(
actions
,
action
{
"WATCH"
,
"watch/"
+
itemPath
,
nameParams
,
namer
},
isWatcher
)
actions
=
appendIf
(
actions
,
action
{
"REDIRECT"
,
"redirect/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"REDIRECT"
,
"redirect/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
+
"/{path:*}"
,
name
Params
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
+
"/{path:*}"
,
proxy
Params
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
}
else
{
}
else
{
...
@@ -224,6 +226,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
...
@@ -224,6 +226,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
resourcePath
=
itemPath
resourcePath
=
itemPath
}
}
nameParams
:=
append
(
namespaceParams
,
nameParam
)
nameParams
:=
append
(
namespaceParams
,
nameParam
)
proxyParams
:=
append
(
nameParams
,
pathParam
)
namer
:=
scopeNaming
{
scope
,
a
.
group
.
Linker
,
gpath
.
Join
(
a
.
prefix
,
itemPath
),
false
}
namer
:=
scopeNaming
{
scope
,
a
.
group
.
Linker
,
gpath
.
Join
(
a
.
prefix
,
itemPath
),
false
}
actions
=
appendIf
(
actions
,
action
{
"LIST"
,
resourcePath
,
namespaceParams
,
namer
},
isLister
)
actions
=
appendIf
(
actions
,
action
{
"LIST"
,
resourcePath
,
namespaceParams
,
namer
},
isLister
)
...
@@ -236,7 +239,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
...
@@ -236,7 +239,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
actions
=
appendIf
(
actions
,
action
{
"DELETE"
,
itemPath
,
nameParams
,
namer
},
isDeleter
)
actions
=
appendIf
(
actions
,
action
{
"DELETE"
,
itemPath
,
nameParams
,
namer
},
isDeleter
)
actions
=
appendIf
(
actions
,
action
{
"WATCH"
,
"watch/"
+
itemPath
,
nameParams
,
namer
},
isWatcher
)
actions
=
appendIf
(
actions
,
action
{
"WATCH"
,
"watch/"
+
itemPath
,
nameParams
,
namer
},
isWatcher
)
actions
=
appendIf
(
actions
,
action
{
"REDIRECT"
,
"redirect/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"REDIRECT"
,
"redirect/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
+
"/{path:*}"
,
name
Params
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
+
"/{path:*}"
,
proxy
Params
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
// list across namespace.
// list across namespace.
...
@@ -258,6 +261,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
...
@@ -258,6 +261,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
resourcePath
=
itemPath
resourcePath
=
itemPath
}
}
nameParams
:=
append
(
namespaceParams
,
nameParam
)
nameParams
:=
append
(
namespaceParams
,
nameParam
)
proxyParams
:=
append
(
nameParams
,
pathParam
)
namer
:=
legacyScopeNaming
{
scope
,
a
.
group
.
Linker
,
gpath
.
Join
(
a
.
prefix
,
itemPath
)}
namer
:=
legacyScopeNaming
{
scope
,
a
.
group
.
Linker
,
gpath
.
Join
(
a
.
prefix
,
itemPath
)}
actions
=
appendIf
(
actions
,
action
{
"LIST"
,
resourcePath
,
namespaceParams
,
namer
},
isLister
)
actions
=
appendIf
(
actions
,
action
{
"LIST"
,
resourcePath
,
namespaceParams
,
namer
},
isLister
)
...
@@ -270,7 +274,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
...
@@ -270,7 +274,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
actions
=
appendIf
(
actions
,
action
{
"DELETE"
,
itemPath
,
nameParams
,
namer
},
isDeleter
)
actions
=
appendIf
(
actions
,
action
{
"DELETE"
,
itemPath
,
nameParams
,
namer
},
isDeleter
)
actions
=
appendIf
(
actions
,
action
{
"WATCH"
,
"watch/"
+
itemPath
,
nameParams
,
namer
},
isWatcher
)
actions
=
appendIf
(
actions
,
action
{
"WATCH"
,
"watch/"
+
itemPath
,
nameParams
,
namer
},
isWatcher
)
actions
=
appendIf
(
actions
,
action
{
"REDIRECT"
,
"redirect/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"REDIRECT"
,
"redirect/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
+
"/{path:*}"
,
name
Params
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
+
"/{path:*}"
,
proxy
Params
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
actions
=
appendIf
(
actions
,
action
{
"PROXY"
,
"proxy/"
+
itemPath
,
nameParams
,
namer
},
isRedirector
)
}
}
}
}
...
...
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