TestResourceClient.replace currently has a check in place to increment the .metadata.resourceVersion version field but the .metadata.generation field is not incremented when there are changes to the .spec section of a CR. This leads to bad behavior while testing as certain patterns will compare generation and observedGeneration to determine if action should be taken.
According to discussions from the k8s dev team, generation:
should be incremented for all changes made to the .spec field of a CR.
should not be incremented if there are changes only to .metadata or .status
Looking at TestResourceClient.replace, .metadata.resourceVersion is being incremented and an additional check and increment should probably be added to .metadata.generation as well.
TestResourceClient.replace currently has a check in place to increment the
.metadata.resourceVersion
version field but the.metadata.generation
field is not incremented when there are changes to the.spec
section of a CR. This leads to bad behavior while testing as certain patterns will comparegeneration
andobservedGeneration
to determine if action should be taken.According to discussions from the k8s dev team, generation:
.spec
field of a CR..metadata
or.status
Looking at TestResourceClient.replace,
.metadata.resourceVersion
is being incremented and an additional check and increment should probably be added to.metadata.generation
as well.