diff --git a/pkg/api/conversion.go b/pkg/api/conversion.go index 89bfdefff5..bd33db677d 100644 --- a/pkg/api/conversion.go +++ b/pkg/api/conversion.go @@ -35,6 +35,10 @@ func init() { obj.LabelSelector = labels.Everything() obj.FieldSelector = fields.Everything() }, + func(obj *PodExecOptions) { + obj.Stderr = true + obj.Stdout = true + }, ) Scheme.AddConversionFuncs( func(in *util.Time, out *util.Time, s conversion.Scope) error { diff --git a/pkg/api/latest/latest.go b/pkg/api/latest/latest.go index 63b131c54e..887bba1a5b 100644 --- a/pkg/api/latest/latest.go +++ b/pkg/api/latest/latest.go @@ -125,7 +125,14 @@ func init() { } // these kinds should be excluded from the list of resources - ignoredKinds := util.NewStringSet("ListOptions", "DeleteOptions", "Status", "ContainerManifest") + ignoredKinds := util.NewStringSet( + "ListOptions", + "DeleteOptions", + "Status", + "ContainerManifest", + "PodLogOptions", + "PodExecOptions", + "PodProxyOptions") // enumerate all supported versions, get the kinds, and register with the mapper how to address our resources for _, version := range versions { diff --git a/pkg/api/register.go b/pkg/api/register.go index 2918a15328..4a35296199 100644 --- a/pkg/api/register.go +++ b/pkg/api/register.go @@ -58,6 +58,8 @@ func init() { &DeleteOptions{}, &ListOptions{}, &PodLogOptions{}, + &PodExecOptions{}, + &PodProxyOptions{}, ) // Legacy names are supported Scheme.AddKnownTypeWithName("", "Minion", &Node{}) @@ -97,3 +99,5 @@ func (*PersistentVolumeClaimList) IsAnAPIObject() {} func (*DeleteOptions) IsAnAPIObject() {} func (*ListOptions) IsAnAPIObject() {} func (*PodLogOptions) IsAnAPIObject() {} +func (*PodExecOptions) IsAnAPIObject() {} +func (*PodProxyOptions) IsAnAPIObject() {} diff --git a/pkg/api/serialization_test.go b/pkg/api/serialization_test.go index d8c02773de..ca79e6f940 100644 --- a/pkg/api/serialization_test.go +++ b/pkg/api/serialization_test.go @@ -129,7 +129,7 @@ func TestList(t *testing.T) { } var nonRoundTrippableTypes = util.NewStringSet("ContainerManifest", "ContainerManifestList") -var nonInternalRoundTrippableTypes = util.NewStringSet("List", "ListOptions") +var nonInternalRoundTrippableTypes = util.NewStringSet("List", "ListOptions", "PodExecOptions") func TestRoundTripTypes(t *testing.T) { // api.Scheme.Log(t) diff --git a/pkg/api/types.go b/pkg/api/types.go index cc91b969af..5868517c84 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1304,6 +1304,37 @@ type PodLogOptions struct { Follow bool } +// PodExecOptions is the query options to a Pod's remote exec call +type PodExecOptions struct { + TypeMeta + + // Stdin if true indicates that stdin is to be redirected for the exec call + Stdin bool + + // Stdout if true indicates that stdout is to be redirected for the exec call + Stdout bool + + // Stderr if true indicates that stderr is to be redirected for the exec call + Stderr bool + + // TTY if true indicates that a tty will be allocated for the exec call + TTY bool + + // Container in which to execute the command. + Container string + + // Command is the remote command to execute + Command string +} + +// PodProxyOptions is the query options to a Pod's proxy call +type PodProxyOptions struct { + TypeMeta + + // Path is the URL path to use for the current proxy request + Path string +} + // Status is a return value for calls that don't return other objects. // TODO: this could go in apiserver, but I'm including it here so clients needn't // import both. diff --git a/pkg/api/v1beta1/register.go b/pkg/api/v1beta1/register.go index 42d8be4dca..f2a137292e 100644 --- a/pkg/api/v1beta1/register.go +++ b/pkg/api/v1beta1/register.go @@ -66,6 +66,8 @@ func init() { &DeleteOptions{}, &ListOptions{}, &PodLogOptions{}, + &PodExecOptions{}, + &PodProxyOptions{}, ) // Future names are supported api.Scheme.AddKnownTypeWithName("v1beta1", "Node", &Minion{}) @@ -106,3 +108,5 @@ func (*PersistentVolumeClaimList) IsAnAPIObject() {} func (*DeleteOptions) IsAnAPIObject() {} func (*ListOptions) IsAnAPIObject() {} func (*PodLogOptions) IsAnAPIObject() {} +func (*PodExecOptions) IsAnAPIObject() {} +func (*PodProxyOptions) IsAnAPIObject() {} diff --git a/pkg/api/v1beta1/types.go b/pkg/api/v1beta1/types.go index 8ad1fb9ea9..57d41de70e 100644 --- a/pkg/api/v1beta1/types.go +++ b/pkg/api/v1beta1/types.go @@ -1159,6 +1159,37 @@ type PodLogOptions struct { Follow bool `json:"follow,omitempty" description:"follow the log stream of the pod; defaults to false"` } +// PodExecOptions is the query options to a Pod's remote exec call +type PodExecOptions struct { + TypeMeta `json:",inline"` + + // Stdin if true indicates that stdin is to be redirected for the exec 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 exec 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 exec 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 exec call + TTY bool `json:"tty,omitempty" description:"allocate a terminal for this exec call; defaults to false"` + + // Container in which to execute the command. + 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."` + + // Command is the remote command to execute + Command string `json:"command" description:"the command to execute"` +} + +// PodProxyOptions is the query options to a Pod's proxy call +type PodProxyOptions struct { + TypeMeta `json:",inline"` + + // Path is the URL path to use for the current proxy request + Path string `json:"path,omitempty" description:"URL path to use in proxy request to pod"` +} + // Status is a return value for calls that don't return other objects. // TODO: this could go in apiserver, but I'm including it here so clients needn't // import both. diff --git a/pkg/api/v1beta2/register.go b/pkg/api/v1beta2/register.go index ccd8f06477..3cc2bc7d54 100644 --- a/pkg/api/v1beta2/register.go +++ b/pkg/api/v1beta2/register.go @@ -66,6 +66,8 @@ func init() { &DeleteOptions{}, &ListOptions{}, &PodLogOptions{}, + &PodExecOptions{}, + &PodProxyOptions{}, ) // Future names are supported api.Scheme.AddKnownTypeWithName("v1beta2", "Node", &Minion{}) @@ -106,3 +108,5 @@ func (*PersistentVolumeClaimList) IsAnAPIObject() {} func (*DeleteOptions) IsAnAPIObject() {} func (*ListOptions) IsAnAPIObject() {} func (*PodLogOptions) IsAnAPIObject() {} +func (*PodExecOptions) IsAnAPIObject() {} +func (*PodProxyOptions) IsAnAPIObject() {} diff --git a/pkg/api/v1beta2/types.go b/pkg/api/v1beta2/types.go index a76ea787be..52e1fc720c 100644 --- a/pkg/api/v1beta2/types.go +++ b/pkg/api/v1beta2/types.go @@ -1186,6 +1186,37 @@ type PodLogOptions struct { Follow bool `json:"follow,omitempty" description:"follow the log stream of the pod; defaults to false"` } +// PodExecOptions is the query options to a Pod's remote exec call +type PodExecOptions struct { + TypeMeta `json:",inline"` + + // Stdin if true indicates that stdin is to be redirected for the exec 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 exec 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 exec 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 exec call + TTY bool `json:"tty,omitempty" description:"allocate a terminal for this exec call; defaults to false"` + + // Container in which to execute the command. + 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."` + + // Command is the remote command to execute + Command string `json:"command" description:"the command to execute"` +} + +// PodProxyOptions is the query options to a Pod's proxy call +type PodProxyOptions struct { + TypeMeta `json:",inline"` + + // Path is the URL path to use for the current proxy request + Path string `json:"path,omitempty" description:"URL path to use in proxy request to pod"` +} + // Status is a return value for calls that don't return other objects. // TODO: this could go in apiserver, but I'm including it here so clients needn't // import both. diff --git a/pkg/api/v1beta3/register.go b/pkg/api/v1beta3/register.go index dd35b5de23..538ea5a9ac 100644 --- a/pkg/api/v1beta3/register.go +++ b/pkg/api/v1beta3/register.go @@ -59,6 +59,8 @@ func init() { &DeleteOptions{}, &ListOptions{}, &PodLogOptions{}, + &PodExecOptions{}, + &PodProxyOptions{}, ) // Legacy names are supported api.Scheme.AddKnownTypeWithName("v1beta3", "Minion", &Node{}) @@ -98,3 +100,5 @@ func (*PersistentVolumeClaimList) IsAnAPIObject() {} func (*DeleteOptions) IsAnAPIObject() {} func (*ListOptions) IsAnAPIObject() {} func (*PodLogOptions) IsAnAPIObject() {} +func (*PodExecOptions) IsAnAPIObject() {} +func (*PodProxyOptions) IsAnAPIObject() {} diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index 1c02a1ae59..a70316c06d 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -1291,6 +1291,37 @@ type PodLogOptions struct { Follow bool `json:"follow,omitempty" description:"follow the log stream of the pod; defaults to false"` } +// PodExecOptions is the query options to a Pod's remote exec call +type PodExecOptions struct { + TypeMeta `json:",inline"` + + // Stdin if true indicates that stdin is to be redirected for the exec 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 exec 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 exec 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 exec call + TTY bool `json:"tty,omitempty" description:"allocate a terminal for this exec call; defaults to false"` + + // Container in which to execute the command. + 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."` + + // Command is the remote command to execute + Command string `json:"command" description:"the command to execute"` +} + +// PodProxyOptions is the query options to a Pod's proxy call +type PodProxyOptions struct { + TypeMeta `json:",inline"` + + // Path is the URL path to use for the current proxy request + Path string `json:"path,omitempty" description:"URL path to use in proxy request to pod"` +} + // Status is a return value for calls that don't return other objects. type Status struct { TypeMeta `json:",inline"` diff --git a/pkg/registry/pod/etcd/etcd.go b/pkg/registry/pod/etcd/etcd.go index 90ba972851..1647b5212c 100644 --- a/pkg/registry/pod/etcd/etcd.go +++ b/pkg/registry/pod/etcd/etcd.go @@ -204,7 +204,8 @@ var _ = rest.GetterWithOptions(&LogREST{}) // New creates a new Pod log options object func (r *LogREST) New() runtime.Object { - return &api.PodLogOptions{} + // TODO - return a resource that represents a log + return &api.Pod{} } // Get retrieves a runtime.Object that will stream the contents of the pod log