Skip to content

Commit b9dddcb

Browse files
authored
Merge pull request #55443 from jeana-redhat/OSDOCS-5013-CPMS-GCP-support-YAML
[OSDOCS-5013]: CPMS for GCP: YAML samples
2 parents e56b54e + 0fee7e4 commit b9dddcb

File tree

4 files changed

+169
-29
lines changed

4 files changed

+169
-29
lines changed

machine_management/control_plane_machine_management/cpmso-configuration.adoc

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include::_attributes/common-attributes.adoc[]
66

77
toc::[]
88

9-
These example YAML file and snippets demonstrate the base structure for a control plane machine set custom resource (CR) and platform-specific samples for failure domain and provider specification configurations.
9+
These example YAML file and snippets demonstrate the base structure for a control plane machine set custom resource (CR) and platform-specific samples for provider specification and failure domain configurations.
1010

1111
//Sample YAML for a control plane machine set custom resource
1212
include::modules/cpmso-yaml-sample-cr.adoc[leveloffset=+1]
@@ -25,37 +25,54 @@ The `<platform_failure_domains>` and `<platform_provider_spec>` sections of the
2525

2626
* xref:../../machine_management/control_plane_machine_management/cpmso-configuration.adoc#cpmso-sample-yaml-aws_cpmso-configuration[Sample YAML snippets for configuring Amazon Web Services clusters]
2727

28+
* xref:../../machine_management/control_plane_machine_management/cpmso-configuration.adoc#cpmso-sample-yaml-gcp_cpmso-configuration[Sample YAML snippets for configuring Google Cloud Platform clusters]
29+
2830
* xref:../../machine_management/control_plane_machine_management/cpmso-configuration.adoc#cpmso-sample-yaml-azure_cpmso-configuration[Sample YAML snippets for configuring Microsoft Azure clusters]
2931

3032
* xref:../../machine_management/control_plane_machine_management/cpmso-configuration.adoc#cpmso-sample-yaml-vsphere_cpmso-configuration[Sample YAML snippets for configuring VMware vSphere clusters]
3133

32-
3334
[id="cpmso-sample-yaml-aws_{context}"]
3435
== Sample YAML for configuring Amazon Web Services clusters
3536

36-
Some sections of the control plane machine set CR are provider-specific. The example YAML in this section show failure domain and provider specification configurations for an Amazon Web Services (AWS) cluster.
37-
38-
//Sample AWS failure domain configuration
39-
include::modules/cpmso-yaml-failure-domain-aws.adoc[leveloffset=+2]
37+
Some sections of the control plane machine set CR are provider-specific. The example YAML in this section show provider specification and failure domain configurations for an Amazon Web Services (AWS) cluster.
4038

4139
//Sample AWS provider specification
4240
include::modules/cpmso-yaml-provider-spec-aws.adoc[leveloffset=+2]
4341

42+
//Sample AWS failure domain configuration
43+
include::modules/cpmso-yaml-failure-domain-aws.adoc[leveloffset=+2]
44+
4445
[role="_additional-resources"]
4546
.Additional resources
4647
* xref:../../machine_management/control_plane_machine_management/cpmso-using.adoc#cpmso-supported-features-aws_cpmso-using[Enabling Amazon Web Services features for control plane machines]
4748

49+
[id="cpmso-sample-yaml-gcp_{context}"]
50+
== Sample YAML for configuring Google Cloud Platform clusters
51+
52+
Some sections of the control plane machine set CR are provider-specific. The example YAML in this section show provider specification and failure domain configurations for a Google Cloud Platform (GCP) cluster.
53+
54+
//Sample GCP provider specification
55+
include::modules/cpmso-yaml-provider-spec-gcp.adoc[leveloffset=+2]
56+
57+
//Sample GCP failure domain configuration
58+
include::modules/cpmso-yaml-failure-domain-gcp.adoc[leveloffset=+2]
59+
////
60+
//To be added in a later PR
61+
[role="_additional-resources"]
62+
.Additional resources
63+
* xref:../../machine_management/control_plane_machine_management/cpmso-using.adoc#cpmso-supported-features-gcp_cpmso-using[Enabling Google Cloud Platform features for control plane machines]
64+
////
4865
[id="cpmso-sample-yaml-azure_{context}"]
4966
== Sample YAML for configuring Microsoft Azure clusters
5067

