Open drasang opened 1 year ago
Updating annotations on a cluster through the Rancher UI would not be reflected in the corresponding Fleet cluster resource, although propagation of updates did work for labels.
Added annotations to fields taken into account when creating a Fleet cluster object.
See repro steps above
Tested reproduction steps before and after the change, noticing that in the latter case.
Added unit tests to Rancher covering cluster creation (which seems to be also run upon updating a cluster in the UI) and validating actual vs expected labels and annotations.
Verify that update and deletion of labels through the UI works as expected, propagating changes to the corresponding Fleet cluster resource.
N/A
I have created a video which covers the detailed steps which I performed. In order to check the label/annotations on propagation from Fleet cluster to Management cluster.
Also tried the API way and similar behavior observed
Apologies. I'd merged a fix into rancher/rancher
's main
, ie targetting Rancher v2.10.0 instead of v2.9.3 which was the original target milestone for this issue.
Please validate this against v2.10.0.
This issue and the PR linked there target Rancher v2.9.3.
Is there an existing issue for this?
Current Behavior
Currently it seems that only labels from the
v3/clusters
are synced to the correspondingfleet.cattle.io.clusters
object. Changes to the annotations are not synced.This also causes changes to annotations via editing the cluster resource in the Rancher UI under
/dashboard/c/local/fleet/fleet.cattle.io.cluster
to only be reflected inv3/cluster
.Since this behaviour differs from the known behaviour of the labels, this leads to mistakes like those seen in Issue #1516. Contrary to the assumption and changes made in the UI, no annotation has been configured on the fleet cluster object that could be referred to in the template.
Expected Behavior
As with labels, the user-defined annotations are synchronised from the
v3/clusters
object to the corresponding Fleet object.Steps To Reproduce
Create a cluster in Rancher
Edit the cluster in the UI under "Contionues Delivery" -> "Clusters" using "Edit Config".
Add labels and annotations and save the changes.
Using the browser's developer tools, it can be seen that two PUT requests have been made against
/v3/clusters/clusterid
andv1/fleet.cattle.io.clusters/fleet-default/clusterid
. The request against/v3/clusters
contains the newly configured annotations and labels. The request against Fleet does not contain these.Display the Fleet Cluster Object, either via the UI as YAML (Download/Edit YAML) or via kubectl:
kubectl get clusters.fleet.cattle.io -n fleet-default -oyaml <clusterid>
The object only has the new labels, the annotations have not been added. Since the previous request did not add the labels to the fleet object directly, but they are now present, indicates that they are being synchronised from
v3/clusters
.Environment
Logs
No response
Anything else?
Workaround: The cluster resource can be edited via "Edit Yaml". In this case, the PUT request is only sent to
v1/fleet.cattle.io.clusters/fleet-default/clusterid
and this time also contains the labels and annotations.