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
b38d8b18
Commit
b38d8b18
authored
Jul 01, 2015
by
nikhiljindal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating kubectl to use POST instead of GET
parent
09df440b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
48 deletions
+22
-48
exec.go
pkg/kubectl/cmd/exec.go
+1
-1
exec_test.go
pkg/kubectl/cmd/exec_test.go
+10
-23
portforward.go
pkg/kubectl/cmd/portforward.go
+1
-1
portforward_test.go
pkg/kubectl/cmd/portforward_test.go
+10
-23
No files found.
pkg/kubectl/cmd/exec.go
View file @
b38d8b18
...
@@ -169,7 +169,7 @@ func RunExec(f *cmdutil.Factory, cmd *cobra.Command, cmdIn io.Reader, cmdOut, cm
...
@@ -169,7 +169,7 @@ func RunExec(f *cmdutil.Factory, cmd *cobra.Command, cmdIn io.Reader, cmdOut, cm
return
err
return
err
}
}
req
:=
client
.
RESTClient
.
Ge
t
()
.
req
:=
client
.
RESTClient
.
Pos
t
()
.
Resource
(
"pods"
)
.
Resource
(
"pods"
)
.
Name
(
pod
.
Name
)
.
Name
(
pod
.
Name
)
.
Namespace
(
namespace
)
.
Namespace
(
namespace
)
.
...
...
pkg/kubectl/cmd/exec_test.go
View file @
b38d8b18
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
)
)
...
@@ -116,38 +117,24 @@ func TestPodAndContainer(t *testing.T) {
...
@@ -116,38 +117,24 @@ func TestPodAndContainer(t *testing.T) {
}
}
func
TestExec
(
t
*
testing
.
T
)
{
func
TestExec
(
t
*
testing
.
T
)
{
version
:=
testapi
.
Version
()
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
,
version
,
podPath
,
execPath
,
container
string
name
,
version
,
podPath
,
execPath
,
container
string
pod
*
api
.
Pod
pod
*
api
.
Pod
execErr
bool
execErr
bool
}{
}{
{
{
name
:
"
v1beta3 -
pod exec"
,
name
:
"pod exec"
,
version
:
"v1beta3"
,
version
:
version
,
podPath
:
"/api/
v1beta3
/namespaces/test/pods/foo"
,
podPath
:
"/api/
"
+
version
+
"
/namespaces/test/pods/foo"
,
execPath
:
"/api/
v1beta3
/namespaces/test/pods/foo/exec"
,
execPath
:
"/api/
"
+
version
+
"
/namespaces/test/pods/foo/exec"
,
pod
:
execPod
(),
pod
:
execPod
(),
},
},
{
{
name
:
"v1beta3 - pod exec error"
,
name
:
"pod exec error"
,
version
:
"v1beta3"
,
version
:
version
,
podPath
:
"/api/v1beta3/namespaces/test/pods/foo"
,
podPath
:
"/api/"
+
version
+
"/namespaces/test/pods/foo"
,
execPath
:
"/api/v1beta3/namespaces/test/pods/foo/exec"
,
execPath
:
"/api/"
+
version
+
"/namespaces/test/pods/foo/exec"
,
pod
:
execPod
(),
execErr
:
true
,
},
{
name
:
"v1 - pod exec"
,
version
:
"v1"
,
podPath
:
"/api/v1/namespaces/test/pods/foo"
,
execPath
:
"/api/v1/namespaces/test/pods/foo/exec"
,
pod
:
execPod
(),
},
{
name
:
"v1 - pod exec error"
,
version
:
"v1"
,
podPath
:
"/api/v1/namespaces/test/pods/foo"
,
execPath
:
"/api/v1/namespaces/test/pods/foo/exec"
,
pod
:
execPod
(),
pod
:
execPod
(),
execErr
:
true
,
execErr
:
true
,
},
},
...
...
pkg/kubectl/cmd/portforward.go
View file @
b38d8b18
...
@@ -117,7 +117,7 @@ func RunPortForward(f *cmdutil.Factory, cmd *cobra.Command, args []string, fw po
...
@@ -117,7 +117,7 @@ func RunPortForward(f *cmdutil.Factory, cmd *cobra.Command, args []string, fw po
close
(
stopCh
)
close
(
stopCh
)
}()
}()
req
:=
client
.
RESTClient
.
Ge
t
()
.
req
:=
client
.
RESTClient
.
Pos
t
()
.
Resource
(
"pods"
)
.
Resource
(
"pods"
)
.
Namespace
(
namespace
)
.
Namespace
(
namespace
)
.
Name
(
pod
.
Name
)
.
Name
(
pod
.
Name
)
.
...
...
pkg/kubectl/cmd/portforward_test.go
View file @
b38d8b18
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
)
)
...
@@ -38,6 +39,7 @@ func (f *fakePortForwarder) ForwardPorts(req *client.Request, config *client.Con
...
@@ -38,6 +39,7 @@ func (f *fakePortForwarder) ForwardPorts(req *client.Request, config *client.Con
}
}
func
TestPortForward
(
t
*
testing
.
T
)
{
func
TestPortForward
(
t
*
testing
.
T
)
{
version
:=
testapi
.
Version
()
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
,
version
,
podPath
,
pfPath
,
container
string
name
,
version
,
podPath
,
pfPath
,
container
string
...
@@ -45,32 +47,17 @@ func TestPortForward(t *testing.T) {
...
@@ -45,32 +47,17 @@ func TestPortForward(t *testing.T) {
pfErr
bool
pfErr
bool
}{
}{
{
{
name
:
"
v1beta3 -
pod portforward"
,
name
:
"pod portforward"
,
version
:
"v1beta3"
,
version
:
version
,
podPath
:
"/api/
v1beta3
/namespaces/test/pods/foo"
,
podPath
:
"/api/
"
+
version
+
"
/namespaces/test/pods/foo"
,
pfPath
:
"/api/
v1beta3
/namespaces/test/pods/foo/portforward"
,
pfPath
:
"/api/
"
+
version
+
"
/namespaces/test/pods/foo/portforward"
,
pod
:
execPod
(),
pod
:
execPod
(),
},
},
{
{
name
:
"v1beta3 - pod portforward error"
,
name
:
"pod portforward error"
,
version
:
"v1beta3"
,
version
:
version
,
podPath
:
"/api/v1beta3/namespaces/test/pods/foo"
,
podPath
:
"/api/"
+
version
+
"/namespaces/test/pods/foo"
,
pfPath
:
"/api/v1beta3/namespaces/test/pods/foo/portforward"
,
pfPath
:
"/api/"
+
version
+
"/namespaces/test/pods/foo/portforward"
,
pod
:
execPod
(),
pfErr
:
true
,
},
{
name
:
"v1 - pod portforward"
,
version
:
"v1"
,
podPath
:
"/api/v1/namespaces/test/pods/foo"
,
pfPath
:
"/api/v1/namespaces/test/pods/foo/portforward"
,
pod
:
execPod
(),
},
{
name
:
"v1 - pod portforward error"
,
version
:
"v1"
,
podPath
:
"/api/v1/namespaces/test/pods/foo"
,
pfPath
:
"/api/v1/namespaces/test/pods/foo/portforward"
,
pod
:
execPod
(),
pod
:
execPod
(),
pfErr
:
true
,
pfErr
:
true
,
},
},
...
...
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