RHACM Updating the PlacementRule of a Policy via Git is not working as expected
Issue
When we update a policy's PlacementRule from matchExpressions
to matchLabels
, the old matchExpressions
are not removed.
See the following example:
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: placement-policy-etcdencryption
spec:
clusterConditions:
- status: "True"
type: ManagedClusterConditionAvailable
clusterSelector:
matchExpressions:
- {key: environment, operator: In, values: ["test"]}
if we change it to matchLabels
:
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: placement-policy-etcdencryption
spec:
clusterConditions:
- status: "True"
type: ManagedClusterConditionAvailable
clusterSelector:
matchLabels: {}
We see that the old matchExpression
is still present.
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: placement-policy-etcdencryption
spec:
clusterConditions:
- status: "True"
type: ManagedClusterConditionAvailable
clusterSelector:
matchExpressions: []
matchLabel: {}
How can it be updated accordingly (replaced)?
Environment
Red Hat Advanced Cluster Manager (RHACM) 2.3, 2.4, 2.5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.