51-
Some sections of the control plane machine set CR are provider-specific. The example YAML in this section show failure domain and provider specification configurations for an Azure cluster.
52-
53-
//Sample Azure failure domain configuration
54-
include::modules/cpmso-yaml-failure-domain-azure.adoc[leveloffset=+2]
68+
Some sections of the control plane machine set CR are provider-specific. The example YAML in this section show provider specification and failure domain configurations for an Azure cluster.
5569

5670
//Sample Azure provider specification
5771
include::modules/cpmso-yaml-provider-spec-azure.adoc[leveloffset=+2]
5872

73+
//Sample Azure failure domain configuration
74+
include::modules/cpmso-yaml-failure-domain-azure.adoc[leveloffset=+2]
75+
5976
[role="_additional-resources"]
6077
.Additional resources
6178
* xref:../../machine_management/control_plane_machine_management/cpmso-using.adoc#cpmso-supported-features-azure_cpmso-using[Enabling Microsoft Azure features for control plane machines]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * machine_management/cpmso-configuration.adoc
4+
5+
:_content-type: REFERENCE
6+
[id="cpmso-yaml-failure-domain-gcp_{context}"]
7+
= Sample GCP failure domain configuration
8+
9+
The control plane machine set concept of a failure domain is analogous to the existing GCP concept of a link:https://cloud.google.com/compute/docs/regions-zones[_zone_]. The `ControlPlaneMachineSet` CR spreads control plane machines across multiple failure domains when possible.
10+
11+
When configuring GCP failure domains in the control plane machine set, you must specify the zone name to use.
12+
13+
.Sample GCP failure domain values
14+
[source,yaml]
15+
----
16+
failureDomains:
17+
gcp:
18+
- zone: <gcp_zone_a> <1>
19+
- zone: <gcp_zone_b> <2>
20+
- zone: <gcp_zone_c>
21+
- zone: <gcp_zone_d>
22+
platform: GCP <3>
23+
----
24+
<1> Specifies a GCP zone for the first failure domain.
25+
<2> Specifies an additional failure domain. Further failure domains are added the same way.
26+
<3> Specifies the cloud provider platform name. Do not change this value.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * machine_management/cpmso-configuration.adoc
4+
5+
:_content-type: REFERENCE
6+
[id="cpmso-yaml-provider-spec-gcp_{context}"]
7+
= Sample GCP provider specification
8+
9+
When you create a control plane machine set for an existing cluster, the provider specification must match the `providerSpec` configuration in the control plane machine custom resource (CR) that is created by the installation program. You can omit any field that is set in the failure domain section of the CR.
10+
11+
[discrete]
12+
[id="cpmso-yaml-provider-spec-gcp-oc_{context}"]
13+
== Values obtained by using the OpenShift CLI
14+
15+
In the following example, you can obtain some of the values for your cluster by using the OpenShift CLI.
16+
17+
Infrastructure ID:: The `<cluster_id>` string is the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster. If you have the OpenShift CLI installed, you can obtain the infrastructure ID by running the following command:
18+
+
19+
[source,terminal]
20+
----
21+
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
22+
----
23+
24+
Image path:: The `<path_to_image>` string is the path to the image that was used to create the disk. If you have the OpenShift CLI installed, you can obtain the path to the image by running the following command:
25+
+
26+
[source,terminal]
27+
----
28+
$ oc -n openshift-machine-api \
29+
-o jsonpath='{.spec.template.machines_v1beta1_machine_openshift_io.spec.providerSpec.value.disks[0].image}{"\n"}' \
30+
get ControlPlaneMachineSet/cluster
31+
----
32+
33+
.Sample GCP `providerSpec` values
34+
[source,yaml]
35+
----
36+
providerSpec:
37+
value:
38+
apiVersion: machine.openshift.io/v1beta1
39+
canIPForward: false
40+
credentialsSecret:
41+
name: gcp-cloud-credentials <1>
42+
deletionProtection: false
43+
disks:
44+
- autoDelete: true
45+
boot: true
46+
image: <path_to_image> <2>
47+
labels: null
48+
sizeGb: 200
49+
type: pd-ssd
50+
kind: GCPMachineProviderSpec <3>
51+
machineType: e2-standard-4
52+
metadata:
53+
creationTimestamp: null
54+
metadataServiceOptions: {}
55+
networkInterfaces:
56+
- network: <cluster_id>-network
57+
subnetwork: <cluster_id>-master-subnet
58+
projectID: <project_name> <4>
59+
region: <region> <5>
60+
serviceAccounts:
61+
- email: <cluster_id>-m@<project_name>.iam.gserviceaccount.com
62+
scopes:
63+
- https://www.googleapis.com/auth/cloud-platform
64+
shieldedInstanceConfig: {}
65+
tags:
66+
- <cluster_id>-master
67+
targetPools:
68+
- <cluster_id>-api
69+
userDataSecret:
70+
name: master-user-data <6>
71+
zone: "" <7>
72+
----
73+
<1> Specifies the secret name for the cluster. Do not change this value.
74+
<2> Specifies the path to the image that was used to create the disk.
75+
+
76+
To use a GCP Marketplace image, specify the offer to use:
77+
+
78+
--
79+
* {product-title}: `\https://www.googleapis.com/compute/v1/projects/redhat-marketplace-public/global/images/redhat-coreos-ocp-48-x86-64-202210040145`
80+
* {opp}: `\https://www.googleapis.com/compute/v1/projects/redhat-marketplace-public/global/images/redhat-coreos-opp-48-x86-64-202206140145`
81+
* {oke}: `\https://www.googleapis.com/compute/v1/projects/redhat-marketplace-public/global/images/redhat-coreos-oke-48-x86-64-202206140145`
82+
--
83+
<3> Specifies the cloud provider platform type. Do not change this value.
84+
<4> Specifies the name of the GCP project that you use for your cluster.
85+
<5> Specifies the GCP region for the cluster.
86+
<6> Specifies the control plane user data secret. Do not change this value.
87+
<7> This parameter is configured in the failure domain, and is shown with an empty value here. If a value specified for this parameter differs from the value in the failure domain, the Operator overwrites it with the value in the failure domain.

