Skip to content

[SURE-11584] No drift was detected when the fields were initially undefined in fleet. #5075

@kkaempf

Description

@kkaempf

SURE-11584

Issue description:

When a project was created without initially defining some fields within the resourceQuota(say limit.requestsStorage) in the repo configured in the fleet(with drift enabled). In that case, Fleet doesnt owns that specific field and adding it later, fleet never detects the drift as it seems not owned by Fleet. Is it expected as per design? or possibly a bug?

Business impact:

In a GitOps approach, shouldn’t any changes to the manifest be considered drift from the original manifest?

Repro steps:

Simply create a project through fleet with following yaml in repo

apiVersion: management.cattle.io/v3
kind: Project
metadata:
  name: testproject
  namespace: local
spec:
  displayName: fleet-test-project
  clusterName: local
  namespaceDefaultResourceQuota:
    limit:
      limitsCpu: 1000m
      limitsMemory: 1024Mi
  resourceQuota:
    limit:
      limitsCpu: "2000m"
      limitsMemory: "2048Mi"

Make sure that drift is enabled (force is false) in the gitrepo

  correctDrift:
    enabled: true
    force: false
    keepFailHistory: true

Deploy it and those fields in the project are owned by Fleetagent initially

  "manager": "fleetagent",
  "operation": "Update",
      "f:resourceQuota": {
        ".": {},
        "f:limit": {
          ".": {},
          "f:limitsCpu": {},
          "f:limitsMemory": {}

So if we add a new supported field resourceQuota.limit.requestsStorage(which was missing earlier), fleet never detects the drift and the specific field will be owned by different controllers based on who modified it(eg: rancher, Go-http-client, kubectl-edit)

If update via Rancher UI

  "manager": "rancher",
  "operation": "Update",
      "f:resourceQuota": {
        "f:limit": {
          "f:requestsStorage": {}

Workaround:

Is a workaround available and implemented? yes
What is the workaround: Simply define all possible field in the project yaml

Actual behavior:

Drift is not detecting for the new field additions

Expected behavior:

Any changes to the manifest should be considered as a drift from the original manifest

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    Status

    📋 Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions