Skip to content

Commit eadc0a8

Browse files
committed
CNV-8902: node placement for HPP
1 parent 5e53d20 commit eadc0a8

6 files changed

+88
-19
lines changed

modules/virt-about-node-placement-virtualization-components.adoc

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,27 @@ You might want to customize where {VirtProductName} deploys its components to en
1111
* Operators only deploy on infrastructure nodes.
1212
* Certain nodes are unaffected by {VirtProductName}. For example, you have workloads unrelated to virtualization running on your cluster, and you want those workloads to be isolated from {VirtProductName}.
1313

14-
You can specify node placement rules for the {VirtProductName} Operators that Operator Lifecycle Manager (OLM) deploys by editing the OLM `Subscription` object.
14+
[id="how-to-apply-node-placement-rules-virt-components"]
15+
== How to apply node placement rules to virtualization components
1516

16-
To specify node placement rules for components that the {VirtProductName} Operators deploy, edit the HyperConverged Cluster custom resource (CR).
17+
You can specify node placement rules for a component by editing the corresponding object directly or by using the web console.
1718

18-
[id="about-node-placement-rules_{context}"]
19-
== About node placement rules
19+
* For the {VirtProductName} Operators that Operator Lifecycle Manager (OLM) deploys, edit the OLM `Subscription` object directly. Currently, you cannot configure node placement rules for the `Subscription` object by using the web console.
20+
* For components that the {VirtProductName} Operators deploy, edit the `HyperConverged` object directly or configure it by using the web console during {VirtProductName} installation.
21+
* For the hostpath provisioner, edit the `HostPathProvisioner` object directly or configure it by using the web console.
22+
+
23+
[WARNING]
24+
====
25+
You must schedule the hostpath provisioner and the virtualization components on the same nodes. Otherwise, virtualization pods that use the hostpath provisioner cannot run.
26+
====
27+
28+
Depending on the object, you can use one or more of the following rule types:
2029

2130
`nodeSelector`:: Allows pods to be scheduled on nodes that are labeled with the key-value pair or pairs that you specify in this field. The node must have labels that exactly match all listed pairs.
2231
`affinity`:: Enables you to use more expressive syntax to set rules that match nodes with pods. Affinity also allows for more nuance in how the rules are applied. For example, you can specify that a rule is a preference, rather than a hard requirement, so that pods are still scheduled if the rule is not satisfied.
2332
`tolerations`:: Allows pods to be scheduled on nodes that have matching taints. If a taint is applied to a node, that node only accepts pods that tolerate the taint.
2433

25-
[id="node-placement-olm-subscription-object_{context}"]
34+
[id="node-placement-olm-subscription_{context}"]
2635
== Node placement in the OLM Subscription object
2736

2837
To specify the nodes where OLM deploys the {VirtProductName} Operators, edit the `Subscription` object during {VirtProductName} installation. You can include node placement rules in the `spec.config` field, as shown in the following example:
@@ -44,8 +53,8 @@ spec:
4453
----
4554
<1> The `config` field supports `nodeSelector` and `tolerations`, but it does not support `affinity`.
4655

47-
[id="node-placement-hco-cluster-cr_{context}"]
48-
== Node placement in the HyperConverged Cluster CR
56+
[id="node-placement-hco_{context}"]
57+
== Node placement in the HyperConverged object
4958

5059
To specify the nodes where {VirtProductName} deploys its components, you can include the `nodePlacement` object in the HyperConverged Cluster custom resource (CR) file that you create during {VirtProductName} installation. You can include `nodePlacement` under the `spec.infra` and `spec.workloads` fields, as shown in the following example:
5160

@@ -64,3 +73,23 @@ spec:
6473
nodePlacement:
6574
----
6675
<1> The `nodePlacement` field supports `nodeSelector`, `affinity`, and `tolerations` fields.
76+
77+
[id="node-placement-hpp_{context}"]
78+
== Node placement in the HostPathProvisioner object
79+
80+
You can configure node placement rules in the `spec.workload` field of the `HostPathProvisioner` object that you create when you install the hostpath provisioner.
81+
82+
[source,yaml]
83+
----
84+
apiVersion: hostpathprovisioner.kubevirt.io/v1beta1
85+
kind: HostPathProvisioner
86+
metadata:
87+
name: hostpath-provisioner
88+
spec:
89+
imagePullPolicy: IfNotPresent
90+
pathConfig:
91+
path: "</path/to/backing/directory>"
92+
useNamingPrefix: false
93+
workload: <1>
94+
----
95+
<1> The `workload` field supports `nodeSelector`, `affinity`, and `tolerations` fields.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/install/virt-specifying-nodes-for-virtualization-components.adoc
4+
5+
[id="virt-example-node-placement-node-selector-hpp_{context}"]
6+
= Example: Node placement with nodeSelector in the HostPathProvisioner object
7+
8+
In this example, `nodeSelector` is configured so that workloads are placed on nodes labeled with `example.io/example-workloads-key = example-workloads-value`.
9+
10+
[source,yaml]
11+
----
12+
apiVersion: hostpathprovisioner.kubevirt.io/v1beta1
13+
kind: HostPathProvisioner
14+
metadata:
15+
name: hostpath-provisioner
16+
spec:
17+
imagePullPolicy: IfNotPresent
18+
pathConfig:
19+
path: "</path/to/backing/directory>"
20+
useNamingPrefix: false
21+
workload:
22+
nodeSelector:
23+
example.io/example-workloads-key: example-workloads-value
24+
----

