cnat icon indicating copy to clipboard operation
cnat copied to clipboard

Running on GKE, need to use Upadate() instead of UpdateStatus() in cnat-client-go/controller.go.

Open enakai00 opened this issue 6 years ago • 0 comments

Hi, in my set-up (Google Kubernetes Engine), as the CustomResourceSubresources feature gate is not enabled, I get the following error while running the cnat-client-go/controller.go:

E1012 22:10:45.503547 52194 controller.go:193] error syncing 'default/example-at': the server could not find the requested resource (put ats.cnat.programming-kubernetes.info example-at), requeuing

This could be resolved by replacing UpdateStatus(instance) with Update(instance) on L295

_, err = c.cnatClientset.CnatV1alpha1().Ats(instance.Namespace).UpdateStatus(instance)

as described in the sample-controller:

	// If the CustomResourceSubresources feature gate is not enabled,
	// we must use Update instead of UpdateStatus to update the Status block of the Foo resource.
	// UpdateStatus will not allow changes to the Spec of the resource,
	// which is ideal for ensuring nothing other than resource status has been updated.
	_, err := c.sampleclientset.SamplecontrollerV1alpha1().Foos(foo.Namespace).Update(fooCopy)

Does it make sense to add some logic to cnat-client-go/controller.go so that it can handle both set-ups (the CustomResourceSubresources feature gate is enabled / disabled)?

enakai00 avatar Oct 13 '19 02:10 enakai00