Merge pull request #11999 from brendandburns/attach2

Add support for attach to kubectl
This commit is contained in:
Mike Danese
2015-07-31 12:51:08 -07:00
25 changed files with 1257 additions and 43 deletions

View File

@@ -1200,6 +1200,18 @@ func deepCopy_api_Pod(in Pod, out *Pod, c *conversion.Cloner) error {
return nil
}
func deepCopy_api_PodAttachOptions(in PodAttachOptions, out *PodAttachOptions, c *conversion.Cloner) error {
if err := deepCopy_api_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.Stdin = in.Stdin
out.Stdout = in.Stdout
out.Stderr = in.Stderr
out.TTY = in.TTY
out.Container = in.Container
return nil
}
func deepCopy_api_PodCondition(in PodCondition, out *PodCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
@@ -2144,6 +2156,7 @@ func init() {
deepCopy_api_PersistentVolumeSpec,
deepCopy_api_PersistentVolumeStatus,
deepCopy_api_Pod,
deepCopy_api_PodAttachOptions,
deepCopy_api_PodCondition,
deepCopy_api_PodExecOptions,
deepCopy_api_PodList,

View File

@@ -59,6 +59,7 @@ func init() {
&PersistentVolumeClaimList{},
&DeleteOptions{},
&ListOptions{},
&PodAttachOptions{},
&PodLogOptions{},
&PodExecOptions{},
&PodProxyOptions{},
@@ -106,6 +107,7 @@ func (*PersistentVolumeClaim) IsAnAPIObject() {}
func (*PersistentVolumeClaimList) IsAnAPIObject() {}
func (*DeleteOptions) IsAnAPIObject() {}
func (*ListOptions) IsAnAPIObject() {}
func (*PodAttachOptions) IsAnAPIObject() {}
func (*PodLogOptions) IsAnAPIObject() {}
func (*PodExecOptions) IsAnAPIObject() {}
func (*PodProxyOptions) IsAnAPIObject() {}

View File

@@ -1517,6 +1517,27 @@ type PodLogOptions struct {
Previous bool
}
// PodAttachOptions is the query options to a Pod's remote attach call
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
type PodAttachOptions struct {
TypeMeta `json:",inline"`
// Stdin if true indicates that stdin is to be redirected for the attach call
Stdin bool `json:"stdin,omitempty" description:"redirect the standard input stream of the pod for this call; defaults to false"`
// Stdout if true indicates that stdout is to be redirected for the attach call
Stdout bool `json:"stdout,omitempty" description:"redirect the standard output stream of the pod for this call; defaults to true"`
// Stderr if true indicates that stderr is to be redirected for the attach call
Stderr bool `json:"stderr,omitempty" description:"redirect the standard error stream of the pod for this call; defaults to true"`
// TTY if true indicates that a tty will be allocated for the attach call
TTY bool `json:"tty,omitempty" description:"allocate a terminal for this attach call; defaults to false"`
// Container to attach to.
Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."`
}
// PodExecOptions is the query options to a Pod's remote exec call
type PodExecOptions struct {
TypeMeta

View File

@@ -1392,6 +1392,21 @@ func convert_api_Pod_To_v1_Pod(in *api.Pod, out *Pod, s conversion.Scope) error
return nil
}
func convert_api_PodAttachOptions_To_v1_PodAttachOptions(in *api.PodAttachOptions, out *PodAttachOptions, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.PodAttachOptions))(in)
}
if err := convert_api_TypeMeta_To_v1_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
out.Stdin = in.Stdin
out.Stdout = in.Stdout
out.Stderr = in.Stderr
out.TTY = in.TTY
out.Container = in.Container
return nil
}
func convert_api_PodCondition_To_v1_PodCondition(in *api.PodCondition, out *PodCondition, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.PodCondition))(in)
@@ -3642,6 +3657,21 @@ func convert_v1_Pod_To_api_Pod(in *Pod, out *api.Pod, s conversion.Scope) error
return nil
}
func convert_v1_PodAttachOptions_To_api_PodAttachOptions(in *PodAttachOptions, out *api.PodAttachOptions, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*PodAttachOptions))(in)
}
if err := convert_v1_TypeMeta_To_api_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
out.Stdin = in.Stdin
out.Stdout = in.Stdout
out.Stderr = in.Stderr
out.TTY = in.TTY
out.Container = in.Container
return nil
}
func convert_v1_PodCondition_To_api_PodCondition(in *PodCondition, out *api.PodCondition, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*PodCondition))(in)
@@ -4595,6 +4625,7 @@ func init() {
convert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec,
convert_api_PersistentVolumeStatus_To_v1_PersistentVolumeStatus,
convert_api_PersistentVolume_To_v1_PersistentVolume,
convert_api_PodAttachOptions_To_v1_PodAttachOptions,
convert_api_PodCondition_To_v1_PodCondition,
convert_api_PodExecOptions_To_v1_PodExecOptions,
convert_api_PodList_To_v1_PodList,
@@ -4707,6 +4738,7 @@ func init() {
convert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec,
convert_v1_PersistentVolumeStatus_To_api_PersistentVolumeStatus,
convert_v1_PersistentVolume_To_api_PersistentVolume,
convert_v1_PodAttachOptions_To_api_PodAttachOptions,
convert_v1_PodCondition_To_api_PodCondition,
convert_v1_PodExecOptions_To_api_PodExecOptions,
convert_v1_PodList_To_api_PodList,

View File

@@ -1203,6 +1203,18 @@ func deepCopy_v1_Pod(in Pod, out *Pod, c *conversion.Cloner) error {
return nil
}
func deepCopy_v1_PodAttachOptions(in PodAttachOptions, out *PodAttachOptions, c *conversion.Cloner) error {
if err := deepCopy_v1_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.Stdin = in.Stdin
out.Stdout = in.Stdout
out.Stderr = in.Stderr
out.TTY = in.TTY
out.Container = in.Container
return nil
}
func deepCopy_v1_PodCondition(in PodCondition, out *PodCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
@@ -2152,6 +2164,7 @@ func init() {
deepCopy_v1_PersistentVolumeSpec,
deepCopy_v1_PersistentVolumeStatus,
deepCopy_v1_Pod,
deepCopy_v1_PodAttachOptions,
deepCopy_v1_PodCondition,
deepCopy_v1_PodExecOptions,
deepCopy_v1_PodList,

View File

@@ -74,6 +74,7 @@ func addKnownTypes() {
&PersistentVolumeClaimList{},
&DeleteOptions{},
&ListOptions{},
&PodAttachOptions{},
&PodLogOptions{},
&PodExecOptions{},
&PodProxyOptions{},
@@ -121,6 +122,7 @@ func (*PersistentVolumeClaim) IsAnAPIObject() {}
func (*PersistentVolumeClaimList) IsAnAPIObject() {}
func (*DeleteOptions) IsAnAPIObject() {}
func (*ListOptions) IsAnAPIObject() {}
func (*PodAttachOptions) IsAnAPIObject() {}
func (*PodLogOptions) IsAnAPIObject() {}
func (*PodExecOptions) IsAnAPIObject() {}
func (*PodProxyOptions) IsAnAPIObject() {}

View File

@@ -1475,6 +1475,28 @@ type PodLogOptions struct {
Previous bool `json:"previous,omitempty" description:"return previous terminated container logs; defaults to false"`
}
// PodAttachOptions is the query options to a Pod's remote attach call
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
type PodAttachOptions struct {
TypeMeta `json:",inline"`
// Stdin if true indicates that stdin is to be redirected for the attach call
Stdin bool `json:"stdin,omitempty" description:"redirect the standard input stream of the pod for this call; defaults to false"`
// Stdout if true indicates that stdout is to be redirected for the attach call
Stdout bool `json:"stdout,omitempty" description:"redirect the standard output stream of the pod for this call; defaults to true"`
// Stderr if true indicates that stderr is to be redirected for the attach call
Stderr bool `json:"stderr,omitempty" description:"redirect the standard error stream of the pod for this call; defaults to true"`
// TTY if true indicates that a tty will be allocated for the attach call, this is passed through to the container runtime so the tty
// is allocated on the worker node by the container runtime.
TTY bool `json:"tty,omitempty" description:"allocate a terminal for this attach call; defaults to false"`
// Container to attach to.
Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."`
}
// PodExecOptions is the query options to a Pod's remote exec call
type PodExecOptions struct {
TypeMeta `json:",inline"`