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

[feature request] pod-readiness-controller modify Pod use Patch instead of Update #1557

Open
Spground opened this issue Apr 1, 2024 · 2 comments
Assignees

Comments

@Spground
Copy link
Contributor

Spground commented Apr 1, 2024

What would you like to be added:

Why is this needed:

@zmberg
Copy link
Member

zmberg commented Apr 2, 2024

Anyone interested in submitting this patch?

related code: https://github.com/openkruise/kruise/blob/master/pkg/controller/podreadiness/pod_readiness_controller.go#L132

Methods are as follows:

		// patch pod condition
		status := v1.PodStatus{
			Conditions: []v1.PodCondition{
				{
					Type:               appspub.KruisePodReadyConditionType,
					Status:             v1.ConditionTrue,
					LastTransitionTime: metav1.Now(),
				},
			},
		}
		by, _ := json.Marshal(status)
		patchBody := fmt.Sprintf(`{"status":%s}`, string(by))
		rcvObject := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: pod.Namespace, Name: pod.Name}}
		err := r.Status().Patch(context.TODO(), rcvObject, client.RawPatch(types.StrategicMergePatchType, []byte(patchBody)))

@zmberg zmberg removed the kind/good-idea Good Idea label Apr 2, 2024
@BruceAko
Copy link
Contributor

BruceAko commented Apr 2, 2024

/assign
I am willing to submit the patch.

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

No branches or pull requests

4 participants