Skip to content

Commit e77d367

Browse files
committed
Draft: Update cloudscale instructions for no-puppet install
1 parent 319da6b commit e77d367

File tree

6 files changed

+85
-76
lines changed

6 files changed

+85
-76
lines changed

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

Lines changed: 71 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,17 +55,84 @@ 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[]
6667

68+
.Read cloudscale region from Project Syn cluster
69+
[source,bash]
70+
----
71+
export REGION=$(curl -sH "Authorization: Bearer $(commodore fetch-token)" ${COMMODORE_API_URL}/clusters/${CLUSTER_ID} | jq -r .facts.region)
72+
----
73+
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 details:
128+
129+
Private network UUID: ${NETWORK_UUID}
130+
Subnet UUID: ${SUBNET_UUID}
131+
SNAT VIP: TBD
132+
---
133+
EOF
134+
----
135+
67136
[#_bootstrap_bucket]
68137
=== Set up S3 buckets for the cluster
69138

@@ -253,10 +322,6 @@ vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/cloudscale \
253322
s3_access_key=$(mc config host ls ${CLUSTER_ID} -json | jq -r .accessKey) \
254323
s3_secret_key=$(mc config host ls ${CLUSTER_ID} -json | jq -r .secretKey)
255324
256-
# Put LB API key in Vault
257-
vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/floaty \
258-
iam_secret=${TF_VAR_lb_cloudscale_api_secret}
259-
260325
# Generate an HTTP secret for the registry
261326
vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/registry \
262327
httpSecret=$(LC_ALL=C tr -cd "A-Za-z0-9" </dev/urandom | head -c 128)
@@ -270,8 +335,6 @@ vault kv put clusters/kv/${TENANT_ID}/${CLUSTER_ID}/cluster-backup \
270335
password=$(LC_ALL=C tr -cd "A-Za-z0-9" </dev/urandom | head -c 32)
271336
----
272337

273-
include::partial$get-hieradata-token-from-vault.adoc[]
274-
275338
include::partial$install/prepare-commodore.adoc[]
276339

277340
[#_configure_installer]
@@ -305,53 +368,6 @@ include::partial$cloudscale/configure-terraform-secrets.adoc[]
305368

306369
include::partial$setup_terraform.adoc[]
307370

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

357373
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: 4 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,7 @@ EOF
1817
terraform apply
1918
----
2019

21-
ifeval::["{provider}" != "stackit"]
20+
ifeval::["{provider}" == "exoscale"]
2221
. 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
2322
+
2423
[source,bash]
@@ -37,21 +36,18 @@ ifeval::["{provider}" == "stackit"]
3736
--
3837
endif::[]
3938
ifeval::["{provider}" == "cloudscale"]
40-
. Store the subnet UUID and ingress floating IP in the cluster configuration
39+
. Store the ingress floating IP in the cluster configuration
4140
+
4241
[source,bash]
4342
----
44-
export SUBNET_UUID="$(terraform output -raw subnet_uuid)"
4543
export INGRESS_FLOATING_IP="$(terraform output -raw router_vip)"
4644

4745
pushd ../../../inventory/classes/${TENANT_ID}
4846

49-
yq eval -i '.parameters.openshift.cloudscale.subnet_uuid = "'$SUBNET_UUID'"' \
50-
${CLUSTER_ID}.yml
5147
yq eval -i '.parameters.openshift.cloudscale.ingress_floating_ip_v4 = "'$INGRESS_FLOATING_IP'"' \
5248
${CLUSTER_ID}.yml
5349

54-
git commit -am "Configure cloudscale subnet UUID and ingress floating IP for ${CLUSTER_ID}"
50+
git commit -am "Configure cloudscale ingress floating IP for ${CLUSTER_ID}"
5551
git push
5652
popd
5753
popd # yes, twice.
@@ -148,10 +144,6 @@ EOF
148144
terraform apply
149145
----
150146

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-
155147
. Wait for master nodes to become ready
156148
+
157149
TIP: This is optional, but will make the subsequent steps less likely to run into weird timeouts.
@@ -260,7 +252,7 @@ terraform apply
260252
popd
261253
----
262254

263-
ifeval::["{provider}" != "stackit"]
255+
ifeval::["{provider}" == "exoscale"]
264256
. 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
265257
+
266258
[source,bash]

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)