Skip to content

Commit 685b65d

Browse files
Merge pull request #127360 from knight42/feat/split-stdout-stderr-server-side
API: add a new `Stream` field to `PodLogOptions` Kubernetes-commit: 9660e5c4cd41700eae41a316dd236090bd7bf6e9
2 parents 612908a + ce43056 commit 685b65d

File tree

8 files changed

+967
-885
lines changed

8 files changed

+967
-885
lines changed

core/v1/generated.pb.go

Lines changed: 928 additions & 881 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/v1/generated.proto

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/v1/types.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6643,6 +6643,15 @@ type Preconditions struct {
66436643
UID *types.UID `json:"uid,omitempty" protobuf:"bytes,1,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
66446644
}
66456645

6646+
const (
6647+
// LogStreamStdout is the stream type for stdout.
6648+
LogStreamStdout = "Stdout"
6649+
// LogStreamStderr is the stream type for stderr.
6650+
LogStreamStderr = "Stderr"
6651+
// LogStreamAll represents the combined stdout and stderr.
6652+
LogStreamAll = "All"
6653+
)
6654+
66466655
// +k8s:conversion-gen:explicit-from=net/url.Values
66476656
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
66486657
// +k8s:prerelease-lifecycle-gen:introduced=1.0
@@ -6677,7 +6686,8 @@ type PodLogOptions struct {
66776686
// +optional
66786687
Timestamps bool `json:"timestamps,omitempty" protobuf:"varint,6,opt,name=timestamps"`
66796688
// If set, the number of lines from the end of the logs to show. If not specified,
6680-
// logs are shown from the creation of the container or sinceSeconds or sinceTime
6689+
// logs are shown from the creation of the container or sinceSeconds or sinceTime.
6690+
// Note that when "TailLines" is specified, "Stream" can only be set to nil or "All".
66816691
// +optional
66826692
TailLines *int64 `json:"tailLines,omitempty" protobuf:"varint,7,opt,name=tailLines"`
66836693
// If set, the number of bytes to read from the server before terminating the
@@ -6694,6 +6704,14 @@ type PodLogOptions struct {
66946704
// the actual log data coming from the real kubelet).
66956705
// +optional
66966706
InsecureSkipTLSVerifyBackend bool `json:"insecureSkipTLSVerifyBackend,omitempty" protobuf:"varint,9,opt,name=insecureSkipTLSVerifyBackend"`
6707+
6708+
// Specify which container log stream to return to the client.
6709+
// Acceptable values are "All", "Stdout" and "Stderr". If not specified, "All" is used, and both stdout and stderr
6710+
// are returned interleaved.
6711+
// Note that when "TailLines" is specified, "Stream" can only be set to nil or "All".
6712+
// +featureGate=PodLogsQuerySplitStreams
6713+
// +optional
6714+
Stream *string `json:"stream,omitempty" protobuf:"varint,10,opt,name=stream"`
66976715
}
66986716

66996717
// +k8s:conversion-gen:explicit-from=net/url.Values

core/v1/types_swagger_doc_generated.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,9 +1683,10 @@ var map_PodLogOptions = map[string]string{
16831683
"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.",
16841684
"sinceTime": "An RFC3339 timestamp 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.",
16851685
"timestamps": "If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false.",
1686-
"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",
1686+
"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. Note that when \"TailLines\" is specified, \"Stream\" can only be set to nil or \"All\".",
16871687
"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.",
16881688
"insecureSkipTLSVerifyBackend": "insecureSkipTLSVerifyBackend indicates that the apiserver should not confirm the validity of the serving certificate of the backend it is connecting to. This will make the HTTPS connection between the apiserver and the backend insecure. This means the apiserver cannot verify the log data it is receiving came from the real kubelet. If the kubelet is configured to verify the apiserver's TLS credentials, it does not mean the connection to the real kubelet is vulnerable to a man in the middle attack (e.g. an attacker could not intercept the actual log data coming from the real kubelet).",
1689+
"stream": "Specify which container log stream to return to the client. Acceptable values are \"All\", \"Stdout\" and \"Stderr\". If not specified, \"All\" is used, and both stdout and stderr are returned interleaved. Note that when \"TailLines\" is specified, \"Stream\" can only be set to nil or \"All\".",
16891690
}
16901691

16911692
func (PodLogOptions) SwaggerDoc() map[string]string {

core/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testdata/HEAD/core.v1.PodLogOptions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"timestamps": true,
1010
"tailLines": 7,
1111
"limitBytes": 8,
12-
"insecureSkipTLSVerifyBackend": true
12+
"insecureSkipTLSVerifyBackend": true,
13+
"stream": "streamValue"
1314
}
13 Bytes
Binary file not shown.

testdata/HEAD/core.v1.PodLogOptions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ limitBytes: 8
77
previous: true
88
sinceSeconds: 4
99
sinceTime: "2005-01-01T01:01:01Z"
10+
stream: streamValue
1011
tailLines: 7
1112
timestamps: true

0 commit comments

Comments
 (0)