Skip to content

Wipe object system fields for create operation via the patch endpoint #133418

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carlory
Copy link
Member

@carlory carlory commented Aug 7, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

cm.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: "2025-08-05T16:42:06Z"
  deletionTimestamp: 2025-08-05T16:42:06Z
  name: test

without this fix:

(base) ➜  ~ kubectl apply --server-side -f cm.yaml
Warning: Detected changes to resource test which is currently being deleted.
configmap/test serverside-applied

(base) ➜  ~ kubectl get -f cm.yaml -oyaml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: "2025-08-07T06:27:49Z"
  deletionTimestamp: "2025-08-05T16:42:06Z"
  name: test
  namespace: default
  resourceVersion: "838078"
  uid: 2ec34003-6d61-41fb-8afe-1c958bf13d86

The deletionTimestamp is kept and gc controller can not reclaim it.

with this fix:

the patch operation has the same effect as kubectl create -f

(base) ➜  ~ kubectl get cm
NAME   DATA   AGE

(base) ➜  ~ kubectl apply --server-side -f cm.yaml
configmap/test serverside-applied

(base) ➜  ~ kubectl get -f cm.yaml -oyaml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: "2025-08-07T08:14:25Z"
  name: test
  namespace: default
  resourceVersion: "306"
  uid: 3bcb9296-1295-46f7-9c4c-6748a85de320

Which issue(s) this PR is related to:

Fixes #133388

Special notes for your reviewer:

Does this PR introduce a user-facing change?

kube-apiserver: fix a bug where the deletionTimestamp field was not wiped when a resource is created via the `patch` endpoint.

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


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Aug 7, 2025
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.34 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.34.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Thu Aug 7 03:00:08 UTC 2025.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 7, 2025
@k8s-ci-robot k8s-ci-robot requested a review from deads2k August 7, 2025 08:27
@k8s-ci-robot k8s-ci-robot requested a review from jpbetz August 7, 2025 08:27
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Aug 7, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added 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. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 7, 2025
@carlory carlory changed the title Wipe object system fields for create operation if allowed via the patch endpoint Wipe object system fields for create operation via the patch endpoint Aug 7, 2025
@carlory
Copy link
Member Author

carlory commented Aug 8, 2025

#133440 will fix the flaky test
/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. 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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An object created through SSA with a non-nil deletion timestamp will not get deleted
2 participants