modules/virt-using-hostpath-provisioner.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ spec:
5050
pathConfig:
5151
path: "</path/to/backing/directory>" <1>
5252
useNamingPrefix: false <2>
53+
workload: <3>
5354
----
5455
<1> Specify the backing directory where you want the provisioner to create PVs.
5556
<2> Change this value to `true` if you want to use the name of the persistent volume claim (PVC)
5657
that is bound to the created PV as the prefix of the directory name.
58+
<3> Optional: You can use the `spec.workload` field to configure node placement rules for the hostpath provisioner.
5759
+
5860
[NOTE]
5961
====

virt/install/installing-virt-web.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ You can use the {product-title} {product-version}
1111
xref:../../web_console/web-console.adoc#web-console-overview_web-console[web console]
1212
to subscribe to and deploy the {VirtProductName} Operators.
1313

14-
[NOTE]
15-
====
16-
To specify the nodes where you want {VirtProductName} to install its components, xref:../../virt/install/virt-specifying-nodes-for-virtualization-components.adoc#virt-specifying-nodes-for-virtualization-components[configure node placement rules].
17-
====
18-
1914
[id="prerequisites_{context}"]
2015
== Prerequisites
2116
* Install {product-title} {product-version} on your cluster.

virt/install/virt-specifying-nodes-for-virtualization-components.adoc

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include::modules/common-attributes.adoc[]
55
:context: virt-specifying-nodes-for-virtualization-components
66
toc::[]
77

8-
Specify the nodes where you want to deploy {VirtProductName} Operators, workloads, and controllers by configuring node placement rules during xref:../../virt/install/installing-virt-cli.adoc#installing-virt-cli[installation].
8+
Specify the nodes where you want to deploy {VirtProductName} Operators, workloads, and controllers by configuring node placement rules.
99

1010
[NOTE]
1111
====
@@ -17,24 +17,40 @@ include::modules/virt-about-node-placement-virtualization-components.adoc[levelo
1717
[id="additional-resources_{context}"]
1818
=== Additional resources
1919

20+
[id="node-placement-resources_{context}"]
21+
==== Node placement rules
2022
* xref:../../nodes/scheduling/nodes-scheduler-node-selectors.html#nodes-scheduler-node-selectors[Placing pods on specific nodes using node selectors]
2123
* xref:../../nodes/scheduling/nodes-scheduler-node-affinity.adoc#nodes-scheduler-node-affinity[Controlling pod placement on nodes using node affinity rules]
2224
* xref:../../nodes/scheduling/nodes-scheduler-taints-tolerations.adoc#nodes-scheduler-taints-tolerations[Controlling pod placement using node taints]
2325

26+
[id="installation-resources_{context}"]
27+
==== Installing {VirtProductName}
28+
* xref:../../virt/install/installing-virt-cli.adoc#installing-virt-cli[Installing {VirtProductName} using the CLI]
29+
* xref:../../virt/install/installing-virt-web.adoc#installing-virt-web[Installing {VirtProductName} using the web console]
30+
31+
[id="hostpath-provisioner-resources_{context}"]
32+
==== Configuring the hostpath provisioner
33+
* xref:../../virt/virtual_machines/virtual_disks/virt-configuring-local-storage-for-vms.adoc#virt-configuring-local-storage-for-vms[Configuring local storage for virtual machines]
34+
2435
[id="example-manifests_{context}"]
2536
== Example manifests
2637

27-
The following example YAML snippets use `nodePlacement`, `affinity`, and `tolerations` objects to customize node placement for {VirtProductName} components.
38+
The following example YAML files use `nodePlacement`, `affinity`, and `tolerations` objects to customize node placement for {VirtProductName} components.
2839

2940
[id="olm-subscription-examples_{context}"]
30-
=== Operator Lifecycle Manager Subscription examples
41+
=== Operator Lifecycle Manager Subscription object
3142

32-
include::modules/virt-example-node-placement-tolerations-olm-subscription.adoc[leveloffset=+3]
3343
include::modules/virt-example-node-placement-node-selector-olm-subscription.adoc[leveloffset=+3]
44+
include::modules/virt-example-node-placement-tolerations-olm-subscription.adoc[leveloffset=+3]
3445

3546
[id="hyperconverged-cluster-cr-examples_{context}"]
36-
=== HyperConverged Cluster CR examples
47+
=== HyperConverged object
3748

3849
include::modules/virt-example-node-placement-node-selector-hyperconverged-cr.adoc[leveloffset=+3]
3950
include::modules/virt-example-node-placement-affinity-hyperconverged-cr.adoc[leveloffset=+3]
40-
include::modules/virt-example-node-placement-tolerations-hyperconverged-cr.adoc[leveloffset=+3]
51+
include::modules/virt-example-node-placement-tolerations-hyperconverged-cr.adoc[leveloffset=+3]
52+
53+
[id="hpp-object-examples_{context}"]
54+
=== HostPathProvisioner object
55+
56+
include::modules/virt-example-node-placement-node-selector-hpp.adoc[leveloffset=+3]

virt/virtual_machines/virtual_disks/virt-configuring-local-storage-for-vms.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include::modules/virt-document-attributes.adoc[]
44
:context: virt-configuring-local-storage-for-vms
55
toc::[]
66

7-
87
You can configure local storage for your virtual machines by using the hostpath
98
provisioner feature.
109

@@ -14,4 +13,8 @@ include::modules/virt-configuring-selinux-hpp-on-rhcos8.adoc[leveloffset=+1]
1413

1514
include::modules/virt-using-hostpath-provisioner.adoc[leveloffset=+1]
1615

16+
[id="virt-local-storage-resources"]
17+
=== Additional resources
18+
* xref:../../../virt/install/virt-specifying-nodes-for-virtualization-components.adoc#virt-specifying-nodes-for-virtualization-components[Specifying nodes for virtualization components]
19+
1720
include::modules/virt-creating-storage-class.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)