Registry Mirror
Skip to content

Conversation

@itnazeer

@itnazeer itnazeer commented Nov 6, 2026

Copy link
Copy Markdown

Part of #16750

Proposed Changes

  • Add the feature flag kubernetes.containerspec-restartpolicy, disabled by default.
  • With the flag enabled, the serving container may set restartPolicy and restartPolicyRules (Kubernetes ContainerRestartRules, KEP-5307, beta and on by default since 1.35). Knative copies them unchanged to the Deployment, and Kubernetes validates them.
  • Both fields stay disallowed on init containers, where restartPolicy: Always would make a native sidecar, and on non-serving containers.
  • ContainerMask now takes a context, like PodSpecMask and VolumeMountMask.
  • Removing a pod whose serving container stopped and won't be restarted is left to a follow-up PR (see Allow the serving container to set restartPolicy and restartPolicyRules (KEP-5307), behind a feature flag #16750). Until then, such a pod stays Running and not ready.

Release Note

The serving container can now set `restartPolicy` and `restartPolicyRules` when the feature flag `kubernetes.containerspec-restartpolicy` is enabled. This needs the Kubernetes ContainerRestartRules feature, beta and on by default since Kubernetes 1.35.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: itnazeer / name: itnazeer (fd967ee)

@knative-prow knative-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 6, 2026
@knative-prow
knative-prow Bot requested review from dprotaso and skonto November 6, 2026 14:35
@knative-prow

knative-prow Bot commented Nov 6, 2026

Copy link
Copy Markdown

Welcome @itnazeer! It looks like this is your first PR to knative/serving 🎉

@knative-prow knative-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 6, 2026
@knative-prow

knative-prow Bot commented Nov 6, 2026

Copy link
Copy Markdown

Hi @itnazeer. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@knative-prow

knative-prow Bot commented Nov 6, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: itnazeer
Once this PR has been reviewed and has the lgtm label, please assign arsenetar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2026
Add the feature flag kubernetes.containerspec-restartpolicy, disabled by
default. With it enabled, the serving container may set restartPolicy and
restartPolicyRules (Kubernetes ContainerRestartRules, KEP-5307), which are
copied unchanged to the Deployment and validated by Kubernetes.

Both fields stay disallowed on init containers, where restartPolicy Always
makes a native sidecar, and on non-serving containers.
@itnazeer
itnazeer force-pushed the containerspec-restartpolicy branch from fd967ee to 0f1669f Compare November 17, 2026 10:52
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2026
@itnazeer

Copy link
Copy Markdown
Author

Hi @dprotaso @skonto, gentle ping when you have time. I rebased on main yesterday.

This PR is the API part of #16750 (flag off by default). Before you review the code, it'd help to know if the overall approach in the issue works for you, mainly the follow-up that removes pods whose serving container stopped for good. With only this PR and the flag on, such a pod stays Running and not ready, and the Revision still shows Ready (I checked on kind with Knative built from this branch).

I'm happy to fold the follow-up into this PR, keep them separate, or discuss it at a Serving WG meeting, whichever you prefer. If it looks fine to test, could someone add /ok-to-test? Thanks!

@dprotaso

dprotaso commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

This needs discussion: #16750 (comment)

/hold

@knative-prow knative-prow Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants