Skip to content

Commit 1a99bb9

Browse files
authored
Merge pull request #41943 from jeana-redhat/OSDOCS-2853_Alibaba_Cloud_machine_mgmt
OSDOCS-2853: Alibaba Cloud machine management
2 parents 0e91ef6 + c9845e7 commit 1a99bb9

File tree

5 files changed

+281
-0
lines changed

5 files changed

+281
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,8 @@ Topics:
17551755
Dir: creating_machinesets
17561756
Distros: openshift-origin,openshift-enterprise
17571757
Topics:
1758+
- Name: Creating a machine set on Alibaba Cloud
1759+
File: creating-machineset-alibaba
17581760
- Name: Creating a machine set on AWS
17591761
File: creating-machineset-aws
17601762
- Name: Creating a machine set on Azure

machine_management/creating-infrastructure-machinesets.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ In a production deployment, it is recommended that you deploy at least three mac
2626

2727
Use the sample machine set for your cloud.
2828

29+
include::modules/machineset-yaml-alibaba.adoc[leveloffset=+3]
30+
31+
//Machine set parameters for Alibaba Cloud usage statistics
32+
[discrete]
33+
include::modules/machineset-yaml-alibaba-usage-stats.adoc[leveloffset=+4]
34+
2935
include::modules/machineset-yaml-aws.adoc[leveloffset=+3]
3036

3137
Machine sets running on AWS support non-guaranteed xref:../machine_management/creating_machinesets/creating-machineset-aws.adoc#machineset-non-guaranteed-instance_creating-machineset-aws[Spot Instances]. You can save on costs by using Spot Instances at a lower price compared to
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
:_content-type: ASSEMBLY
2+
[id="creating-machineset-alibaba"]
3+
= Creating a machine set on Alibaba Cloud
4+
include::modules/common-attributes.adoc[]
5+
:context: creating-machineset-alibaba
6+
7+
toc::[]
8+
9+
You can create a different machine set to serve a specific purpose in your {product-title} cluster on Alibaba Cloud. For example, you might create infrastructure machine sets and related machines so that you can move supporting workloads to the new machines.
10+
11+
//[IMPORTANT] admonition for UPI
12+
include::modules/machine-user-provisioned-limitations.adoc[leveloffset=+1]
13+
14+
//Machine API overview
15+
include::modules/machine-api-overview.adoc[leveloffset=+1]
16+
17+
//Sample YAML for a machine set custom resource on Alibaba Cloud
18+
include::modules/machineset-yaml-alibaba.adoc[leveloffset=+1]
19+
20+
//Machine set parameters for Alibaba Cloud usage statistics
21+
include::modules/machineset-yaml-alibaba-usage-stats.adoc[leveloffset=+2]
22+
23+
//Creating a machine set
24+
include::modules/machineset-creating.adoc[leveloffset=+1]
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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-usage-stats_{context}"]
12+
= Machine set parameters for Alibaba Cloud usage statistics
13+
14+
The default machine sets that the installer creates for Alibaba Cloud clusters include nonessential tag values that Alibaba Cloud uses internally to track usage statistics. These tags are populated in the `securityGroups`, `tag`, and `vSwitch` parameters of the `spec.template.spec.providerSpec.value` list.
15+
16+
When creating machine sets to deploy additional machines, you must include the required Kubernetes tags. The usage statistics tags are applied by default, even if they are not specified in the machine sets you create. You can also include additional tags as needed.
17+
18+
The following YAML snippets indicate which tags in the default machine sets are optional and which are required.
19+
20+
.Tags in `spec.template.spec.providerSpec.value.securityGroups`
21+
[source,yaml]
22+
----
23+
spec:
24+
template:
25+
spec:
26+
providerSpec:
27+
value:
28+
securityGroups:
29+
- tags:
30+
- Key: kubernetes.io/cluster/<infrastructure_id> <1>
31+
Value: owned
32+
- Key: GISV
33+
Value: ocp
34+
- Key: sigs.k8s.io/cloud-provider-alibaba/origin <1>
35+
Value: ocp
36+
- Key: Name
37+
Value: <infrastructure_id>-sg-<role> <2>
38+
type: Tags
39+
----
40+
<1> Optional: This tag is applied even when not specified in the machine set.
41+
<2> Required.
42+
+
43+
where:
44+
+
45+
* `<infrastructure_id>` is the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster.
46+
* `<role>` is the node label to add.
47+
48+
.Tags in `spec.template.spec.providerSpec.value.tag`
49+
[source,yaml]
50+
----
51+
spec:
52+
template:
53+
spec:
54+
providerSpec:
55+
value:
56+
tag:
57+
- Key: kubernetes.io/cluster/<infrastructure_id> <2>
58+
Value: owned
59+
- Key: GISV <1>
60+
Value: ocp
61+
- Key: sigs.k8s.io/cloud-provider-alibaba/origin <1>
62+
Value: ocp
63+
----
64+
<1> Optional: This tag is applied even when not specified in the machine set.
65+
<2> Required.
66+
+
67+
where `<infrastructure_id>` is the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster.
68+
69+
.Tags in `spec.template.spec.providerSpec.value.vSwitch`
70+
[source,yaml]
71+
----
72+
spec:
73+
template:
74+
spec:
75+
providerSpec:
76+
value:
77+
vSwitch:
78+
tags:
79+
- Key: kubernetes.io/cluster/<infrastructure_id> <1>
80+
Value: owned
81+
- Key: GISV <1>
82+
Value: ocp
83+
- Key: sigs.k8s.io/cloud-provider-alibaba/origin <1>
84+
Value: ocp
85+
- Key: Name
86+
Value: <infrastructure_id>-vswitch-<zone> <2>
87+
type: Tags
88+
----
89+
<1> Optional: This tag is applied even when not specified in the machine set.
90+
<2> Required.
91+
+
92+
where:
93+
+
94+
* `<infrastructure_id>` is the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster.
95+
* `<zone>` is the zone within your region to place machines on.
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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

Comments
 (0)