Skip to content

Setting clusterLabels in bootstrap doesn't add the labels to the local clusters.fleet.cattle.io object #5352

Description

@mschroeder-fzj

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The local clusters.fleet.cattle.io object should have the labels as defined in the bootstrap options, but they are not added:

apiVersion: fleet.cattle.io/v1alpha1
kind: Cluster
metadata:
  labels:
    management.cattle.io/cluster-display-name: local
    management.cattle.io/cluster-name: local
    name: local
    objectset.rio.cattle.io/hash: ...
    provider.cattle.io: rke2

Expected Behavior

The local clusters.fleet.cattle.io object should have the labels as defined in the bootstrap options:

apiVersion: fleet.cattle.io/v1alpha1
kind: Cluster
metadata:
  labels:
    example.com/cluster-display-name: kube-test
    example.com/environment: test
    management.cattle.io/cluster-display-name: local
    management.cattle.io/cluster-name: local
    name: local
    objectset.rio.cattle.io/hash: ...
    provider.cattle.io: rke2

Steps To Reproduce

Deploy the Rancher Helm Chart with the following fleet values:

fleet:
  bootstrap:
    enabled: true
    clusterLabels:
      example.com/environment: test
      example.com/cluster-display-name: kube-test
  
    repo: https://git.example.com/fleet/bundles
    branch: main
# helm -n cattle-fleet-system get values fleet
agentTLSMode: system-store
apiServerCA: ""
apiServerURL: ""
bootstrap:
  agentNamespace: cattle-fleet-local-system
  branch: main
  clusterLabels:
    example.com/cluster-display-name: kube-test
    example.com/environment: test
  enabled: true
  repo: https://git.example.com/fleet/bundles
gitops:
  enabled: true
global:
  cattle:
    systemDefaultRegistry: ""
priorityClassName: rancher-critical

Environment

- Architecture: amd64
- Fleet Version: 0.15.2
- Cluster:
  - Provider: RKE2
  - Options: 3 Nodes
  - Kubernetes Version: v1.35.5+rke2r1

Logs

Anything else?

The setup is a fresh new one, with no previous instances of Fleet, Rancher or RKE2 running.

Manually adding the labels works:

kubectl patch clusters.management.cattle.io local --type merge -p '{"metadata":{"labels":{"example.com/environment":"test"}}}'
kubectl patch clusters.management.cattle.io local --type merge -p '{"metadata":{"labels":{"example.com/cluster-display-name":"kube-test"}}}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    📋 Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions