Skip to content

API: add a new Stream field to PodLogOptions#127360

Merged
k8s-ci-robot merged 10 commits into
kubernetes:masterfrom
knight42:feat/split-stdout-stderr-server-side
Nov 7, 2024
Merged

API: add a new Stream field to PodLogOptions#127360
k8s-ci-robot merged 10 commits into
kubernetes:masterfrom
knight42:feat/split-stdout-stderr-server-side

Conversation

@knight42

@knight42 knight42 commented Sep 14, 2024

Copy link
Copy Markdown
Member

What type of PR is this?

/kind api-change
/kind feature

What this PR does / why we need it:

Supersede #110794

This PR adds the feature gate and API for kubernetes/enhancements#3288 as well as validation rules to prevent inconsistent values. Only the changes about API, kube-apiserver and kubelet is included in this PR.

I plan to update the kubectl after this PR is merged in case the volume of this PR is too large.

Special notes for your reviewer:

We have decided not to support the combination of a specific Stream and TailLines. Please refer to kubernetes/enhancements#4879 for rationale.

Does this PR introduce a user-facing change?

Add a `Stream` field to `PodLogOptions`, which allows clients to request certain log stream(stdout or stderr) of the container.
Please also note that the combination of a specific `Stream` and `TailLines` is not supported.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/3288-separate-stdout-from-stderr

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 14, 2024
@k8s-ci-robot k8s-ci-robot added area/apiserver area/code-generation area/kubelet sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 14, 2024
@knight42
knight42 force-pushed the feat/split-stdout-stderr-server-side branch from c1b5916 to dd48818 Compare September 16, 2024 08:41
@knight42

Copy link
Copy Markdown
Member Author

/test all

@k8s-ci-robot k8s-ci-robot added sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/release Categorizes an issue or PR as relevant to SIG Release. labels Sep 16, 2024
Comment thread staging/src/k8s.io/component-base/version/base.go
@knight42 knight42 changed the title [WIP] API: Allow Stream to be set in PodLogOptions API: Allow Stream to be set in PodLogOptions Sep 16, 2024
@knight42
knight42 marked this pull request as ready for review September 16, 2024 15:07
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2024
Signed-off-by: Jian Zeng <[email protected]>
The `k8s.io/utils/ptr` should be allowed for import within ./pkg/apis/core

Signed-off-by: Jian Zeng <[email protected]>
@knight42

knight42 commented Nov 7, 2024

Copy link
Copy Markdown
Member Author

/test pull-kubernetes-e2e-gce-cos-alpha-features

@SergeyKanzhelev @thockin I've updated the release note to reflect that a specific Stream and TailLines are mutually exclusive. Please feel free to make any additional updates if needed.

@thockin

thockin commented Nov 7, 2024

Copy link
Copy Markdown
Member

There's no CLI interface for this yet, right?

@knight42

knight42 commented Nov 7, 2024

Copy link
Copy Markdown
Member Author

There's no CLI interface for this yet, right?

Not yet, the kubectl side changes #128159 depends on this PR.

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

@knight42: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-e2e-gce-cos-alpha-features a137b08 link false /test pull-kubernetes-e2e-gce-cos-alpha-features

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@SergeyKanzhelev SergeyKanzhelev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 663b4ced2a837955877de6722163df121ff455ec

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: knight42, SergeyKanzhelev, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@SergeyKanzhelev

Copy link
Copy Markdown
Member

/unhold
/retest-required

@knight42

knight42 commented Nov 8, 2024

Copy link
Copy Markdown
Member Author

Finally... my first KEP implementation PR gets merged! 🎉 Thank you all for your patience and professional advice!

@thockin

thockin commented Nov 8, 2024

Copy link
Copy Markdown
Member

Congratulations. This was a hard one because URL params are not as well documented or exercised as other paths.

@kannon92

kannon92 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

Nice job @knight42!

I see that we had a kubectl PR up for this but that seems to not be ready. Is this a blocker for this feature?

