You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The replicator uses the annotation replicated-from-version to figure out if it has to do anything. It skips replication if the value of this annotation is already the resource-version of the source resource.
If a pull-mode resource is applied again, its value is overwritten with an empty value, but the replicator will ignore it and not fill it again.
To Reproduce
Create a YAML file with a resource configured for pull-mode:
The replicator will fill the resource from the source resource and add the replicator.v1.mittwald.de/replicated-from-version annotation with a value containing the K8s resource-version of the source.
Now apply the resource again (kubectl apply -f). This step simulates a subsequent deployment (update). Maybe this resource is part of a helm Chart. It is not changed in the Chart, but applying it again does not have no effect! Instead, it has the effect of overwriting the contents of the secret with an empty value again (data: {}). That is because the applied resource is different from that resource in the K8s API server.
Since the annotation replicator.v1.mittwald.de/replicated-from-version is not part of the YAML file, it is not changed.
The replicator will received a CHANGED event for the resource. It will compare the value of the replicated-from-version annotation with the resource-version of the source secret and conclude that nothing needs to be done.
The target secret remains empty.
Expected behavior
The replicator feels responsible for always keeping the payload of the target and source resources in sync and uses an appropriate mechanism that can guarantee this.
Environment:
Kubernetes version: Not relevant
kubernetes-replicator version: v2.10.1
Additional context
I open the issue to discuss possible solutions. My proposal would be to deprecate the replicated-from-version annotation and instead always compare the payloads. I am aware this is slightly more costly in terms of CPU usage during startup of the replicator, when it receives ADDED events for all resources that it watches. However, I believe it is worth it. I would like to implement the agreed upon solution and open a PR.
The text was updated successfully, but these errors were encountered:
@martin-helmich: Would be great to get your general opinion on this one. If you prefer, we could also just create a PR that introduces a command line option for changing the behavior on an opt-in basis?
Describe the bug
The replicator uses the annotation
replicated-from-version
to figure out if it has to do anything. It skips replication if the value of this annotation is already the resource-version of the source resource.If a pull-mode resource is applied again, its value is overwritten with an empty value, but the replicator will ignore it and not fill it again.
To Reproduce
kubectl apply -f
this resource.replicator.v1.mittwald.de/replicated-from-version
annotation with a value containing the K8s resource-version of the source.kubectl apply -f
). This step simulates a subsequent deployment (update). Maybe this resource is part of a helm Chart. It is not changed in the Chart, but applying it again does not have no effect! Instead, it has the effect of overwriting the contents of the secret with an empty value again (data: {}
). That is because the applied resource is different from that resource in the K8s API server.replicator.v1.mittwald.de/replicated-from-version
is not part of the YAML file, it is not changed.CHANGED
event for the resource. It will compare the value of thereplicated-from-version
annotation with the resource-version of the source secret and conclude that nothing needs to be done.Expected behavior
The replicator feels responsible for always keeping the payload of the target and source resources in sync and uses an appropriate mechanism that can guarantee this.
Environment:
Additional context
I open the issue to discuss possible solutions. My proposal would be to deprecate the
replicated-from-version
annotation and instead always compare the payloads. I am aware this is slightly more costly in terms of CPU usage during startup of the replicator, when it receivesADDED
events for all resources that it watches. However, I believe it is worth it. I would like to implement the agreed upon solution and open a PR.The text was updated successfully, but these errors were encountered: