Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: add a new Stream field to PodLogOptions #127360

Merged

Conversation

knight42
Copy link
Member

@knight42 knight42 commented Sep 14, 2024

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
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
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
@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
@k8s-ci-robot
Copy link
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.

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.

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

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 k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 7, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 663b4ced2a837955877de6722163df121ff455ec

@k8s-ci-robot
Copy link
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

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
Member

/unhold
/retest-required

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 7, 2024
@k8s-ci-robot k8s-ci-robot merged commit 9660e5c into kubernetes:master Nov 7, 2024
16 of 17 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.32 milestone Nov 7, 2024
@knight42 knight42 deleted the feat/split-stdout-stderr-server-side branch November 8, 2024 02:35
@knight42
Copy link
Member Author

knight42 commented Nov 8, 2024

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

@thockin
Copy link
Member

thockin commented Nov 8, 2024

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

@kannon92
Copy link
Contributor

kannon92 commented Nov 8, 2024

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
Copy link
Member Author

knight42 commented Nov 8, 2024

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
Copy link
Contributor

kannon92 commented Nov 8, 2024

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
Copy link
Member

thockin commented Nov 8, 2024 via email

@kannon92
Copy link
Contributor

kannon92 commented Nov 8, 2024

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

@kannon92
Copy link
Contributor

kannon92 commented Nov 8, 2024

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
Copy link
Contributor

kannon92 commented Nov 8, 2024

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
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
Copy link
Member Author

knight42 commented Nov 8, 2024

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
Copy link
Member

thockin commented Nov 8, 2024

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
Copy link
Contributor

kannon92 commented Nov 8, 2024

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.

@liggitt
Copy link
Member

liggitt commented Nov 8, 2024

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
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
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
Copy link
Contributor

kannon92 commented Nov 8, 2024

I opened up #128712.

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

bertinatto added a commit to bertinatto/kubernetes that referenced this pull request Dec 3, 2024
…-stdout-stderr-server-side"

This reverts commit 9660e5c, reversing
changes made to 9c571ab.
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: Assigned
Archived in project
Development

Successfully merging this pull request may close these issues.