|
10 | 10 | - [Snapshot Create and Restore](#snapshot-create-and-restore)
|
11 | 11 | - [Use Topology](#use-topology)
|
12 | 12 | - [Disaster recovery of PV and PVC](#disaster-recovery-of-pv-and-pvc)
|
| 13 | + - [Use scheduler hints annotations](#use-scheduler-hints-annotations) |
13 | 14 |
|
14 | 15 | <!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
15 | 16 |
|
@@ -453,3 +454,51 @@ spec:
|
453 | 454 | storageClassName: sata
|
454 | 455 | volumeMode: Filesystem
|
455 | 456 | ```
|
| 457 | + |
| 458 | +## Use scheduler hints annotations |
| 459 | + |
| 460 | +Cinder CSI driver supports the use of scheduler hints to influence the |
| 461 | +placement of volumes. Scheduler hints can be specified in the |
| 462 | +PersistentVolumeClaim (PVC) annotations: |
| 463 | + |
| 464 | +* `cinder.csi.openstack.org/affinity` |
| 465 | +* `cinder.csi.openstack.org/anti-affinity` |
| 466 | + |
| 467 | +In order to use scheduler hints, the Cinder CSI controller plugin must be |
| 468 | +started with the `--pvc-annotations` flag. The PVC annotations take effect only |
| 469 | +when the PVC is created. The scheduler hints are not updated when the PVC is |
| 470 | +updated. The following example demonstrates how to use scheduler hints to |
| 471 | +influence the placement of volumes: |
| 472 | + |
| 473 | +``` |
| 474 | +$ kubectl apply -f scheduler-hints-pvc.yaml |
| 475 | +``` |
| 476 | + |
| 477 | +``` |
| 478 | +apiVersion: v1 |
| 479 | +kind: PersistentVolumeClaim |
| 480 | +metadata: |
| 481 | + name: csi-pvc-cinderplugin |
| 482 | + annotations: |
| 483 | + cinder.csi.openstack.org/affinity: "1b4e28ba-2fa1-11ec-8d3d-0242ac130003" |
| 484 | + cinder.csi.openstack.org/anti-affinity: "1b4e28ba-2fa1-11ec-8d3d-0242ac130004,pv-k8s--cluster-1b5f47bf-0119-442e-8529-254c36e43644" |
| 485 | +spec: |
| 486 | + accessModes: |
| 487 | + - ReadWriteOnce |
| 488 | + resources: |
| 489 | + requests: |
| 490 | + storage: 1Gi |
| 491 | + storageClassName: csi-sc-cinderplugin |
| 492 | +``` |
| 493 | + |
| 494 | +where `1b4e28ba-2fa1-11ec-8d3d-0242ac130003`, |
| 495 | +`1b4e28ba-2fa1-11ec-8d3d-0242ac130004` and |
| 496 | +`pv-k8s--cluster-1b5f47bf-0119-442e-8529-254c36e43644` are names or UUIDs of |
| 497 | +the already provisioned volumes in the OpenStack cloud. The scheduler will try |
| 498 | +to place the volume in the same block storage server as the volume with the |
| 499 | +`1b4e28ba-2fa1-11ec-8d3d-0242ac130003` UUID and avoid placing the volume in the |
| 500 | +same block storage server as the volumes with the |
| 501 | +`1b4e28ba-2fa1-11ec-8d3d-0242ac130004` UUID and the |
| 502 | +`pv-k8s--cluster-1b5f47bf-0119-442e-8529-254c36e43644` volume name. If the |
| 503 | +scheduler hints are not satisfied, the volume will not be provisioned with an |
| 504 | +error message in the controller logs. |
0 commit comments