rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.52k stars 230 forks source link

diff section of fleet.yaml ignored in 0.3.10 #927

Open xhejtman opened 2 years ago

xhejtman commented 2 years ago

Is there an existing issue for this?

Current Behavior

It seems, that in 0.3.10 version, diff section in fleet.yaml is ignored. I have:

diff:
  comparePatches:
    - apiVersion: v1
      kind: ConfigMap
      name: app-config
      operations:
      - {"op":"remove", "path":"/data"}

but getting object modified: Modified(1) [Bundle wes-auth-wes-wes-auth]; configmap.v1 wes-prod-ns/app-config modified {"data":{"app_config.yaml":"# Empty, this configMap will be filled by Job (configmap-job-cwlwes)"}}

It worked in 0.3.9.

Expected Behavior

Do not report modified.

Steps To Reproduce

No response

Environment

- Architecture: amd64
- Fleet Version:0.3.10
- Cluster:
  - Provider: RKE2
  - Options: 18 nodes.
  - Kubernetes Version: 1.21.11

Logs

No response

Anything else?

No response

xhejtman commented 2 years ago

This could be caused by: https://github.com/rancher/fleet/commit/84b7d8aa6964eeca44170db1ac0d320e9b7705d1

xhejtman commented 2 years ago

@manno could you take a look?

manno commented 2 years ago

Ah, yes. We had to vendor those packages, because fleet's go.mod file forces a specific version for k8s libraries and we couldn't bump those with the argo sdk dependency.

We should come up with a test for bundle diffing.

manno commented 2 years ago

I always get a modified bundle when I use a setup like this https://github.com/manno/fleet-experiments/tree/diff-experiment1 and edit the service manually. Tested with a fleet-agent 0.3.9, too.

However, the config map (https://github.com/manno/fleet-experiments/tree/diff-experiment2) experiment works every time, no modified state after editing the data.

manno commented 2 years ago

The tests worked, if there is an issue it's more specific.

xhejtman commented 2 years ago

So it seems to be ok for you as is?

xhejtman commented 2 years ago

fleet-master-fleet-test.zip this is example of non-working diff. If I modify content of app-config.yaml in the config map, bundle gets modified.

manno commented 2 years ago

Interesting, the test adds a key to the map, your example changes an existing entry. I can do the same to services, adding another port counts as nonModified, changing the port from the original manifest counts as a modification.

xhejtman commented 2 years ago

For me, this worked in 0.9.3 version, I could modify the entry.

manno commented 2 years ago

I tried with 0.3.9 and I see the same behavior: configmap.v1 test-ns/app-config modified when changing the value of .data.app_config.yaml.

xhejtman commented 2 years ago

Is here anything we can do?

xhejtman commented 1 year ago

@manno, anything we can do here?