Skip to content

Commit 3134a95

Browse files
committed
Add Scaleway Kapsule module
1 parent 0d2d2b5 commit 3134a95

31 files changed

Lines changed: 764 additions & 1 deletion

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ validate: .init
6262
test: validate
6363
docker exec \
6464
test-container-$(GIT_SHA) \
65-
entrypoint tofu apply --target module.aks_zero --target module.eks_zero --target module.gke_zero --input=false --auto-approve
65+
entrypoint tofu apply --target module.aks_zero --target module.eks_zero --target module.gke_zero --target module.scw_zero --input=false --auto-approve
6666
docker exec \
6767
test-container-$(GIT_SHA) \
6868
entrypoint tofu apply --target module.eks_zero_nginx --input=false --auto-approve
@@ -95,6 +95,7 @@ shell: .check-container
9595
-e KBST_AUTH_AWS \
9696
-e KBST_AUTH_AZ \
9797
-e KBST_AUTH_GCLOUD \
98+
-e KBST_AUTH_SCW \
9899
-e HOME=/infra/tests/.user \
99100
--workdir /infra/tests \
100101
ghcr.io/kbst/terraform-kubestack/dev:test-$(GIT_SHA)-${DOCKER_TARGET} \

oci/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,23 @@ RUN echo "GOOGLE_CLOUD_SDK_VERSION: ${GOOGLE_CLOUD_SDK_VERSION}" \
9797
RUN /opt/google/bin/gcloud components install gke-gcloud-auth-plugin
9898

9999

100+
#
101+
#
102+
# Scaleway builder
103+
FROM builder AS scw-builder
104+
105+
ARG TARGETARCH
106+
107+
# https://github.com/scaleway/scaleway-cli/releases
108+
ARG SCALEWAY_CLI_VERSION=2.35.0
109+
110+
RUN echo "SCALEWAY_CLI_VERSION: ${SCALEWAY_CLI_VERSION}" \
111+
&& curl -LO https://github.com/scaleway/scaleway-cli/releases/download/v${SCALEWAY_CLI_VERSION}/scaleway-cli_${SCALEWAY_CLI_VERSION}_linux_${TARGETARCH} \
112+
&& mv scaleway-cli_${SCALEWAY_CLI_VERSION}_linux_${TARGETARCH} /opt/bin/scw \
113+
&& chmod +x /opt/bin/scw \
114+
&& /opt/bin/scw version
115+
116+
100117
#
101118
#
102119
# Azure builder
@@ -231,6 +248,15 @@ COPY --from=azure-builder /opt/azure /opt/azure
231248
ENV PATH=$PATH:/opt/azure/bin
232249

233250

251+
#
252+
#
253+
# Scaleway variant
254+
FROM final-base AS scw
255+
256+
# Scaleway
257+
COPY --from=scw-builder /opt/bin/scw /opt/bin/scw
258+
259+
234260
#
235261
#
236262
# Default (multi-cloud) variant
@@ -247,3 +273,6 @@ ENV PATH=$PATH:/opt/google/bin
247273
# Azure
248274
COPY --from=azure-builder /opt/azure /opt/azure
249275
ENV PATH=$PATH:/opt/azure/bin
276+
277+
# Scaleway
278+
COPY --from=scw-builder /opt/bin/scw /opt/bin/scw

quickstart/src/configurations/_shared/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ In case of the automation being unavailable, upgrades requiring manual steps or
111111
# for GCP
112112
gcloud init
113113
gcloud auth application-default login
114+
115+
# for Scaleway
116+
scw init
114117
```
115118

116119
1. Select desired environment
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
module "scw_zero" {
2+
source = "github.com/kbst/terraform-kubestack//scaleway/cluster?ref={{version}}"
3+
4+
configuration = {
5+
# apps environment
6+
apps = {
7+
# Set name_prefix used to generate the cluster name
8+
# [name_prefix]-[workspace]-[region]
9+
# e.g. name_prefix = kbst becomes: `kbst-apps-fr-par`
10+
# for small orgs the name works well,
11+
# for bigger orgs consider department or team names
12+
name_prefix = ""
13+
14+
# Set the base_domain used to generate the FQDN of the cluster
15+
# [cluster_name].[provider_name].[base_domain]
16+
# e.g. kbst-apps-fr-par.scw.infra.example.com
17+
# The domain must be registered with Scaleway Domains and DNS
18+
base_domain = ""
19+
20+
# The Scaleway region to deploy the clusters in
21+
# e.g. "fr-par", "nl-ams", "pl-waw"
22+
region = ""
23+
24+
# Kubernetes version for the cluster
25+
# Use a minor version string to allow patch upgrades, e.g. "1.32"
26+
cluster_version = "1.32"
27+
28+
# Container Network Interface plugin
29+
# Options: "cilium", "calico", "weave", "flannel", "kilo"
30+
cni = "cilium"
31+
32+
# Whether to delete additional resources (load-balancers, block volumes,
33+
# the private network if empty) created in Kubernetes when deleting the cluster.
34+
# Set to true only if you want these resources cleaned up automatically on destroy.
35+
delete_additional_resources = false
36+
37+
# Default node pool configuration
38+
default_node_pool = {
39+
# Commercial node type — see `scw k8s node-pool list-available-types`
40+
node_type = "DEV1-M"
41+
42+
# Initial number of nodes in the pool
43+
size = 1
44+
45+
# Minimum and maximum size for autoscaling
46+
min_size = 1
47+
max_size = 1
48+
49+
# Enable Scaleway's cluster autoscaler for this pool
50+
autoscaling = false
51+
52+
# Enable automatic node replacement on failure
53+
autohealing = true
54+
}
55+
}
56+
57+
# ops environment, inherits from apps
58+
ops = {}
59+
}
60+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
provider "scaleway" {
2+
# region is read from SCW_DEFAULT_REGION environment variable
3+
# or can be set explicitly, e.g.:
4+
# region = "fr-par"
5+
}
6+
7+
provider "kustomization" {
8+
alias = "scw_zero"
9+
kubeconfig_raw = module.scw_zero.kubeconfig
10+
}
11+
12+
locals {
13+
scw_zero_kubeconfig = yamldecode(module.scw_zero.kubeconfig)
14+
}
15+
16+
provider "kubernetes" {
17+
alias = "scw_zero"
18+
19+
host = local.scw_zero_kubeconfig["clusters"][0]["cluster"]["server"]
20+
token = local.scw_zero_kubeconfig["users"][0]["user"]["token"]
21+
cluster_ca_certificate = base64decode(
22+
local.scw_zero_kubeconfig["clusters"][0]["cluster"]["certificate-authority-data"]
23+
)
24+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ terraform {
77
kustomization = {
88
source = "kbst/kustomization"
99
}
10+
11+
scaleway = {
12+
source = "scaleway/scaleway"
13+
}
1014
}
1115

1216
required_version = ">= 0.15"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/tpl_gitignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/.user/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM {{image_name}}:{{image_tag}}-scw
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM {{image_name}}:{{image_tag}}-kind
2+
3+
ARG UID
4+
ARG GID
5+
6+
RUN mkdir -p /infra/terraform.tfstate.d &&\
7+
chown ${UID}:${GID} -R /infra
8+
9+
COPY manifests /infra/manifests
10+
COPY *.tf *.tfvars /infra/

0 commit comments

Comments
 (0)