Add PodExecOptions and PodProxyOptions versioned resources

PodExecOptions represents the URL parameters used to invoke an
exec request on a pod. PodProxyOptions contains the path parameter
passed to a proxy request.
pull/6/head
Cesar Wong 2015-04-14 11:03:17 -04:00
parent 49abf9133e
commit 4da14e9357
12 changed files with 155 additions and 3 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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() {}

View File

@ -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)

View File

@ -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.

View File

@ -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() {}

View File

@ -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.

View File

@ -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() {}

View File

@ -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.

View File

@ -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() {}

View File

@ -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"`

View File

@ -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