|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * machine_management/creating-infrastructure-machinesets.adoc |
| 4 | +// * machine_management/creating_machinesets/creating-machineset-rhv.adoc |
| 5 | + |
| 6 | +[id="machineset-yaml-rhv_{context}"] |
| 7 | += Sample YAML for a machine set custom resource on {rh-virtualization} |
| 8 | + |
| 9 | +This sample YAML defines a machine set that runs on {rh-virtualization} and creates nodes that are labeled with `node-role.kubernetes.io/<node_role>: ""`. |
| 10 | + |
| 11 | +In this sample, `<infrastructure_id>` is the infrastructure ID label that is based on the cluster ID that you set when you provisioned the cluster, and `<role>` is the node label to add. |
| 12 | + |
| 13 | +[source,yaml,subs="+quotes"] |
| 14 | +---- |
| 15 | +apiVersion: machine.openshift.io/v1beta1 |
| 16 | +kind: MachineSet |
| 17 | +metadata: |
| 18 | + labels: |
| 19 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 20 | + machine.openshift.io/cluster-api-machine-role: <role> <2> |
| 21 | + machine.openshift.io/cluster-api-machine-type: <role> <2> |
| 22 | + name: <infrastructure_id>-<role> <3> |
| 23 | + namespace: openshift-machine-api |
| 24 | +spec: |
| 25 | + replicas: <number_of_replicas> <4> |
| 26 | + Selector: <5> |
| 27 | + matchLabels: |
| 28 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 29 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role> <3> |
| 30 | + template: |
| 31 | + metadata: |
| 32 | + labels: |
| 33 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 34 | + machine.openshift.io/cluster-api-machine-role: <role> <2> |
| 35 | + machine.openshift.io/cluster-api-machine-type: <role> <2> |
| 36 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role> <3> |
| 37 | + spec: |
| 38 | + metadata: |
| 39 | + labels: |
| 40 | + node-role.kubernetes.io/<role>: "" <2> |
| 41 | + providerSpec: |
| 42 | + value: |
| 43 | + apiVersion: ovirtproviderconfig.machine.openshift.io/v1beta1 |
| 44 | + cluster_id: <ovirt_cluster_id> <6> |
| 45 | + template_name: <ovirt_template_name> <7> |
| 46 | + instance_type_id: <instance_type_id> <8> |
| 47 | + cpu: <9> |
| 48 | + sockets: <number_of_sockets> <10> |
| 49 | + cores: <number_of_cores> <11> |
| 50 | + threads: <number_of_threads> <12> |
| 51 | + memory_mb: <memory_size> <13> |
| 52 | + os_disk: <14> |
| 53 | + size_gb: <disk_size> <15> |
| 54 | + network_interfaces: <16> |
| 55 | + vnic_profile_id: <vnic_profile_id> <17> |
| 56 | + credentialsSecret: |
| 57 | + name: ovirt-credentials <18> |
| 58 | + kind: OvirtMachineProviderSpec |
| 59 | + type: <workload_type> <19> |
| 60 | + userDataSecret: |
| 61 | + name: worker-user-data |
| 62 | +---- |
| 63 | +<1> Specify the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster. If you have the OpenShift CLI (`oc`) installed, you can obtain the infrastructure ID by running the following command: |
| 64 | ++ |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster |
| 68 | +---- |
| 69 | + |
| 70 | +<2> Specify the node label to add. |
| 71 | + |
| 72 | +<3> Specify the infrastructure ID and node label. These two strings together cannot be longer than 35 characters. |
| 73 | + |
| 74 | +<4> Specify the number of machines to create. |
| 75 | + |
| 76 | +<5> Selector for the machines. |
| 77 | + |
| 78 | +<6> Specify the UUID for the {rh-virtualization} cluster to which this VM instance belongs. |
| 79 | + |
| 80 | +<7> Specify the {rh-virtualization} VM template to use to create the machine. |
| 81 | + |
| 82 | +<8> Optional: Specify the VM instance type. If you include this parameter, you do not need to specify the hardware parameters of the VM including CPU and memory because this parameter overrides all hardware parameters. |
| 83 | + |
| 84 | +<9> Optional: The CPU field contains the CPU's configuration, including sockets, cores, and threads. |
| 85 | + |
| 86 | +<10> Optional: Specify the number of sockets for a VM. |
| 87 | + |
| 88 | +<11> Optional: Specify the number of cores per socket. |
| 89 | + |
| 90 | +<12> Optional: Specify the number of threads per core. |
| 91 | + |
| 92 | +<13> Optional: Specify the size of a VM's memory in MiB. |
| 93 | + |
| 94 | +<14> Optional: Root disk of the node. |
| 95 | + |
| 96 | +<15> Optional: Specify the size of the bootable disk in GiB. |
| 97 | + |
| 98 | +<16> Optional: List of the network interfaces of the VM. If you include this parameter, {product-title} discards all network interfaces from the template and creates new ones. |
| 99 | + |
| 100 | +<17> Optional: Specify the vNIC profile ID. |
| 101 | + |
| 102 | +<18> Specify the name of the secret that holds the {rh-virtualization} credentials. |
| 103 | +<19> Optional: Specify the workload type for which the instance is optimized. This value affects the `{rh-virtualization} VM` parameter. Supported values: `desktop`, `server`, `high_performance`. |
| 104 | + |
| 105 | +[NOTE] |
| 106 | +==== |
| 107 | +Because {rh-virtualization} uses a template when creating a VM, if you do not specify a value for an optional parameter, {rh-virtualization} uses the value for that parameter that is specified in the template. |
| 108 | +==== |
0 commit comments