Support extended pod logging options
Increase the supported controls on pod logging. Add validaiton to pod log options. Ensure the Kubelet is using a consistent, structured way to process pod log arguments. Add ?sinceSeconds=<durationInSeconds>, &sinceTime=<RFC3339>, ?timestamps=<bool>, ?tailLines=<number>, and ?limitBytes=<number>
This commit is contained in:
@@ -1648,6 +1648,32 @@ func convert_api_PodLogOptions_To_v1_PodLogOptions(in *api.PodLogOptions, out *P
|
||||
out.Container = in.Container
|
||||
out.Follow = in.Follow
|
||||
out.Previous = in.Previous
|
||||
if in.SinceSeconds != nil {
|
||||
out.SinceSeconds = new(int64)
|
||||
*out.SinceSeconds = *in.SinceSeconds
|
||||
} else {
|
||||
out.SinceSeconds = nil
|
||||
}
|
||||
if in.SinceTime != nil {
|
||||
if err := s.Convert(&in.SinceTime, &out.SinceTime, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.SinceTime = nil
|
||||
}
|
||||
out.Timestamps = in.Timestamps
|
||||
if in.TailLines != nil {
|
||||
out.TailLines = new(int64)
|
||||
*out.TailLines = *in.TailLines
|
||||
} else {
|
||||
out.TailLines = nil
|
||||
}
|
||||
if in.LimitBytes != nil {
|
||||
out.LimitBytes = new(int64)
|
||||
*out.LimitBytes = *in.LimitBytes
|
||||
} else {
|
||||
out.LimitBytes = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4057,6 +4083,32 @@ func convert_v1_PodLogOptions_To_api_PodLogOptions(in *PodLogOptions, out *api.P
|
||||
out.Container = in.Container
|
||||
out.Follow = in.Follow
|
||||
out.Previous = in.Previous
|
||||
if in.SinceSeconds != nil {
|
||||
out.SinceSeconds = new(int64)
|
||||
*out.SinceSeconds = *in.SinceSeconds
|
||||
} else {
|
||||
out.SinceSeconds = nil
|
||||
}
|
||||
if in.SinceTime != nil {
|
||||
if err := s.Convert(&in.SinceTime, &out.SinceTime, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.SinceTime = nil
|
||||
}
|
||||
out.Timestamps = in.Timestamps
|
||||
if in.TailLines != nil {
|
||||
out.TailLines = new(int64)
|
||||
*out.TailLines = *in.TailLines
|
||||
} else {
|
||||
out.TailLines = nil
|
||||
}
|
||||
if in.LimitBytes != nil {
|
||||
out.LimitBytes = new(int64)
|
||||
*out.LimitBytes = *in.LimitBytes
|
||||
} else {
|
||||
out.LimitBytes = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -1450,6 +1450,33 @@ func deepCopy_v1_PodLogOptions(in PodLogOptions, out *PodLogOptions, c *conversi
|
||||
out.Container = in.Container
|
||||
out.Follow = in.Follow
|
||||
out.Previous = in.Previous
|
||||
if in.SinceSeconds != nil {
|
||||
out.SinceSeconds = new(int64)
|
||||
*out.SinceSeconds = *in.SinceSeconds
|
||||
} else {
|
||||
out.SinceSeconds = nil
|
||||
}
|
||||
if in.SinceTime != nil {
|
||||
out.SinceTime = new(unversioned.Time)
|
||||
if err := deepCopy_unversioned_Time(*in.SinceTime, out.SinceTime, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.SinceTime = nil
|
||||
}
|
||||
out.Timestamps = in.Timestamps
|
||||
if in.TailLines != nil {
|
||||
out.TailLines = new(int64)
|
||||
*out.TailLines = *in.TailLines
|
||||
} else {
|
||||
out.TailLines = nil
|
||||
}
|
||||
if in.LimitBytes != nil {
|
||||
out.LimitBytes = new(int64)
|
||||
*out.LimitBytes = *in.LimitBytes
|
||||
} else {
|
||||
out.LimitBytes = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -1979,14 +1979,30 @@ type PodLogOptions struct {
|
||||
|
||||
// The container for which to stream logs. Defaults to only container if there is one container in the pod.
|
||||
Container string `json:"container,omitempty"`
|
||||
|
||||
// Follow the log stream of the pod.
|
||||
// Defaults to false.
|
||||
// Follow the log stream of the pod. Defaults to false.
|
||||
Follow bool `json:"follow,omitempty"`
|
||||
|
||||
// Return previous terminated container logs.
|
||||
// Defaults to false.
|
||||
// Return previous terminated container logs. Defaults to false.
|
||||
Previous bool `json:"previous,omitempty"`
|
||||
// A relative time in seconds before the current time from which to show logs. If this value
|
||||
// precedes the time a pod was started, only logs since the pod start will be returned.
|
||||
// If this value is in the future, no logs will be returned.
|
||||
// Only one of sinceSeconds or sinceTime may be specified.
|
||||
SinceSeconds *int64 `json:"sinceSeconds,omitempty"`
|
||||
// An RFC3339 timestamp from which to show logs. If this value
|
||||
// preceeds the time a pod was started, only logs since the pod start will be returned.
|
||||
// If this value is in the future, no logs will be returned.
|
||||
// Only one of sinceSeconds or sinceTime may be specified.
|
||||
SinceTime *unversioned.Time `json:"sinceTime,omitempty"`
|
||||
// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line
|
||||
// of log output. Defaults to false.
|
||||
Timestamps bool `json:"timestamps,omitempty"`
|
||||
// If set, the number of lines from the end of the logs to show. If not specified,
|
||||
// logs are shown from the creation of the container or sinceSeconds or sinceTime
|
||||
TailLines *int64 `json:"tailLines,omitempty"`
|
||||
// If set, the number of bytes to read from the server before terminating the
|
||||
// log output. This may not display a complete final line of logging, and may return
|
||||
// slightly more or slightly less than the specified limit.
|
||||
LimitBytes *int64 `json:"limitBytes,omitempty"`
|
||||
}
|
||||
|
||||
// PodAttachOptions is the query options to a Pod's remote attach call.
|
||||
|
@@ -949,10 +949,15 @@ func (PodList) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_PodLogOptions = map[string]string{
|
||||
"": "PodLogOptions is the query options for a Pod's logs REST call.",
|
||||
"container": "The container for which to stream logs. Defaults to only container if there is one container in the pod.",
|
||||
"follow": "Follow the log stream of the pod. Defaults to false.",
|
||||
"previous": "Return previous terminated container logs. Defaults to false.",
|
||||
"": "PodLogOptions is the query options for a Pod's logs REST call.",
|
||||
"container": "The container for which to stream logs. Defaults to only container if there is one container in the pod.",
|
||||
"follow": "Follow the log stream of the pod. Defaults to false.",
|
||||
"previous": "Return previous terminated container logs. Defaults to false.",
|
||||
"sinceSeconds": "A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.",
|
||||
"sinceTime": "An RFC3339 timestamp from which to show logs. If this value preceeds the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.",
|
||||
"timestamps": "If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false.",
|
||||
"tailLines": "If set, the number of lines from the end of the logs to show. If not specified, logs are shown from the creation of the container or sinceSeconds or sinceTime",
|
||||
"limitBytes": "If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit.",
|
||||
}
|
||||
|
||||
func (PodLogOptions) SwaggerDoc() map[string]string {
|
||||
|
Reference in New Issue
Block a user