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
95354490
Commit
95354490
authored
Feb 22, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21318 from kargakis/record-command-factory-method-tweak
Auto commit by PR queue bot
parents
2c3b3d57
55f402c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
factory.go
pkg/kubectl/cmd/util/factory.go
+9
-9
No files found.
pkg/kubectl/cmd/util/factory.go
View file @
95354490
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"os"
"os"
"os/user"
"os/user"
"path"
"path"
"path/filepath"
"strconv"
"strconv"
"strings"
"strings"
"time"
"time"
...
@@ -65,7 +66,6 @@ const (
...
@@ -65,7 +66,6 @@ const (
type
Factory
struct
{
type
Factory
struct
{
clients
*
ClientCache
clients
*
ClientCache
flags
*
pflag
.
FlagSet
flags
*
pflag
.
FlagSet
cmd
string
// Returns interfaces for dealing with arbitrary runtime.Objects.
// Returns interfaces for dealing with arbitrary runtime.Objects.
Object
func
()
(
meta
.
RESTMapper
,
runtime
.
ObjectTyper
)
Object
func
()
(
meta
.
RESTMapper
,
runtime
.
ObjectTyper
)
...
@@ -193,7 +193,6 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
...
@@ -193,7 +193,6 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
return
&
Factory
{
return
&
Factory
{
clients
:
clients
,
clients
:
clients
,
flags
:
flags
,
flags
:
flags
,
cmd
:
recordCommand
(
os
.
Args
),
Object
:
func
()
(
meta
.
RESTMapper
,
runtime
.
ObjectTyper
)
{
Object
:
func
()
(
meta
.
RESTMapper
,
runtime
.
ObjectTyper
)
{
cfg
,
err
:=
clientConfig
.
ClientConfig
()
cfg
,
err
:=
clientConfig
.
ClientConfig
()
...
@@ -554,17 +553,18 @@ func GetFirstPod(client *client.Client, namespace string, selector labels.Select
...
@@ -554,17 +553,18 @@ func GetFirstPod(client *client.Client, namespace string, selector labels.Select
return
pod
,
nil
return
pod
,
nil
}
}
func
recordCommand
(
args
[]
string
)
string
{
// Command will stringify and return all environment arguments ie. a command run by a client
if
len
(
args
)
>
0
{
// using the factory.
args
[
0
]
=
"kubectl"
// TODO: We need to filter out stuff like secrets.
func
(
f
*
Factory
)
Command
()
string
{
if
len
(
os
.
Args
)
==
0
{
return
""
}
}
base
:=
filepath
.
Base
(
os
.
Args
[
0
])
args
:=
append
([]
string
{
base
},
os
.
Args
[
1
:
]
...
)
return
strings
.
Join
(
args
,
" "
)
return
strings
.
Join
(
args
,
" "
)
}
}
func
(
f
*
Factory
)
Command
()
string
{
return
f
.
cmd
}
// BindFlags adds any flags that are common to all kubectl sub commands.
// BindFlags adds any flags that are common to all kubectl sub commands.
func
(
f
*
Factory
)
BindFlags
(
flags
*
pflag
.
FlagSet
)
{
func
(
f
*
Factory
)
BindFlags
(
flags
*
pflag
.
FlagSet
)
{
// any flags defined by external projects (not part of pflags)
// any flags defined by external projects (not part of pflags)
...
...
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