Skip to content

Commit

Permalink
Add documentation about transition from placementRule to placement
Browse files Browse the repository at this point in the history
Ref: https://issues.redhat.com/browse/ACM-12698
Signed-off-by: yiraeChristineKim <yikim@redhat.com>
  • Loading branch information
yiraeChristineKim committed Jul 12, 2024
1 parent 6b89365 commit 05725e2
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,68 @@ For additional information about the Policy Generator:
- [Policy Generator reference YAML](https://github.com/stolostron/policy-generator-plugin/blob/main/docs/policygenerator-reference.yaml)
- [Policy Generator examples](policygenerator)

## Transition from PlacementRule to Placement
### Prerequisite
- [ManagedClusterSet](https://open-cluster-management.io/concepts/managedclusterset/) and [ManagedClusterSetBinding](https://open-cluster-management.io/concepts/managedclusterset)
- `Policy`(The `namespace` in the `policy` should be bound to `ManagedClusterSetBinding`)
- `PlacementBinding` and `PlacementRule`
```yaml
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
metadata:
name: binding-policy-comp-operator
placementRef:
name: placement-policy-comp-operator
kind: PlacementRule
apiGroup: apps.open-cluster-management.io
subjects:
- name: policy-comp-operator
kind: Policy
apiGroup: policy.open-cluster-management.io
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: placement-policy-comp-operator
spec:
clusterSelector:
matchExpressions:
- {key: vendor, operator: In, values: ["OpenShift"]}
```
## Convert PlacementRule to Placement
Create the `Placement` manifest as shown below. This `Placement` manifest replaces the `PlacementRule`. Ensure that the `namespace` specified (`comp-operator-ns`) matches the `namespace` used in `ManagedClusterSetBinding`. Copy `matchExpressions` from the `PlacementRule` and paste them into `spec.predicates.requiredClusterSelector.labelSelector`. Update the `PlacementBinding` to reference the new `Placement`. Change the `placementRef.kind` to `Placement` and update the `placementRef.apiGroup` to `cluster.open-cluster-management.io` to reflect the `Placement`'s API version.
```yaml
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
metadata:
name: placement-policy-comp-operator
namespace: comp-operator-ns // Please ensure that this namespace matches one in ManagedClusterSetBinding
spec:
predicates:
- requiredClusterSelector:
labelSelector:
matchExpressions: // From PlacementRule
- {key: vendor, operator: In, values: ["OpenShift"]}
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
metadata:
name: binding-policy-comp-operator
placementRef:
name: placement-policy-comp-operator
kind: Placement // Set here to Placement
apiGroup: cluster.open-cluster-management.io // Set cluster.open-cluster-management.io
subjects:
- name: policy-comp-operator
kind: Policy
apiGroup: policy.open-cluster-management.io
```

For more details on Placement, refer to the [Placement concept](https://open-cluster-management.io/concepts/placement/) documentation.

This explanation provides a clear transition from using `PlacementRule` to `Placement`, ensuring compatibility and proper configuration alignment with Open Cluster Management principles.

## Community, discussion, contribution, and support

Check the [Contributing policies](CONTRIBUTING.md) document for guidelines on how to contribute to
Expand All @@ -111,3 +173,5 @@ are implemented in the product governance framework.

- [Open Cluster Management Quick Start](https://https://open-cluster-management.io/getting-started/quick-start/)



0 comments on commit 05725e2

Please sign in to comment.