How can i ignore CRD modify event on status update of custom resource objects

1/17/2020

After processing of a CRD instance i am trying to patch the status of the CRD via my custom ingress controller in python.

After patch of the status, i am receiving a modify event from kube-api server on the crd instance since resourceversion is getting incremented after the status is updated.

Example of the event:

{'type': 'MODIFIED', 'object': {'apiVersion': '…', 'kind': '…', 'metadata': {'creationTimestamp': '…', 'generation': 1, 'name': 'thro', 'namespace': 'default', 'resourceVersion': '9927551', 'selfLink': '…', 'uid': '…'}, 'spec': {'…}, 'status': {'state': 'Success', 'status_message': 'CRD Activated'}}}

My requirement is to ignore this modify event as there is no change in spec. But only way to do this will be by keeping track of the previous generation value of the CRD instance object and compare if there is an update in the generation. Which i wanted to avoid.

-- user12731773
kubectl
kubernetes
kubernetes-custom-resources
kubernetes-ingress

0 Answers