Skip to content

Commit d3e5f05

Browse files
committed
feat(scs2): Migrate to CAPI v1beta2 with full feature set
Migrate openstack/scs2 and docker/scs2 cluster stacks to CAPI v1beta2: CAPI v1beta2 Migration: - ClusterClass, KubeadmControlPlaneTemplate, KubeadmConfigTemplate -> v1beta2 - Infrastructure resources (CAPO/CAPD) remain v1beta1 (providers not yet v1beta2) - ref -> templateRef, workers template: wrapper removed - extraArgs/kubeletExtraArgs converted from map to list of {name, value} - oidcConfig patches use extraArgs/- (list-append) pattern - apiServer: {} removed (fails minProperties:1, created dynamically by patches) Variable Defaults Consolidation: - All ClusterClass variable defaults moved to values.yaml - Templates reference {{ .Values.variables.* }} instead of hardcoded values - 20+ variables for openstack/scs2, 4 for docker/scs2 New Features: - Registry mirrors: registryMirrors array variable with containerd hosts.toml patches - OIDC authentication: Full oidcConfig variable + 6 apiServer extraArgs patches - certSANs: Extra Subject Alternative Names for API server cert - AfterClusterUpgrade hook: Third lifecycle stage in clusteraddon.yaml Security Hardening: - controller-manager: --profiling=false, --terminated-pod-gc-threshold=100 - scheduler: --profiling=false - etcd: metrics exposed, auto-compaction, tuned election/heartbeat - kube-proxy: metrics on 0.0.0.0:10249 (docker/scs2) docker/scs2 (new stack): - Complete new cluster stack for Docker provider with v1beta2 - Cilium 1.19.0 with Gateway API + SCTP support - metrics-server 3.13.0 - Multi-version build support (versions.yaml: 1.32-1.35) Addon Version Bumps (openstack/scs2): - Cilium 1.18.5 -> 1.19.0 - openstack-cloud-controller-manager 2.34.1 -> 2.34.2 - openstack-cinder-csi 2.34.1 -> 2.34.3 - versions.yaml: key renames (occm/cinder_csi -> full chart names), ubuntu field Documentation: - Rewritten overview.md, configuration.md - New quickstart.mdx (Docusaurus Tabs for provider selection) - New versioning.md, build-system.md - Removed outdated kamaji.md Legacy stacks (minimal): - openstack/scs: ubuntu field added to versions.yaml - docker/scs: imageRepository variable in values.yaml, versions.yaml created Assisted-by: Claude Code Signed-off-by: Jan Schoone <[email protected]>
1 parent 9ff91b7 commit d3e5f05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2177
-916
lines changed

.envrc.example

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
1-
export KUBECONFIG=$PWD/.mgt-cluster-kubeconfig.yaml
1+
# direnv configuration — copy to .envrc and adjust
2+
# The justfile and hack/ scripts also read from .env (dotenv-load)
23

3-
export PATH=$PWD/hack/tools/bin:$PATH
4+
# Cluster stack selection
5+
export PROVIDER=openstack
6+
export CLUSTER_STACK=scs2
47

5-
export PROVIDER=docker
8+
# OCI registry (optional, defaults to ttl.sh for dev builds)
9+
# export OCI_REGISTRY=ghcr.io
10+
# export OCI_REPOSITORY=SovereignCloudStack/cluster-stacks
611

7-
# Versions
8-
export K8S_VERSION=1-27
9-
export CAPI_VERSION=v1.5.1
10-
export CAPD_VERSION=$CAPI_VERSION
12+
# GitHub token for higher API rate limits (optional)
13+
# export GITHUB_TOKEN=ghp_xxx
1114

12-
# Names
13-
export NAMESPACE=scs-cs
14-
export CLUSTER_CLASS_NAME=ferrol
15-
export CLUSTER_NAME=cs-cluster
16-
export CLUSTER_TOPOLOGY=true
17-
18-
# Debugging
19-
export DISABLE_VERSIONCHECK="true"
20-
21-
# Release
22-
export RELEASE_CLUSTER_CLASS=$CLUSTER_CLASS_NAME
23-
export RELEASE_KUBERNETES_VERSION=1-27
15+
# Management cluster (optional, for testing)
16+
# export KUBECONFIG=$PWD/.mgt-cluster-kubeconfig.yaml

