*: update kube vendor to v1.7.4
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
c67859731f
commit
d56bf090ce
1032 changed files with 273965 additions and 40081 deletions
38
vendor/k8s.io/kubernetes/pkg/util/term/resize.go
generated
vendored
38
vendor/k8s.io/kubernetes/pkg/util/term/resize.go
generated
vendored
|
@ -21,17 +21,12 @@ import (
|
|||
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
)
|
||||
|
||||
// Size represents the width and height of a terminal.
|
||||
type Size struct {
|
||||
Width uint16
|
||||
Height uint16
|
||||
}
|
||||
|
||||
// GetSize returns the current size of the user's terminal. If it isn't a terminal,
|
||||
// nil is returned.
|
||||
func (t TTY) GetSize() *Size {
|
||||
func (t TTY) GetSize() *remotecommand.TerminalSize {
|
||||
outFd, isTerminal := term.GetFdInfo(t.Out)
|
||||
if !isTerminal {
|
||||
return nil
|
||||
|
@ -40,19 +35,19 @@ func (t TTY) GetSize() *Size {
|
|||
}
|
||||
|
||||
// GetSize returns the current size of the terminal associated with fd.
|
||||
func GetSize(fd uintptr) *Size {
|
||||
func GetSize(fd uintptr) *remotecommand.TerminalSize {
|
||||
winsize, err := term.GetWinsize(fd)
|
||||
if err != nil {
|
||||
runtime.HandleError(fmt.Errorf("unable to get terminal size: %v", err))
|
||||
return nil
|
||||
}
|
||||
|
||||
return &Size{Width: winsize.Width, Height: winsize.Height}
|
||||
return &remotecommand.TerminalSize{Width: winsize.Width, Height: winsize.Height}
|
||||
}
|
||||
|
||||
// MonitorSize monitors the terminal's size. It returns a TerminalSizeQueue primed with
|
||||
// initialSizes, or nil if there's no TTY present.
|
||||
func (t *TTY) MonitorSize(initialSizes ...*Size) TerminalSizeQueue {
|
||||
func (t *TTY) MonitorSize(initialSizes ...*remotecommand.TerminalSize) remotecommand.TerminalSizeQueue {
|
||||
outFd, isTerminal := term.GetFdInfo(t.Out)
|
||||
if !isTerminal {
|
||||
return nil
|
||||
|
@ -62,7 +57,7 @@ func (t *TTY) MonitorSize(initialSizes ...*Size) TerminalSizeQueue {
|
|||
t: *t,
|
||||
// make it buffered so we can send the initial terminal sizes without blocking, prior to starting
|
||||
// the streaming below
|
||||
resizeChan: make(chan Size, len(initialSizes)),
|
||||
resizeChan: make(chan remotecommand.TerminalSize, len(initialSizes)),
|
||||
stopResizing: make(chan struct{}),
|
||||
}
|
||||
|
||||
|
@ -71,27 +66,20 @@ func (t *TTY) MonitorSize(initialSizes ...*Size) TerminalSizeQueue {
|
|||
return t.sizeQueue
|
||||
}
|
||||
|
||||
// TerminalSizeQueue is capable of returning terminal resize events as they occur.
|
||||
type TerminalSizeQueue interface {
|
||||
// Next returns the new terminal size after the terminal has been resized. It returns nil when
|
||||
// monitoring has been stopped.
|
||||
Next() *Size
|
||||
}
|
||||
|
||||
// sizeQueue implements TerminalSizeQueue
|
||||
// sizeQueue implements remotecommand.TerminalSizeQueue
|
||||
type sizeQueue struct {
|
||||
t TTY
|
||||
// resizeChan receives a Size each time the user's terminal is resized.
|
||||
resizeChan chan Size
|
||||
resizeChan chan remotecommand.TerminalSize
|
||||
stopResizing chan struct{}
|
||||
}
|
||||
|
||||
// make sure sizeQueue implements the TerminalSizeQueue interface
|
||||
var _ TerminalSizeQueue = &sizeQueue{}
|
||||
// make sure sizeQueue implements the resize.TerminalSizeQueue interface
|
||||
var _ remotecommand.TerminalSizeQueue = &sizeQueue{}
|
||||
|
||||
// monitorSize primes resizeChan with initialSizes and then monitors for resize events. With each
|
||||
// new event, it sends the current terminal size to resizeChan.
|
||||
func (s *sizeQueue) monitorSize(outFd uintptr, initialSizes ...*Size) {
|
||||
func (s *sizeQueue) monitorSize(outFd uintptr, initialSizes ...*remotecommand.TerminalSize) {
|
||||
// send the initial sizes
|
||||
for i := range initialSizes {
|
||||
if initialSizes[i] != nil {
|
||||
|
@ -99,7 +87,7 @@ func (s *sizeQueue) monitorSize(outFd uintptr, initialSizes ...*Size) {
|
|||
}
|
||||
}
|
||||
|
||||
resizeEvents := make(chan Size, 1)
|
||||
resizeEvents := make(chan remotecommand.TerminalSize, 1)
|
||||
|
||||
monitorResizeEvents(outFd, resizeEvents, s.stopResizing)
|
||||
|
||||
|
@ -130,7 +118,7 @@ func (s *sizeQueue) monitorSize(outFd uintptr, initialSizes ...*Size) {
|
|||
|
||||
// Next returns the new terminal size after the terminal has been resized. It returns nil when
|
||||
// monitoring has been stopped.
|
||||
func (s *sizeQueue) Next() *Size {
|
||||
func (s *sizeQueue) Next() *remotecommand.TerminalSize {
|
||||
size, ok := <-s.resizeChan
|
||||
if !ok {
|
||||
return nil
|
||||
|
|
3
vendor/k8s.io/kubernetes/pkg/util/term/resizeevents.go
generated
vendored
3
vendor/k8s.io/kubernetes/pkg/util/term/resizeevents.go
generated
vendored
|
@ -24,12 +24,13 @@ import (
|
|||
"syscall"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
)
|
||||
|
||||
// monitorResizeEvents spawns a goroutine that waits for SIGWINCH signals (these indicate the
|
||||
// terminal has resized). After receiving a SIGWINCH, this gets the terminal size and tries to send
|
||||
// it to the resizeEvents channel. The goroutine stops when the stop channel is closed.
|
||||
func monitorResizeEvents(fd uintptr, resizeEvents chan<- Size, stop chan struct{}) {
|
||||
func monitorResizeEvents(fd uintptr, resizeEvents chan<- remotecommand.TerminalSize, stop chan struct{}) {
|
||||
go func() {
|
||||
defer runtime.HandleCrash()
|
||||
|
||||
|
|
3
vendor/k8s.io/kubernetes/pkg/util/term/resizeevents_windows.go
generated
vendored
3
vendor/k8s.io/kubernetes/pkg/util/term/resizeevents_windows.go
generated
vendored
|
@ -20,12 +20,13 @@ import (
|
|||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
)
|
||||
|
||||
// monitorResizeEvents spawns a goroutine that periodically gets the terminal size and tries to send
|
||||
// it to the resizeEvents channel if the size has changed. The goroutine stops when the stop channel
|
||||
// is closed.
|
||||
func monitorResizeEvents(fd uintptr, resizeEvents chan<- Size, stop chan struct{}) {
|
||||
func monitorResizeEvents(fd uintptr, resizeEvents chan<- remotecommand.TerminalSize, stop chan struct{}) {
|
||||
go func() {
|
||||
defer runtime.HandleCrash()
|
||||
|
||||
|
|
3
vendor/k8s.io/kubernetes/pkg/util/term/setsize.go
generated
vendored
3
vendor/k8s.io/kubernetes/pkg/util/term/setsize.go
generated
vendored
|
@ -20,9 +20,10 @@ package term
|
|||
|
||||
import (
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
)
|
||||
|
||||
// SetSize sets the terminal size associated with fd.
|
||||
func SetSize(fd uintptr, size Size) error {
|
||||
func SetSize(fd uintptr, size remotecommand.TerminalSize) error {
|
||||
return term.SetWinsize(fd, &term.Winsize{Height: size.Height, Width: size.Width})
|
||||
}
|
||||
|
|
6
vendor/k8s.io/kubernetes/pkg/util/term/setsize_unsupported.go
generated
vendored
6
vendor/k8s.io/kubernetes/pkg/util/term/setsize_unsupported.go
generated
vendored
|
@ -18,7 +18,11 @@ limitations under the License.
|
|||
|
||||
package term
|
||||
|
||||
func SetSize(fd uintptr, size Size) error {
|
||||
import (
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
)
|
||||
|
||||
func SetSize(fd uintptr, size remotecommand.TerminalSize) error {
|
||||
// NOP
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue