client-go: PatchType is not supported for ApplyPatchType in fake

Hi, When I write a tests:

fakeReadyDeployment := fake.NewSimpleClientset(&appV1.Deployment{
TypeMeta: metav1.TypeMeta{
	Kind:       "Deployment",
	APIVersion: "apps/v1",
},
ObjectMeta: metav1.ObjectMeta{
	Name:            deploymentName,
	Namespace:       "default",
},
}).AppsV1().Deployments("default")

After try to apply:

	_, err := fakeReadyDeployment.Apply(context.TODO(), deployment, metav1.ApplyOptions{
		FieldManager: appUID,
	})

I get: PatchType is not supported

Because we have 4 of const: k8s.io/apimachinery@v0.21.0/pkg/types/patch.go:25

const (
	JSONPatchType           PatchType = "application/json-patch+json"
	MergePatchType          PatchType = "application/merge-patch+json"
	StrategicMergePatchType PatchType = "application/strategic-merge-patch+json"
	ApplyPatchType          PatchType = "application/apply-patch+yaml"
)

But in switch only 3 case: https://github.com/kubernetes/client-go/blob/master/testing/fixture.go#L150

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 21
  • Comments: 26 (6 by maintainers)

Most upvoted comments

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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/test-infra repository.