Skip to content

Commit 3812f86

Browse files
committed
Draft: Update cloudscale instructions for no-puppet install
1 parent 03d8c73 commit 3812f86

File tree

8 files changed

+82
-79
lines changed

8 files changed

+82
-79
lines changed

docs/modules/ROOT/pages/how-tos/cloudscale/install.adoc

Lines changed: 65 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
:k8s-minor-version: 1.31
44
:ocp-patch-version: {ocp-minor-version}.1
55
:provider: cloudscale
6+
:needs_hieradata_edit: no
67

78
[abstract]
89
--
@@ -40,6 +41,7 @@ include::partial$install/prerequisites.adoc[]
4041
* `mc` >= `RELEASE.2021-07-27T06-46-19Z` https://docs.min.io/docs/minio-client-quickstart-guide.html[Minio client] (aliased to `mc` if necessary)
4142
* `aws` CLI https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html[Official install instructions].
4243
You can also install the Python package with your favorite package manager (we recommend https://docs.astral.sh/uv/[`uv`]: `uv tool install awscli`).
44+
* `python3` as `python`
4345

4446

4547
[WARNING]
@@ -53,13 +55,12 @@ include::partial$install/register.adoc[]
5355

5456
=== Configure input
5557

56-
Create 2 new cloudscale API tokens with read+write permissions and name them *`<cluster_id>`* and *`<cluster_id>_floaty`* on https://control.cloudscale.ch/service/<your-project>/api-token.
58+
Create a new cloudscale API token with read+write permissions and name *`<cluster_id>`* on https://control.cloudscale.ch/service/<your-project>/api-token.
5759

5860
.Access to cloud API
5961
[source,bash]
6062
----
6163
export CLOUDSCALE_API_TOKEN=<cloudscale-api-token>
62-
export TF_VAR_lb_cloudscale_api_secret=<cloudscale-api-token-for-Floaty>
6364
----
6465

6566
include::partial$install/vshn-input.adoc[]
@@ -70,6 +71,68 @@ include::partial$install/vshn-input.adoc[]
7071
export REGION=$(curl -sH "Authorization: Bearer $(commodore fetch-token)" ${COMMODORE_API_URL}/clusters/${CLUSTER_ID} | jq -r .facts.region)
7172
----
7273

74+
=== Create private network and subnet
75+
76+
. Create a private network via cloudscale API
77+
+
78+
[source,bash]
79+
----
80+
response=$(curl -sH"Authorization: Bearer ${CLOUDSCALE_API_TOKEN}" \
81+
https://api.cloudscale.ch/v1/networks \
82+
-F name="privnet_${CLUSTER_ID}" \
83+
-F zone="${REGION}1" \
84+
-F mtu=9000 \
85+
-F auto_create_ipv4_subnet=false)
86+
export NETWORK_UUID=$(echo "$response" | jq -r '.uuid')
87+
----
88+
89+
. Create a subnet in the private network via cloudscale API
90+
+
91+
[TIP]
92+
====
93+
Customize `PRIVNET_CIDR` if you want to use a different CIDR for the cluster.
94+
95+
Use a custom value for `GATEWAY_ADDR` if you don't want to use `.1` in the configured network CIDR for the default gateway.
96+
====
97+
+
98+
[source,bash]
99+
----
100+
PRIVNET_CIDR="172.18.200.0/24"
101+
102+
GATEWAY_ADDR=$(python -c \
103+
"import ipaddress; print(next(ipaddress.ip_network(\"${PRIVNET_CIDR}\").hosts()))")
104+
105+
response=$(curl -sH"Authorization: Bearer ${CLOUDSCALE_API_TOKEN}" \
106+
https://api.cloudscale.ch/v1/subnets \
107+
-F network="${NETWORK_UUID}" \
108+
-F cidr="${PRIVNET_CIDR}" \
109+
-F gateway_address="${GATEWAY_ADDR}")
110+
export SUBNET_UUID=$(echo "$response" | jq -r '.uuid')
111+
----
112+
113+
. Create a floating IP to use as the NAT source IP via cloudscale API
114+
+
115+
[source,bash]
116+
----
117+
TBD if actually possible
118+
----
119+
120+
. Ask cloudscale to provision a NAT gateway via chat.
121+
Run the command and provide the output with your request.
122+
+
123+
[source]
124+
----
125+
cat <<EOF
126+
---
127+
Network UUID: ${NETWORK_UUID}
128+
Subnet UUID: ${SUBNET_UUID}
129+
Nat Gateway Name: natgw_${CLUSTER_ID}
130+
Gateway IP: ${GATEWAY_ADDR}
131+
NAT source IP: TBD if possible
132+
---
133+
EOF
134+
----
135+
73136
[#_bootstrap_bucket]
74137
=== Set up S3 buckets for the cluster
75138

@@ -257,10 +320,6 @@ vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/cloudscale \
257320
s3_access_key=$(mc config host ls ${CLUSTER_ID} -json | jq -r .accessKey) \
258321
s3_secret_key=$(mc config host ls ${CLUSTER_ID} -json | jq -r .secretKey)
259322
260-
# Put LB API key in Vault
261-
vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/floaty \
262-
iam_secret=${TF_VAR_lb_cloudscale_api_secret}
263-
264323
# Generate an HTTP secret for the registry
265324
vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/registry \
266325
httpSecret=$(LC_ALL=C tr -cd "A-Za-z0-9" </dev/urandom | head -c 128)
@@ -274,8 +333,6 @@ vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/cluster-backup \
274333
password=$(LC_ALL=C tr -cd "A-Za-z0-9" </dev/urandom | head -c 32)
275334
----
276335

277-
include::partial$get-hieradata-token-from-vault.adoc[]
278-
279336
include::partial$install/prepare-commodore.adoc[]
280337

281338
[#_configure_installer]
@@ -309,53 +366,6 @@ include::partial$cloudscale/configure-terraform-secrets.adoc[]
309366

310367
include::partial$setup_terraform.adoc[]
311368

312-
. Create LB hieradata
313-
+
314-
[source,bash]
315-
----
316-
cat > override.tf <<EOF
317-
module "cluster" {
318-
bootstrap_count = 0
319-
master_count = 0
320-
infra_count = 0
321-
worker_count = 0
322-
additional_worker_groups = {}
323-
}
324-
EOF
325-
terraform apply -target "module.cluster.module.lb.module.hiera"
326-
----
327-
328-
. Review and merge the LB hieradata MR (listed in Terraform output `hieradata_mr`) and wait until the deploy pipeline after the merge is completed.
329-
330-
. Create LBs
331-
+
332-
[source,bash]
333-
----
334-
terraform apply
335-
----
336-
337-
. Setup the DNS records shown in output variable `dns_entries` from the previous step in the cluster's parent zone.
338-
If you use a custom apps domain, make the necessary changes to the DNS record for `*.apps`.
339-
340-
. Make LB FQDNs available for later steps
341-
+
342-
.Store LB FQDNs in environment
343-
[source,bash]
344-
----
345-
declare -a LB_FQDNS
346-
for id in 1 2; do
347-
LB_FQDNS[$id]=$(terraform state show "module.cluster.module.lb.cloudscale_server.lb[$(expr $id - 1)]" | grep fqdn | awk '{print $2}' | tr -d ' "\r\n')
348-
done
349-
----
350-
+
351-
.Verify FQDNs
352-
[source,bash]
353-
----
354-
for lb in "${LB_FQDNS[@]}"; do echo $lb; done
355-
----
356-
357-
include::partial$install/bootstrap-lb.adoc[]
358-
359369
include::partial$install/bootstrap-nodes.adoc[]
360370

361371
include::partial$install/finalize_part1.adoc[]

docs/modules/ROOT/partials/cloudscale/configure-terraform-secrets.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@
55
cat <<EOF > ./terraform.env
66
CLOUDSCALE_API_TOKEN
77
TF_VAR_ignition_bootstrap
8-
TF_VAR_lb_cloudscale_api_secret
9-
TF_VAR_control_vshn_net_token
10-
GIT_AUTHOR_NAME
11-
GIT_AUTHOR_EMAIL
12-
HIERADATA_REPO_TOKEN
138
EOF
149
----

docs/modules/ROOT/partials/install/bootstrap-nodes.adoc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
. Deploy bootstrap node
32
+
43
[source,bash,subs="attributes+"]
@@ -18,7 +17,10 @@ EOF
1817
terraform apply
1918
----
2019

21-
ifeval::["{provider}" != "stackit"]
20+
ifeval::["{provider}" == "cloudscale"]
21+
. Setup the DNS records shown in Terraform output `cluster_dns`
22+
endif::[]
23+
ifeval::["{provider}" == "exoscale"]
2224
. Review and merge the LB hieradata MR (listed in Terraform output `hieradata_mr`) and run Puppet on the LBs after the deploy job has completed
2325
+
2426
[source,bash]
@@ -37,21 +39,18 @@ ifeval::["{provider}" == "stackit"]
3739
--
3840
endif::[]
3941
ifeval::["{provider}" == "cloudscale"]
40-
. Store the subnet UUID and ingress floating IP in the cluster configuration
42+
. Store the ingress floating IP in the cluster configuration
4143
+
4244
[source,bash]
4345
----
44-
export SUBNET_UUID="$(terraform output -raw subnet_uuid)"
4546
export INGRESS_FLOATING_IP="$(terraform output -raw router_vip)"
4647

4748
pushd ../../../inventory/classes/${TENANT_ID}
4849

49-
yq eval -i '.parameters.openshift.cloudscale.subnet_uuid = "'$SUBNET_UUID'"' \
50-
${CLUSTER_ID}.yml
5150
yq eval -i '.parameters.openshift.cloudscale.ingress_floating_ip_v4 = "'$INGRESS_FLOATING_IP'"' \
5251
${CLUSTER_ID}.yml
5352

54-
git commit -am "Configure cloudscale subnet UUID and ingress floating IP for ${CLUSTER_ID}"
53+
git commit -am "Configure cloudscale ingress floating IP for ${CLUSTER_ID}"
5554
git push
5655
popd
5756
popd # yes, twice.
@@ -148,10 +147,6 @@ EOF
148147
terraform apply
149148
----
150149

151-
ifeval::["{provider}" == "cloudscale"]
152-
. Add the DNS records for etcd shown in output variable `dns_entries` from the previous step to the cluster's parent zone
153-
endif::[]
154-
155150
. Wait for master nodes to become ready
156151
+
157152
TIP: This is optional, but will make the subsequent steps less likely to run into weird timeouts.
@@ -260,7 +255,7 @@ terraform apply
260255
popd
261256
----
262257

263-
ifeval::["{provider}" != "stackit"]
258+
ifeval::["{provider}" == "exoscale"]
264259
. Review and merge the LB hieradata MR (listed in Terraform output `hieradata_mr`) and run Puppet on the LBs after the deploy job has completed
265260
+
266261
[source,bash]

docs/modules/ROOT/partials/install/finalize_part2.adoc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
=== Finalize installation
22

3-
ifeval::["{provider}" == "cloudscale"]
4-
include::partial$install/finalize_part2_cloudscale_exoscale.adoc[]
5-
endif::[]
63
ifeval::["{provider}" == "exoscale"]
74
include::partial$install/finalize_part2_cloudscale_exoscale.adoc[]
85
endif::[]
File renamed without changes.

docs/modules/ROOT/partials/install/prepare-commodore.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ifeval::["{provider}" == "cloudscale"]
6969
+
7070
[source,bash,subs="attributes"]
7171
----
72-
yq eval -i '.parameters.openshift.cloudscale.subnet_uuid = "TO_BE_DEFINED"' ${CLUSTER_ID}.yml
72+
yq eval -i '.parameters.openshift.cloudscale.subnet_uuid = "'"${SUBNET_UUID}"'"' ${CLUSTER_ID}.yml
7373

7474
yq eval -i '.parameters.openshift.cloudscale.rhcos_image_slug = "rhcos-{ocp-minor-version}"' \
7575
${CLUSTER_ID}.yml

docs/modules/ROOT/partials/install/prepare-syn-config-terraform.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ifeval::["{provider}" != "cloudscale"]
12
. Set team responsible for handling Icinga alerts
23
+
34
[source,bash]
@@ -6,6 +7,7 @@
67
# e.g. TEAM=aldebaran
78
TEAM=<team-name>
89
----
10+
endif::[]
911

1012
. Prepare Terraform cluster config
1113
+
@@ -32,9 +34,12 @@ yq eval -i ".parameters.openshift4_terraform.terraform_variables.ssh_keys = [\"$
3234

3335
yq eval -i ".parameters.openshift4_terraform.terraform_variables.allocate_router_vip_for_lb_controller = true" \
3436
${CLUSTER_ID}.yml
37+
38+
yq eval -i ".parameters.openshift4_terraform.terraform_variables.subnet_uuid = \"${SUBNET_UUID}\"" \
39+
${CLUSTER_ID}.yml
3540
endif::[]
3641

37-
ifeval::["{provider}" != "stackit"]
42+
ifeval::["{provider}" == "exoscale"]
3843
yq eval -i ".parameters.openshift4_terraform.terraform_variables.team = \"${TEAM}\"" \
3944
${CLUSTER_ID}.yml
4045

docs/modules/ROOT/partials/install/prepare-syn-config.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ yq eval -i ".parameters.openshift.appsDomain = \"${APPS_DOMAIN}\"" \
5656
By default, the cluster's update channel is derived from the cluster's reported OpenShift version.
5757
If you want to use a custom update channel, make sure to set `parameters.openshift4_version.spec.channel` accordingly.
5858
59-
[source,bash]
59+
[source,bash,subs="attributes+"]
6060
----
6161
# Configure the OpenShift update channel as `fast`
62-
yq eval -i ".parameters.openshift4_version.spec.channel = \"fast-{ocp-minor-version}\"" \
62+
yq eval -i \
63+
".parameters.openshift_upgrade_controller.cluster_version.spec.template.spec.channel = \"fast-{ocp-minor-version}\"" \
6364
${CLUSTER_ID}.yml
6465
----
6566
====

0 commit comments

Comments
 (0)