Skip to content

Commit b5c15d3

Browse files
committed
Scaleway auth in entrypoint and explicit provider config
1 parent 46ed2d5 commit b5c15d3

8 files changed

Lines changed: 67 additions & 14 deletions

File tree

.github/workflows/main.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
needs: [build-test-artifacts]
5555
strategy:
5656
matrix:
57-
starter: ["multi-cloud", "aks", "eks", "gke"]
57+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
5858

5959
permissions:
6060
id-token: write # required for keyless signing
@@ -117,7 +117,7 @@ jobs:
117117
strategy:
118118
fail-fast: false
119119
matrix:
120-
starter: ["multi-cloud", "aks", "eks", "gke"]
120+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
121121

122122
steps:
123123
- name: "Download test-artifacts"
@@ -211,6 +211,15 @@ jobs:
211211
# SCW: set zones
212212
sed -i 's/# zones = \["fr-par-1", "fr-par-2", "fr-par-3"\]/zones = ["fr-par-1", "fr-par-2", "fr-par-3"]/g' scw_zero_cluster.tf || true
213213
214+
# SCW: set organization_id
215+
sed -i 's/organization_id = ""/organization_id = "c3d17bc8-d7a3-48ac-b6e2-d8135e76ceb7"/g' scw_zero_providers.tf || true
216+
217+
# SCW: set project_id
218+
sed -i 's/project_id = ""/project_id = "b2bf9427-9ca5-4320-9fb3-ea9a33451338"/g' scw_zero_providers.tf || true
219+
220+
# SCW: set provider region
221+
sed -i 's/region = ""/region = "fr-par"/g' scw_zero_providers.tf || true
222+
214223
- name: "OpenTofu init"
215224
working-directory: ./kubestack-starter-${{ matrix.starter }}
216225
run: |
@@ -241,23 +250,25 @@ jobs:
241250
KBST_AUTH_AWS: ${{ secrets.KBST_AUTH_AWS }}
242251
KBST_AUTH_AZ: ${{ secrets.KBST_AUTH_AZ }}
243252
KBST_AUTH_GCLOUD: ${{ secrets.KBST_AUTH_GCLOUD }}
253+
KBST_AUTH_SCW: ${{ secrets.KBST_AUTH_SCW }}
244254
run: |
245255
docker run --rm \
246256
-e KBST_AUTH_AWS \
247257
-e KBST_AUTH_AZ \
248258
-e KBST_AUTH_GCLOUD \
259+
-e KBST_AUTH_SCW \
249260
-v `pwd`:/infra \
250261
-v /var/run/docker.sock:/var/run/docker.sock \
251262
test-image:${{ github.sha }} \
252-
tofu plan --target module.aks_zero --target module.eks_zero --target module.gke_zero
263+
tofu plan --target module.aks_zero --target module.eks_zero --target module.gke_zero --target module.scw_zero
253264
254265
publish-image:
255266
runs-on: ubuntu-latest
256267
needs: [test]
257268

258269
strategy:
259270
matrix:
260-
starter: ["multi-cloud", "aks", "eks", "gke"]
271+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
261272

262273
steps:
263274
- name: "Download test-artifacts"
@@ -304,7 +315,7 @@ jobs:
304315

305316
strategy:
306317
matrix:
307-
starter: ["multi-cloud", "aks", "eks", "gke"]
318+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
308319

309320
steps:
310321
- name: "Download test-artifacts"

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ Node-pool modules MUST additionally expose a configuration attribute for Kuberne
173173
- Region, zones, instance type, and `min`/`max` node counts MUST be exposed as required configuration attributes in every module, using provider-specific attribute names. Modules MUST NOT set defaults for these values.
174174
- All configuration attribute names SHOULD mirror the respective provider resource attribute names.
175175
- Provider resource blocks containing nested arguments SHOULD be reflected as nested configuration object attributes.
176+
- Scope-defining attributes — including but not limited to account, project, organization, subscription, and region — MUST always be specified explicitly in code, either on the provider block or as a module configuration attribute, following the best practice for the respective cloud provider. They MUST NOT be left implicit so that they are inferred from CLI defaults, environment variables, or the active authentication context. This ensures the intended scope of every cluster is unambiguous, auditable, and reproducible regardless of the local environment running the plan.
176177

177178
## Repository and Module Layout
178179

oci/entrypoint_user

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,25 @@ if [ -x "$(command -v gcloud)" ]; then
5757
fi
5858
fi
5959