I guess one can use crictl or other ways to test this feature but we may want to target the kubectl feature for 1.33?

@knight42

knight42 commented Nov 8, 2024

Copy link
Copy Markdown
Member Author

I see that we had a kubectl PR up for this but that seems to not be ready. Is this a blocker for this feature?

I am working on it. This might be a blocker, as users cannot request a specific stream seamlessly without a updated kubectl. While they can use kubectl get --raw as e2e tests do, I think that would be a bit inconvinient.

I guess one can use crictl or other ways to test this feature

Actually, crictl needs to be updated as well to set the newly introduced stream parameter.

but we may want to target the kubectl feature for 1.33?

I am okay with that.

@kannon92

kannon92 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

If you want to aim for 1.32, you will need to request an extension for that PR.

Since this is alpha, I don't think we need everything but we should maybe consider that a blocker for beta. @thockin WDYT?

@thockin

thockin commented Nov 8, 2024 via email

Copy link
Copy Markdown
Member

@kannon92

kannon92 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

True but we also don't get meaningful feedback for an alpha feature..

@kannon92

kannon92 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

So our option right now is:

  • We leave this PR in for 1.32.
  • When crictl takes 1.32 APIS, we can implement a feature for crictl with this feature.
  • Once 1.33 opens up, we can get the kubectl PR in.
  • Verify the feature works.

Or we aim to get kubectl in and if not, we revert this feature since there is not really a possible way to test this at the moment?

Given that it is alpha, I think our plan is fine but it does mean that @knight42 has a bit more work in 1.33 to get this ready for beta.

@kannon92

kannon92 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

Why I am pressing this: kubernetes/enhancements#3288 (comment).

I'm trying to understand what we should do with this feature for 1.32.

@SergeyKanzhelev

Copy link
Copy Markdown
Member

Why I am pressing this: kubernetes/enhancements#3288 (comment).

I'm trying to understand what we should do with this feature for 1.32.

I wonder if anybody who can review CLI is around to tell how close it is. It looks complete for me - enough to ask for an exception.

@knight42

knight42 commented Nov 8, 2024

Copy link
Copy Markdown
Member Author

When crictl takes 1.32 APIS, we can implement a feature for crictl with this feature.

I can update crictl once 1.32 is released.

@thockin

thockin commented Nov 8, 2024

Copy link
Copy Markdown
Member

I'm not arguing to revert this, but I am arguing to try to get the CLI part of this in (and in future to not merge half of a feature)

@kannon92

kannon92 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

@liggitt

liggitt commented Nov 8, 2024

Copy link
Copy Markdown
Member

Well it looks like there is something up with this feature anyway.

https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/128680/pull-e2e-gci-gce-alpha-enabled-default/1854616736976867328

We may have to revert anyway.

it looks like this validation code is requiring the new Stream option be populated if the feature is enabled:

	if allowStreamSelection {
		if opts.Stream == nil {
			allErrs = append(allErrs, field.Required(field.NewPath("stream"), "must be specified"))
		} else {

isn't that breaking? elsewhere, we write:

	// opts.Stream can be nil because defaulting might not apply if no URL params are provided.
	if opts.Stream != nil {

if !utilfeature.DefaultFeatureGate.Enabled(features.PodLogsQuerySplitStreams) {
logOpts.Stream = nil
}
if errs := validation.ValidatePodLogOptions(logOpts, utilfeature.DefaultFeatureGate.Enabled(features.PodLogsQuerySplitStreams)); len(errs) > 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to break the tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not just the tests, I think it breaks existing pod log API clients when the feature is enabled

@kannon92

kannon92 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

I opened up #128712.

We can also revert this if that is the preferred method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/code-generation area/kubelet area/release-eng Issues or PRs related to the Release Engineering subproject area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/release Categorizes an issue or PR as relevant to SIG Release. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

Status: API review completed, 1.32
Archived in project
Archived in project

Development

Successfully merging this pull request may close these issues.