docs/build-system.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Build System
2+
3+
The cluster stacks build system uses bash scripts in `hack/` orchestrated by [just](https://github.com/casey/just).
4+
5+
## Prerequisites
6+
7+
**Required tools:**
8+
- `bash`, `helm`, `yq` (mikefarah), `git`, `curl`, `tar`, `jq`
9+
10+
**Optional:**
11+
- `oras` — for OCI registry publishing
12+
- `python3` + `PyYAML` — for `docugen.py` only
13+
- `just` — task runner (scripts also work standalone)
14+
15+
**Nix dev shell (recommended):**
16+
```bash
17+
# Enter the development environment with all tools
18+
nix develop
19+
```
20+
21+
**Container alternative:**
22+
```bash
23+
# Build the tools container
24+
just container-build
25+
26+
# Run any command inside
27+
just container-run build-all
28+
```
29+
30+
## Configuration
31+
32+
Copy `task.env.example` to `.env` and set your provider/stack:
33+
34+
```bash
35+
PROVIDER=openstack # or: docker
36+
CLUSTER_STACK=scs2 # or: scs
37+
OCI_REGISTRY=ghcr.io # for publishing
38+
OCI_REPOSITORY=myorg/cluster-stacks
39+
```
40+
41+
The `justfile` uses `set dotenv-load` to automatically read `.env`.
42+
43+
## Commands
44+
45+
### Building
46+
47+
| Command | Description |
48+
|---------|-------------|
49+
| `just build 1.34` | Build for one K8s version |
50+
| `just build-all` | Build for all versions in versions.yaml |
51+
| `just publish 1.34` | Build + publish to OCI registry |
52+
| `just publish-all` | Build + publish all versions |
53+
| `just clean` | Clean `.release/` and output directories |
54+
55+
The build system:
56+
1. Copies the cluster-class chart, patches `Chart.yaml` with the correct version
57+
2. For each addon in `cluster-addon/`, resolves the version from `versions.yaml` and patches the addon's `Chart.yaml`
58+
3. Runs `helm package` for each chart
59+
4. Bundles everything into a release artifact
60+
5. Optionally publishes to an OCI registry via `oras push`
61+
62+
### Version Management
63+
64+
| Command | Description |
65+
|---------|-------------|
66+
| `just update-versions --check` | Check for K8s patch updates, new minors, and addon bumps |
67+
| `just update-versions --apply` | Apply all updates to `versions.yaml` |
68+
| `just update-versions-all --check` | Check for updates across all stacks |
69+
70+
`update-versions` fetches the latest Kubernetes releases from GitHub tags and queries
71+
Helm repo indexes for K8s-tied addon versions (e.g., CCM, CSI). It automatically:
72+
- Bumps patch versions for existing K8s minors
73+
- Adds new K8s minor versions (with correct Ubuntu image mapping)
74+
- Removes EOL minor versions (keeps the 4 most recent)
75+
76+
Set `GITHUB_TOKEN` for higher API rate limits in CI (optional, 60 req/h without).
77+
78+
### Addon Management
79+
80+
| Command | Description |
81+
|---------|-------------|
82+
| `just update-addons` | Interactive: check upstream Helm repos for new versions |
83+
| `just update-addons --yes` | Auto-approve all updates |
84+
| `just update-addons-all` | Update addons for all providers/stacks |
85+
86+
`update-addons` reads the Helm repository URLs from each addon's `Chart.yaml`, queries for new versions, and updates both `Chart.yaml` and `versions.yaml` (for K8s-version-tied addons).
87+
88+
### Utilities
89+
90+
| Command | Description |
91+
|---------|-------------|
92+
| `just matrix` | Show version matrix (K8s versions, addon versions, CS versions) |
93+
| `just generate-resources 1.34` | Generate ClusterStack + Cluster YAML for testing |
94+
| `just generate-image-manifests` | Generate OpenStack Image CRD manifests |
95+
| `just generate-docs` | Generate configuration docs from ClusterClass variables |
96+
97+
### Provider Shortcuts
98+
99+
Override the default provider/stack for any command:
100+
101+
```bash
102+
PROVIDER=docker CLUSTER_STACK=scs2 just build-all
103+
```
104+
105+
## Scripts Reference
106+
107+
All scripts in `hack/` take the stack directory as the first argument:
108+
109+
```bash
110+
# Direct invocation (without just)
111+
./hack/build.sh providers/openstack/scs2 --version 1.34
112+
./hack/build.sh providers/openstack/scs2 --version 1.34 --publish
113+
./hack/build.sh providers/openstack/scs2 --all
114+
./hack/update-versions.sh providers/openstack/scs2 --check
115+
./hack/update-versions.sh providers/openstack/scs2 --apply
116+
./hack/update-addons.sh providers/openstack/scs2
117+
./hack/update-addons.sh providers/openstack/scs2 --yes
118+
./hack/show-matrix.sh providers/openstack/scs2
119+
./hack/generate-resources.sh providers/openstack/scs2 --version 1.34
120+
./hack/generate-image-manifests.sh providers/openstack/scs2
121+
```
122+
123+
## Linting
124+
125+
```bash
126+
yamllint .
127+
```
128+
129+
Configuration: `.yamllint.yml` — line-length disabled, Helm templates excluded. This is enforced in CI.
130+
131+
## Helm Template Validation
132+
133+
You can validate rendered templates locally:
134+
135+
```bash
136+
# Render the chart
137+
helm template test providers/openstack/scs2/cluster-class/
138+
139+
# Validate against CRD schemas (requires kubeconform)
140+
helm template test providers/openstack/scs2/cluster-class/ | kubeconform -summary -strict \
141+
-schema-location default \
142+
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json'
143+
```

0 commit comments

Comments
 (0)