60+
#
61+
#
62+
# Scaleway auth
63+
# only if scw cli is installed
64+
if [ -x "$(command -v scw)" ]; then
65+
SCW_CONFIG_PATH=~/.config/scw
66+
mkdir -p $SCW_CONFIG_PATH
67+
68+
# handle base64 encoded SCW credentials
69+
if [ ! -z "$KBST_AUTH_SCW" ]; then
70+
echo "$KBST_AUTH_SCW" | base64 --decode > $SCW_CONFIG_PATH/config.yaml
71+
scw config validate
72+
fi
73+
fi
74+
6075
# do not have KBST_AUTH_* env vars set in runtime env
6176
unset KBST_AUTH_AWS
6277
unset KBST_AUTH_AZ
6378
unset KBST_AUTH_GCLOUD
79+
unset KBST_AUTH_SCW
6480

6581
exec "$@"

quickstart/src/configurations/multi-cloud/scw_zero_cluster.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ module "scw_zero" {
2222
# region = "fr-par"
2323

2424
# Kubernetes version for the cluster
25-
# Use a minor version string to allow patch upgrades, e.g. "1.32"
26-
cluster_version = "1.32"
25+
# Use a minor version string to allow patch upgrades, e.g. "1.35"
26+
cluster_version = "1.35"
2727

2828
# Container Network Interface plugin
2929
# Options: "cilium", "calico", "weave", "flannel", "kilo"
@@ -39,6 +39,13 @@ module "scw_zero" {
3939
# Commercial node type — see `scw k8s node-pool list-available-types`
4040
node_type = "DEV1-M"
4141

42+
# Availability zones to distribute the default node pool across.
43+
# One pool is created per zone. Must be explicitly specified.
44+
# fr-par: zones = ["fr-par-1", "fr-par-2", "fr-par-3"]
45+
# nl-ams: zones = ["nl-ams-1", "nl-ams-2", "nl-ams-3"]
46+
# pl-waw: zones = ["pl-waw-1", "pl-waw-2", "pl-waw-3"]
47+
# zones = ["fr-par-1", "fr-par-2", "fr-par-3"]
48+
4249
# Initial number of nodes in the pool
4350
size = 1
4451

quickstart/src/configurations/multi-cloud/scw_zero_providers.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
provider "scaleway" {
2-
# region is read from SCW_DEFAULT_REGION environment variable
3-
# or can be set explicitly, e.g.:
4-
# region = "fr-par"
2+
# The Scaleway provider requires organization_id and project_id to be set
3+
# explicitly so the target scope is captured in IaC rather than inferred
4+
# from the CLI config or SCW_DEFAULT_ORGANIZATION_ID / SCW_DEFAULT_PROJECT_ID
5+
# environment variables.
6+
organization_id = ""
7+
project_id = ""
8+
9+
# Region is also required. Set it to match the region configured in the
10+
# cluster module, e.g. "fr-par", "nl-ams", "pl-waw".
11+
region = ""
512
}
613

714
provider "kustomization" {

quickstart/src/configurations/scw/scw_zero_cluster.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ module "scw_zero" {
2121
# Uncomment and set to your target region, e.g:
2222
# region = "fr-par"
2323

24+
# Kubernetes version for the cluster
25+
# Use a minor version string to allow patch upgrades, e.g. "1.35"
26+
cluster_version = "1.35"
27+
2428
default_node_pool = {
2529
# Commercial node type — must be available in every zone listed below.
2630
# Run `scw k8s node-pool list-available-types` to list types per zone.

quickstart/src/configurations/scw/scw_zero_providers.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
provider "scaleway" {
2-
# region is read from SCW_DEFAULT_REGION environment variable
3-
# or can be set explicitly, e.g.:
4-
# region = "fr-par"
2+
# The Scaleway provider requires organization_id and project_id to be set
3+
# explicitly so the target scope is captured in IaC rather than inferred
4+
# from the CLI config or SCW_DEFAULT_ORGANIZATION_ID / SCW_DEFAULT_PROJECT_ID
5+
# environment variables.
6+
organization_id = ""
7+
project_id = ""
8+
9+
# Region is also required. Set it to match the region configured in the
10+
# cluster module, e.g. "fr-par", "nl-ams", "pl-waw".
11+
region = ""
512
}
613

714
provider "kustomization" {

tests/scw_zero_cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module "scw_zero" {
99

1010
region = "nl-ams"
1111

12-
cluster_version = "1.34"
12+
cluster_version = "1.35"
1313
cni = "cilium"
1414

1515
delete_additional_resources = false

0 commit comments

Comments
 (0)