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
409bfc43
Unverified
Commit
409bfc43
authored
Nov 29, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 29, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #71047 from pivotal-k8s/bump-k8s-utils
Bump k8s.io/uitls to 8e7ff06
parents
791758b1
0d4b5c98
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
176 additions
and
19 deletions
+176
-19
Godeps.json
Godeps/Godeps.json
+4
-4
flags_test.go
cmd/kubeadm/app/phases/kubelet/flags_test.go
+13
-8
prober.go
pkg/kubelet/prober/prober.go
+20
-0
exec_test.go
pkg/probe/exec/exec_test.go
+14
-0
Godeps.json
staging/src/k8s.io/apiserver/Godeps/Godeps.json
+1
-1
Godeps.json
...ing/src/k8s.io/kube-controller-manager/Godeps/Godeps.json
+1
-1
Godeps.json
staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json
+1
-1
clock.go
vendor/k8s.io/utils/clock/clock.go
+4
-1
exec.go
vendor/k8s.io/utils/exec/exec.go
+37
-0
fake_exec.go
vendor/k8s.io/utils/exec/testing/fake_exec.go
+62
-3
OWNERS
vendor/k8s.io/utils/pointer/OWNERS
+9
-0
pointer.go
vendor/k8s.io/utils/pointer/pointer.go
+10
-0
No files found.
Godeps/Godeps.json
View file @
409bfc43
...
...
@@ -4049,19 +4049,19 @@
},
{
"ImportPath"
:
"k8s.io/utils/clock"
,
"Rev"
:
"
66066c83e385e385ccc3c964b44fd7dcd413d0ed
"
"Rev"
:
"
8e7ff06bf0e2d3289061230af203e430a15b6dcc
"
},
{
"ImportPath"
:
"k8s.io/utils/exec"
,
"Rev"
:
"
66066c83e385e385ccc3c964b44fd7dcd413d0ed
"
"Rev"
:
"
8e7ff06bf0e2d3289061230af203e430a15b6dcc
"
},
{
"ImportPath"
:
"k8s.io/utils/exec/testing"
,
"Rev"
:
"
66066c83e385e385ccc3c964b44fd7dcd413d0ed
"
"Rev"
:
"
8e7ff06bf0e2d3289061230af203e430a15b6dcc
"
},
{
"ImportPath"
:
"k8s.io/utils/pointer"
,
"Rev"
:
"
66066c83e385e385ccc3c964b44fd7dcd413d0ed
"
"Rev"
:
"
8e7ff06bf0e2d3289061230af203e430a15b6dcc
"
},
{
"ImportPath"
:
"sigs.k8s.io/yaml"
,
...
...
cmd/kubeadm/app/phases/kubelet/flags_test.go
View file @
409bfc43
...
...
@@ -34,14 +34,19 @@ type fakeCmd struct {
err
error
}
func
(
f
fakeCmd
)
Run
()
error
{
return
f
.
err
}
func
(
f
fakeCmd
)
CombinedOutput
()
([]
byte
,
error
)
{
return
f
.
b
,
f
.
err
}
func
(
f
fakeCmd
)
Output
()
([]
byte
,
error
)
{
return
f
.
b
,
f
.
err
}
func
(
f
fakeCmd
)
SetDir
(
dir
string
)
{}
func
(
f
fakeCmd
)
SetStdin
(
in
io
.
Reader
)
{}
func
(
f
fakeCmd
)
SetStdout
(
out
io
.
Writer
)
{}
func
(
f
fakeCmd
)
SetStderr
(
out
io
.
Writer
)
{}
func
(
f
fakeCmd
)
Stop
()
{}
func
(
f
fakeCmd
)
Run
()
error
{
return
f
.
err
}
func
(
f
fakeCmd
)
CombinedOutput
()
([]
byte
,
error
)
{
return
f
.
b
,
f
.
err
}
func
(
f
fakeCmd
)
Output
()
([]
byte
,
error
)
{
return
f
.
b
,
f
.
err
}
func
(
f
fakeCmd
)
SetDir
(
dir
string
)
{}
func
(
f
fakeCmd
)
SetStdin
(
in
io
.
Reader
)
{}
func
(
f
fakeCmd
)
SetStdout
(
out
io
.
Writer
)
{}
func
(
f
fakeCmd
)
SetStderr
(
out
io
.
Writer
)
{}
func
(
f
fakeCmd
)
SetEnv
([]
string
)
{}
func
(
f
fakeCmd
)
Stop
()
{}
func
(
f
fakeCmd
)
Start
()
error
{
return
nil
}
func
(
f
fakeCmd
)
Wait
()
error
{
return
nil
}
func
(
f
fakeCmd
)
StdoutPipe
()
(
io
.
ReadCloser
,
error
)
{
return
nil
,
nil
}
func
(
f
fakeCmd
)
StderrPipe
()
(
io
.
ReadCloser
,
error
)
{
return
nil
,
nil
}
type
fakeExecer
struct
{
ioMap
map
[
string
]
fakeCmd
...
...
pkg/kubelet/prober/prober.go
View file @
409bfc43
...
...
@@ -274,6 +274,26 @@ func (eic execInContainer) SetStderr(out io.Writer) {
//unimplemented
}
func
(
eic
execInContainer
)
SetEnv
(
env
[]
string
)
{
//unimplemented
}
func
(
eic
execInContainer
)
Stop
()
{
//unimplemented
}
func
(
eic
execInContainer
)
Start
()
error
{
return
fmt
.
Errorf
(
"unimplemented"
)
}
func
(
eic
execInContainer
)
Wait
()
error
{
return
fmt
.
Errorf
(
"unimplemented"
)
}
func
(
eic
execInContainer
)
StdoutPipe
()
(
io
.
ReadCloser
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"unimplemented"
)
}
func
(
eic
execInContainer
)
StderrPipe
()
(
io
.
ReadCloser
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"unimplemented"
)
}
pkg/probe/exec/exec_test.go
View file @
409bfc43
...
...
@@ -50,8 +50,22 @@ func (f *FakeCmd) SetStdout(out io.Writer) {}
func
(
f
*
FakeCmd
)
SetStderr
(
out
io
.
Writer
)
{}
func
(
f
*
FakeCmd
)
SetEnv
(
env
[]
string
)
{}
func
(
f
*
FakeCmd
)
Stop
()
{}
func
(
f
*
FakeCmd
)
Start
()
error
{
return
nil
}
func
(
f
*
FakeCmd
)
Wait
()
error
{
return
nil
}
func
(
f
*
FakeCmd
)
StdoutPipe
()
(
io
.
ReadCloser
,
error
)
{
return
nil
,
nil
}
func
(
f
*
FakeCmd
)
StderrPipe
()
(
io
.
ReadCloser
,
error
)
{
return
nil
,
nil
}
type
fakeExitError
struct
{
exited
bool
statusCode
int
...
...
staging/src/k8s.io/apiserver/Godeps/Godeps.json
View file @
409bfc43
...
...
@@ -2056,7 +2056,7 @@
},
{
"ImportPath"
:
"k8s.io/utils/pointer"
,
"Rev"
:
"
66066c83e385e385ccc3c964b44fd7dcd413d0ed
"
"Rev"
:
"
8e7ff06bf0e2d3289061230af203e430a15b6dcc
"
},
{
"ImportPath"
:
"sigs.k8s.io/yaml"
,
...
...
staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json
View file @
409bfc43
...
...
@@ -160,7 +160,7 @@
},
{
"ImportPath"
:
"k8s.io/utils/pointer"
,
"Rev"
:
"
66066c83e385e385ccc3c964b44fd7dcd413d0ed
"
"Rev"
:
"
8e7ff06bf0e2d3289061230af203e430a15b6dcc
"
}
]
}
staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json
View file @
409bfc43
...
...
@@ -160,7 +160,7 @@
},
{
"ImportPath"
:
"k8s.io/utils/pointer"
,
"Rev"
:
"
66066c83e385e385ccc3c964b44fd7dcd413d0ed
"
"Rev"
:
"
8e7ff06bf0e2d3289061230af203e430a15b6dcc
"
}
]
}
vendor/k8s.io/utils/clock/clock.go
View file @
409bfc43
...
...
@@ -44,21 +44,24 @@ func (RealClock) Since(ts time.Time) time.Duration {
return
time
.
Since
(
ts
)
}
//
S
ame as time.After(d).
//
After is the s
ame as time.After(d).
func
(
RealClock
)
After
(
d
time
.
Duration
)
<-
chan
time
.
Time
{
return
time
.
After
(
d
)
}
// NewTimer is the same as time.NewTimer(d)
func
(
RealClock
)
NewTimer
(
d
time
.
Duration
)
Timer
{
return
&
realTimer
{
timer
:
time
.
NewTimer
(
d
),
}
}
// Tick is the same as time.Tick(d)
func
(
RealClock
)
Tick
(
d
time
.
Duration
)
<-
chan
time
.
Time
{
return
time
.
Tick
(
d
)
}
// Sleep is the same as time.Sleep(d)
func
(
RealClock
)
Sleep
(
d
time
.
Duration
)
{
time
.
Sleep
(
d
)
}
...
...
vendor/k8s.io/utils/exec/exec.go
View file @
409bfc43
...
...
@@ -60,6 +60,17 @@ type Cmd interface {
SetStdin
(
in
io
.
Reader
)
SetStdout
(
out
io
.
Writer
)
SetStderr
(
out
io
.
Writer
)
SetEnv
(
env
[]
string
)
// StdoutPipe and StderrPipe for getting the process' Stdout and Stderr as
// Readers
StdoutPipe
()
(
io
.
ReadCloser
,
error
)
StderrPipe
()
(
io
.
ReadCloser
,
error
)
// Start and Wait are for running a process non-blocking
Start
()
error
Wait
()
error
// Stops the command by sending SIGTERM. It is not guaranteed the
// process will stop before this function returns. If the process is not
// responding, an internal timer function will send a SIGKILL to force
...
...
@@ -121,6 +132,30 @@ func (cmd *cmdWrapper) SetStderr(out io.Writer) {
cmd
.
Stderr
=
out
}
func
(
cmd
*
cmdWrapper
)
SetEnv
(
env
[]
string
)
{
cmd
.
Env
=
env
}
func
(
cmd
*
cmdWrapper
)
StdoutPipe
()
(
io
.
ReadCloser
,
error
)
{
r
,
err
:=
(
*
osexec
.
Cmd
)(
cmd
)
.
StdoutPipe
()
return
r
,
handleError
(
err
)
}
func
(
cmd
*
cmdWrapper
)
StderrPipe
()
(
io
.
ReadCloser
,
error
)
{
r
,
err
:=
(
*
osexec
.
Cmd
)(
cmd
)
.
StderrPipe
()
return
r
,
handleError
(
err
)
}
func
(
cmd
*
cmdWrapper
)
Start
()
error
{
err
:=
(
*
osexec
.
Cmd
)(
cmd
)
.
Start
()
return
handleError
(
err
)
}
func
(
cmd
*
cmdWrapper
)
Wait
()
error
{
err
:=
(
*
osexec
.
Cmd
)(
cmd
)
.
Wait
()
return
handleError
(
err
)
}
// Run is part of the Cmd interface.
func
(
cmd
*
cmdWrapper
)
Run
()
error
{
err
:=
(
*
osexec
.
Cmd
)(
cmd
)
.
Run
()
...
...
@@ -206,10 +241,12 @@ func (e CodeExitError) String() string {
return
e
.
Err
.
Error
()
}
// Exited is to check if the process has finished
func
(
e
CodeExitError
)
Exited
()
bool
{
return
true
}
// ExitStatus is for checking the error code
func
(
e
CodeExitError
)
ExitStatus
()
int
{
return
e
.
Code
}
vendor/k8s.io/utils/exec/testing/fake_exec.go
View file @
409bfc43
...
...
@@ -24,7 +24,7 @@ import (
"k8s.io/utils/exec"
)
//
A
simple scripted Interface type.
//
FakeExec is a
simple scripted Interface type.
type
FakeExec
struct
{
CommandScript
[]
FakeCommandAction
CommandCalls
int
...
...
@@ -33,8 +33,10 @@ type FakeExec struct {
var
_
exec
.
Interface
=
&
FakeExec
{}
// FakeCommandAction is the function to be executed
type
FakeCommandAction
func
(
cmd
string
,
args
...
string
)
exec
.
Cmd
// Command is to track the commands that are executed
func
(
fake
*
FakeExec
)
Command
(
cmd
string
,
args
...
string
)
exec
.
Cmd
{
if
fake
.
CommandCalls
>
len
(
fake
.
CommandScript
)
-
1
{
panic
(
fmt
.
Sprintf
(
"ran out of Command() actions. Could not handle command [%d]: %s args: %v"
,
fake
.
CommandCalls
,
cmd
,
args
))
...
...
@@ -44,15 +46,17 @@ func (fake *FakeExec) Command(cmd string, args ...string) exec.Cmd {
return
fake
.
CommandScript
[
i
](
cmd
,
args
...
)
}
// CommandContext wraps arguments into exec.Cmd
func
(
fake
*
FakeExec
)
CommandContext
(
ctx
context
.
Context
,
cmd
string
,
args
...
string
)
exec
.
Cmd
{
return
fake
.
Command
(
cmd
,
args
...
)
}
// LookPath is for finding the path of a file
func
(
fake
*
FakeExec
)
LookPath
(
file
string
)
(
string
,
error
)
{
return
fake
.
LookPathFunc
(
file
)
}
//
A
simple scripted Cmd type.
//
FakeCmd is a
simple scripted Cmd type.
type
FakeCmd
struct
{
Argv
[]
string
CombinedOutputScript
[]
FakeCombinedOutputAction
...
...
@@ -65,34 +69,84 @@ type FakeCmd struct {
Stdin
io
.
Reader
Stdout
io
.
Writer
Stderr
io
.
Writer
Env
[]
string
StdoutPipeResponse
FakeStdIOPipeResponse
StderrPipeResponse
FakeStdIOPipeResponse
WaitResponse
error
StartResponse
error
}
var
_
exec
.
Cmd
=
&
FakeCmd
{}
// InitFakeCmd is for creating a fake exec.Cmd
func
InitFakeCmd
(
fake
*
FakeCmd
,
cmd
string
,
args
...
string
)
exec
.
Cmd
{
fake
.
Argv
=
append
([]
string
{
cmd
},
args
...
)
return
fake
}
// FakeStdIOPipeResponse holds responses to use as fakes for the StdoutPipe and
// StderrPipe method calls
type
FakeStdIOPipeResponse
struct
{
ReadCloser
io
.
ReadCloser
Error
error
}
// FakeCombinedOutputAction is a function type
type
FakeCombinedOutputAction
func
()
([]
byte
,
error
)
// FakeRunAction is a function type
type
FakeRunAction
func
()
([]
byte
,
[]
byte
,
error
)
// SetDir sets the directory
func
(
fake
*
FakeCmd
)
SetDir
(
dir
string
)
{
fake
.
Dirs
=
append
(
fake
.
Dirs
,
dir
)
}
// SetStdin sets the stdin
func
(
fake
*
FakeCmd
)
SetStdin
(
in
io
.
Reader
)
{
fake
.
Stdin
=
in
}
// SetStdout sets the stdout
func
(
fake
*
FakeCmd
)
SetStdout
(
out
io
.
Writer
)
{
fake
.
Stdout
=
out
}
// SetStderr sets the stderr
func
(
fake
*
FakeCmd
)
SetStderr
(
out
io
.
Writer
)
{
fake
.
Stderr
=
out
}
// SetEnv sets the environment variables
func
(
fake
*
FakeCmd
)
SetEnv
(
env
[]
string
)
{
fake
.
Env
=
env
}
// StdoutPipe returns an injected ReadCloser & error (via StdoutPipeResponse)
// to be able to inject an output stream on Stdout
func
(
fake
*
FakeCmd
)
StdoutPipe
()
(
io
.
ReadCloser
,
error
)
{
return
fake
.
StdoutPipeResponse
.
ReadCloser
,
fake
.
StdoutPipeResponse
.
Error
}
// StderrPipe returns an injected ReadCloser & error (via StderrPipeResponse)
// to be able to inject an output stream on Stderr
func
(
fake
*
FakeCmd
)
StderrPipe
()
(
io
.
ReadCloser
,
error
)
{
return
fake
.
StderrPipeResponse
.
ReadCloser
,
fake
.
StderrPipeResponse
.
Error
}
// Start mimicks starting the process (in the background) and returns the
// injected StartResponse
func
(
fake
*
FakeCmd
)
Start
()
error
{
return
fake
.
StartResponse
}
// Wait mimicks waiting for the process to exit returns the
// injected WaitResponse
func
(
fake
*
FakeCmd
)
Wait
()
error
{
return
fake
.
WaitResponse
}
// Run sets runs the command
func
(
fake
*
FakeCmd
)
Run
()
error
{
if
fake
.
RunCalls
>
len
(
fake
.
RunScript
)
-
1
{
panic
(
"ran out of Run() actions"
)
...
...
@@ -113,6 +167,7 @@ func (fake *FakeCmd) Run() error {
return
err
}
// CombinedOutput returns the output from the command
func
(
fake
*
FakeCmd
)
CombinedOutput
()
([]
byte
,
error
)
{
if
fake
.
CombinedOutputCalls
>
len
(
fake
.
CombinedOutputScript
)
-
1
{
panic
(
"ran out of CombinedOutput() actions"
)
...
...
@@ -126,15 +181,17 @@ func (fake *FakeCmd) CombinedOutput() ([]byte, error) {
return
fake
.
CombinedOutputScript
[
i
]()
}
// Output is the response from the command
func
(
fake
*
FakeCmd
)
Output
()
([]
byte
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"unimplemented"
)
}
// Stop is to stop the process
func
(
fake
*
FakeCmd
)
Stop
()
{
// no-op
}
//
A
simple fake ExitError type.
//
FakeExitError is a
simple fake ExitError type.
type
FakeExitError
struct
{
Status
int
}
...
...
@@ -149,10 +206,12 @@ func (fake FakeExitError) Error() string {
return
fake
.
String
()
}
// Exited always returns true
func
(
fake
FakeExitError
)
Exited
()
bool
{
return
true
}
// ExitStatus returns the fake status
func
(
fake
FakeExitError
)
ExitStatus
()
int
{
return
fake
.
Status
}
vendor/k8s.io/utils/pointer/OWNERS
0 → 100644
View file @
409bfc43
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- apelisse
- stewart-yu
- thockin
reviewers:
- apelisse
- stewart-yu
- thockin
vendor/k8s.io/utils/pointer/pointer.go
View file @
409bfc43
...
...
@@ -74,3 +74,13 @@ func BoolPtr(b bool) *bool {
func
StringPtr
(
s
string
)
*
string
{
return
&
s
}
// Float32Ptr returns a pointer to the passed float32.
func
Float32Ptr
(
i
float32
)
*
float32
{
return
&
i
}
// Float64Ptr returns a pointer to the passed float64.
func
Float64Ptr
(
i
float64
)
*
float64
{
return
&
i
}
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