modules/machineset-yaml-gcp.adoc

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,36 @@ endif::[]
1212
= Sample YAML for a compute machine set custom resource on GCP
1313

1414
This sample YAML defines a compute machine set that runs in Google Cloud Platform (GCP) 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
15+
ifndef::infra[`node-role.kubernetes.io/<role>: ""`,]
16+
ifdef::infra[`node-role.kubernetes.io/infra: ""`,]
17+
where
1918
ifndef::infra[`<role>`]
20-
ifdef::infra[`<infra>`]
19+
ifdef::infra[`infra`]
2120
is the node label to add.
2221

22+
[discrete]
23+
[id="cpmso-yaml-provider-spec-gcp-oc_{context}"]
24+
== Values obtained by using the OpenShift CLI
25+
26+
In the following example, you can obtain some of the values for your cluster by using the OpenShift CLI.
27+
28+
Infrastructure ID:: The `<infrastructure_id>` string is the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster. If you have the OpenShift CLI installed, you can obtain the infrastructure ID by running the following command:
29+
+
30+
[source,terminal]
31+
----
32+
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
33+
----
34+
35+
Image path:: The `<path_to_image>` string is the path to the image that was used to create the disk. If you have the OpenShift CLI installed, you can obtain the path to the image by running the following command:
36+
+
37+
[source,terminal]
38+
----
39+
$ oc -n openshift-machine-api \
40+
-o jsonpath='{.spec.template.spec.providerSpec.value.disks[0].image}{"\n"}' \
41+
get machineset/<infrastructure_id>-worker-a
42+
----
43+
44+
.Sample GCP `MachineSet` values
2345
[source,yaml]
2446
----
2547
apiVersion: machine.openshift.io/v1beta1
@@ -99,26 +121,14 @@ ifdef::infra[]
99121
effect: NoSchedule
100122
endif::infra[]
101123
----
102-
<1> For `<infrastructure_id>`, 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 installed, you can obtain the infrastructure ID by running the following command:
103-
+
104-
[source,terminal]
105-
----
106-
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
107-
----
124+
<1> For `<infrastructure_id>`, specify the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster.
108125
ifndef::infra[]
109126
<2> For `<node>`, specify the node label to add.
110127
endif::infra[]
111128
ifdef::infra[]
112129
<2> For `<infra>`, specify the `<infra>` node label.
113130
endif::infra[]
114-
<3> Specify the path to the image that is used in current compute machine sets. If you have the OpenShift CLI installed, you can obtain the path to the image by running the following command:
115-
+
116-
[source,terminal]
117-
----
118-
$ oc -n openshift-machine-api \
119-
-o jsonpath='{.spec.template.spec.providerSpec.value.disks[0].image}{"\n"}' \
120-
get machineset/<infrastructure_id>-worker-a
121-
----
131+
<3> Specify the path to the image that is used in current compute machine sets.
122132
+
123133
To use a GCP Marketplace image, specify the offer to use:
124134
+

0 commit comments

Comments
 (0)