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
eb5d5946
Commit
eb5d5946
authored
Jan 12, 2017
by
Michael Fraenkel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portforward API
parent
4f8f6006
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
0 deletions
+55
-0
conversion.go
pkg/api/conversion.go
+20
-0
install.go
pkg/api/install/install.go
+1
-0
register.go
pkg/api/register.go
+1
-0
fuzzer.go
pkg/api/testing/fuzzer.go
+8
-0
types.go
pkg/api/types.go
+9
-0
register.go
pkg/api/v1/register.go
+1
-0
types.go
pkg/api/v1/types.go
+15
-0
No files found.
pkg/api/conversion.go
View file @
eb5d5946
...
...
@@ -18,6 +18,8 @@ package api
import
(
"fmt"
"strconv"
"strings"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
...
...
@@ -67,6 +69,8 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
Convert_map_to_unversioned_LabelSelector
,
Convert_unversioned_LabelSelector_to_map
,
Convert_Slice_string_To_Slice_int32
,
)
}
...
...
@@ -248,3 +252,19 @@ func Convert_unversioned_LabelSelector_to_map(in *metav1.LabelSelector, out *map
}
return
err
}
// Convert_Slice_string_To_Slice_int32 converts multiple query parameters or
// a single query parameter with a comma delimited value to multiple int32.
// This is used for port forwarding which needs the ports as int32.
func
Convert_Slice_string_To_Slice_int32
(
in
*
[]
string
,
out
*
[]
int32
,
s
conversion
.
Scope
)
error
{
for
_
,
s
:=
range
*
in
{
for
_
,
v
:=
range
strings
.
Split
(
s
,
","
)
{
x
,
err
:=
strconv
.
ParseUint
(
v
,
10
,
16
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"cannot convert to []int32: %v"
,
err
)
}
*
out
=
append
(
*
out
,
int32
(
x
))
}
}
return
nil
}
pkg/api/install/install.go
View file @
eb5d5946
...
...
@@ -102,6 +102,7 @@ func newRESTMapper(externalVersions []schema.GroupVersion) meta.RESTMapper {
"PodLogOptions"
,
"PodExecOptions"
,
"PodAttachOptions"
,
"PodPortForwardOptions"
,
"PodProxyOptions"
,
"NodeProxyOptions"
,
"ServiceProxyOptions"
,
...
...
pkg/api/register.go
View file @
eb5d5946
...
...
@@ -125,6 +125,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&
PodAttachOptions
{},
&
PodLogOptions
{},
&
PodExecOptions
{},
&
PodPortForwardOptions
{},
&
PodProxyOptions
{},
&
ComponentStatus
{},
&
ComponentStatusList
{},
...
...
pkg/api/testing/fuzzer.go
View file @
eb5d5946
...
...
@@ -117,6 +117,14 @@ func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz
j
.
Stdout
=
true
j
.
Stderr
=
true
},
func
(
j
*
api
.
PodPortForwardOptions
,
c
fuzz
.
Continue
)
{
if
c
.
RandBool
()
{
j
.
Ports
=
make
([]
int32
,
c
.
Intn
(
10
))
for
i
:=
range
j
.
Ports
{
j
.
Ports
[
i
]
=
c
.
Int31n
(
65535
)
}
}
},
func
(
s
*
api
.
PodSpec
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
s
)
// has a default value
...
...
pkg/api/types.go
View file @
eb5d5946
...
...
@@ -2953,6 +2953,15 @@ type PodExecOptions struct {
Command
[]
string
}
// PodPortForwardOptions is the query options to a Pod's port forward call
type
PodPortForwardOptions
struct
{
metav1
.
TypeMeta
// The list of ports to forward
// +optional
Ports
[]
int32
}
// PodProxyOptions is the query options to a Pod's proxy call
type
PodProxyOptions
struct
{
metav1
.
TypeMeta
...
...
pkg/api/v1/register.go
View file @
eb5d5946
...
...
@@ -81,6 +81,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&
PodAttachOptions
{},
&
PodLogOptions
{},
&
PodExecOptions
{},
&
PodPortForwardOptions
{},
&
PodProxyOptions
{},
&
ComponentStatus
{},
&
ComponentStatusList
{},
...
...
pkg/api/v1/types.go
View file @
eb5d5946
...
...
@@ -3423,6 +3423,21 @@ type PodExecOptions struct {
Command
[]
string
`json:"command" protobuf:"bytes,6,rep,name=command"`
}
// PodPortForwardOptions is the query options to a Pod's port forward call
// when using WebSockets.
// The `port` query parameter must specify the port or
// ports (comma separated) to forward over.
// Port forwarding over SPDY does not use these options. It requires the port
// to be passed in the `port` header as part of request.
type
PodPortForwardOptions
struct
{
metav1
.
TypeMeta
`json:",inline"`
// List of ports to forward
// Required when using WebSockets
// +optional
Ports
[]
int32
`json:"ports,omitempty" protobuf:"varint,1,rep,name=ports"`
}
// PodProxyOptions is the query options to a Pod's proxy call.
type
PodProxyOptions
struct
{
metav1
.
TypeMeta
`json:",inline"`
...
...
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