|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * machine_management/creating-infrastructure-machinesets.adoc |
| 4 | +// * machine_management/creating_machinesets/creating-machineset-alibaba.adoc |
| 5 | + |
| 6 | +ifeval::["{context}" == "creating-infrastructure-machinesets"] |
| 7 | +:infra: |
| 8 | +endif::[] |
| 9 | + |
| 10 | +:_content-type: REFERENCE |
| 11 | +[id="machineset-yaml-alibaba_{context}"] |
| 12 | += Sample YAML for a machine set custom resource on Alibaba Cloud |
| 13 | + |
| 14 | +This sample YAML defines a machine set that runs in a specified Alibaba Cloud zone in a region and creates nodes that are labeled with |
| 15 | +ifndef::infra[`node-role.kubernetes.io/<role>: ""`.] |
| 16 | +ifdef::infra[`node-role.kubernetes.io/infra: ""`.] |
| 17 | + |
| 18 | +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 |
| 19 | +ifndef::infra[`<role>`] |
| 20 | +ifdef::infra[`<infra>`] |
| 21 | +is the node label to add. |
| 22 | + |
| 23 | +[source,yaml] |
| 24 | +---- |
| 25 | +apiVersion: machine.openshift.io/v1beta1 |
| 26 | +kind: MachineSet |
| 27 | +metadata: |
| 28 | + labels: |
| 29 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 30 | +ifndef::infra[] |
| 31 | + machine.openshift.io/cluster-api-machine-role: <role> <2> |
| 32 | + machine.openshift.io/cluster-api-machine-type: <role> <2> |
| 33 | + name: <infrastructure_id>-<role>-<zone> <3> |
| 34 | +endif::infra[] |
| 35 | +ifdef::infra[] |
| 36 | + machine.openshift.io/cluster-api-machine-role: <infra> <2> |
| 37 | + machine.openshift.io/cluster-api-machine-type: <infra> <2> |
| 38 | + name: <infrastructure_id>-<infra>-<zone> <3> |
| 39 | +endif::infra[] |
| 40 | + namespace: openshift-machine-api |
| 41 | +spec: |
| 42 | + replicas: 1 |
| 43 | + selector: |
| 44 | + matchLabels: |
| 45 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 46 | +ifndef::infra[] |
| 47 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>-<zone> <3> |
| 48 | +endif::infra[] |
| 49 | +ifdef::infra[] |
| 50 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<infra>-<zone> <3> |
| 51 | +endif::infra[] |
| 52 | + template: |
| 53 | + metadata: |
| 54 | + labels: |
| 55 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 56 | +ifndef::infra[] |
| 57 | + machine.openshift.io/cluster-api-machine-role: <role> <2> |
| 58 | + machine.openshift.io/cluster-api-machine-type: <role> <2> |
| 59 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>-<zone> <3> |
| 60 | +endif::infra[] |
| 61 | +ifdef::infra[] |
| 62 | + machine.openshift.io/cluster-api-machine-role: <infra> <2> |
| 63 | + machine.openshift.io/cluster-api-machine-type: <infra> <2> |
| 64 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<infra>-<zone> <3> |
| 65 | +endif::infra[] |
| 66 | + spec: |
| 67 | + metadata: |
| 68 | + labels: |
| 69 | +ifndef::infra[] |
| 70 | + node-role.kubernetes.io/<role>: "" |
| 71 | +endif::infra[] |
| 72 | +ifdef::infra[] |
| 73 | + node-role.kubernetes.io/infra: "" |
| 74 | +endif::infra[] |
| 75 | + providerSpec: |
| 76 | + value: |
| 77 | + apiVersion: machine.openshift.io/v1 |
| 78 | + credentialsSecret: |
| 79 | + name: alibabacloud-credentials |
| 80 | + imageId: <image_id> <4> |
| 81 | + instanceType: <instance_type> <5> |
| 82 | + kind: AlibabaCloudMachineProviderConfig |
| 83 | + ramRoleName: <infrastructure_id>-role-worker <6> |
| 84 | + regionId: <region> <7> |
| 85 | + resourceGroup: <8> |
| 86 | + id: <resource_group_id> |
| 87 | + type: ID |
| 88 | + securityGroups: |
| 89 | + - tags: <9> |
| 90 | + - Key: Name |
| 91 | + Value: <infrastructure_id>-sg-<role> |
| 92 | + type: Tags |
| 93 | + systemDisk: <10> |
| 94 | + category: cloud_essd |
| 95 | + size: <disk_size> |
| 96 | + tag: <9> |
| 97 | + - Key: kubernetes.io/cluster/<infrastructure_id> |
| 98 | + Value: owned |
| 99 | + userDataSecret: |
| 100 | + name: <user_data_secret> <11> |
| 101 | + vSwitch: |
| 102 | + tags: <9> |
| 103 | + - Key: Name |
| 104 | + Value: <infrastructure_id>-vswitch-<zone> |
| 105 | + type: Tags |
| 106 | + vpcId: "" |
| 107 | + zoneId: <zone> <12> |
| 108 | +ifdef::infra[] |
| 109 | + taints: <13> |
| 110 | + - key: node-role.kubernetes.io/infra |
| 111 | + effect: NoSchedule |
| 112 | +endif::infra[] |
| 113 | +---- |
| 114 | +<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: |
| 115 | ++ |
| 116 | +[source,terminal] |
| 117 | +---- |
| 118 | +$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster |
| 119 | +---- |
| 120 | +ifndef::infra[] |
| 121 | +<2> Specify the node label to add. |
| 122 | +<3> Specify the infrastructure ID, node label, and zone. |
| 123 | +endif::infra[] |
| 124 | +ifdef::infra[] |
| 125 | +<2> Specify the `<infra>` node label. |
| 126 | +<3> Specify the infrastructure ID, `<infra>` node label, and zone. |
| 127 | +endif::infra[] |
| 128 | +<4> Specify the image to use. Use an image from an existing default machine set for the cluster. |
| 129 | +<5> Specify the instance type you want to use for the machine set. |
| 130 | +<6> Specify the name of the RAM role to use for the machine set. Use the value that the installer populates in the default machine set. |
| 131 | +<7> Specify the region to place machines on. |
| 132 | +<8> Specify the resource group and type for the cluster. You can use the value that the installer populates in the default machine set, or specify a different one. |
| 133 | +<9> Specify the tags to use for the machine set. Minimally, you must include the tags shown in this example, with appropriate values for your cluster. You can include additional tags, including the tags that the installer populates in the default machine set it creates, as needed. |
| 134 | +<10> Specify the type and size of the root disk. Use the `category` value that the installer populates in the default machine set it creates. If required, specify a different value in gigabytes for `size`. |
| 135 | +<11> Specify the name of the secret in the user data YAML file that is in the `openshift-machine-api` namespace. Use the value that the installer populates in the default machine set. |
| 136 | +<12> Specify the zone within your region to place machines on. Be sure that your region supports the zone that you specify. |
| 137 | +ifdef::infra[] |
| 138 | +<13> Specify a taint to prevent user workloads from being scheduled on infra nodes. |
| 139 | +endif::infra[] |
| 140 | + |
| 141 | +ifeval::["{context}" == "creating-infrastructure-machinesets"] |
| 142 | +:!infra: |
| 143 | +endif::[] |
| 144 | +ifeval::["{context}" == "cluster-tasks"] |
| 145 | +:!infra: |
| 146 | +endif::[] |
| 147 | + |
| 148 | +//// |
| 149 | +Not needed for this release, but the process to create a new value for the name of the secret in the user data YAML file is: |
| 150 | +1. Create a file (script with things you want to run). |
| 151 | +2. Run base64 encoding on the script. |
| 152 | +3. Add the base64-encoded string to a user data YAML file like this one: https://github.com/openshift/cluster-api-provider-alibaba/blob/main/examples/userdata.yml#L1 The `name` in that file should match the `userDataSecret` name in the machine set. |
| 153 | +4. Place the user data file in the `openshift-machine-api` namespace. |
| 154 | +//// |
0 commit comments