Skip to content

BUG: resources not created if clusterProfile matches also mgmt cluster #1891

Description

@Frusoz

Problem Description

With the following clusterProfile, resource are not created if it matches also the mgmt cluster.

If the clusterProfile only matches "test" and "prod" clusters, for example, resources are correctly created

cluster-profile.yaml

---
apiVersion: config.projectsveltos.io/v1beta1
kind: ClusterProfile
metadata:
  name: openbao-cluster-roles-shared
  namespace: projectsveltos
spec:
  clusterSelector:
    matchExpressions:
      - key: environment
        operator: Exists
  syncMode: ContinuousWithDriftDetection
  stopMatchingBehavior: WithdrawPolicies
  policyRefs:
    - kind: ConfigMap
      name: openbao-cluster-roles-template
      namespace: projectsveltos
      deploymentType: Local
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: openbao-cluster-roles-template
  namespace: projectsveltos
  annotations:
    projectsveltos.io/template: "true"
data:
  policy.yaml: |
    apiVersion: vault.vault.m.upbound.io/v1alpha1
    kind: Policy
    metadata:
      name: external-secrets-{{ .Cluster.metadata.name }}
      namespace: crossplane-system
      annotations:
        crossplane.io/external-name: external-secrets-{{ .Cluster.metadata.name }}
    spec:
      forProvider:
        name: external-secrets-{{ .Cluster.metadata.name }}
        policy: |
          path "secret/kubernetes/{{ index .Cluster.metadata.labels `environment` }}/*" {
            capabilities = ["create", "read", "update", "delete", "list"]
          }
          path "secret/kubernetes/shared/*" {
            capabilities = ["create", "read", "update", "delete", "list"]
          }
      providerConfigRef:
        kind: ProviderConfig
        name: default

System Information

CLUSTERAPI VERSION: v0.28.0
SVELTOS VERSION: v1.12.0
KUBERNETES VERSION: v1.36.2

Logs

clusterProfile matchingClusters

status:
  matchingClusters:
  - apiVersion: cluster.x-k8s.io/v1beta2
    kind: Cluster
    name: prod-cluster
    namespace: prod-cluster
  - apiVersion: cluster.x-k8s.io/v1beta2
    kind: Cluster
    name: utils-cluster
    namespace: utils-cluster
  - apiVersion: lib.projectsveltos.io/v1beta1
    kind: SveltosCluster
    name: mgmt-cluster
    namespace: mgmt

resources actually deployed

Image

sveltosctl show addons

Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions