Skip to content

Commit 2f84b0a

Browse files
authored
Merge branch 'project-bootstrap' into trial/coredns-rock
2 parents ad89e4f + c3c2616 commit 2f84b0a

36 files changed

+1291
-679
lines changed

.github/ARCHITECTURE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ cluster provisioning, component installation, and test execution.
6262
6363
┌──────────────▼──────────────────────────────────────┐
6464
│ 5. Execute Tests (run-spread-tests) │
65-
│ • Identify components with use-spread: true │
65+
│ • Identify components with test: true │
6666
│ • Clone component repos │
6767
│ • Run spread tests from component spread.yaml │
6868
│ • Collect and report results │
@@ -123,14 +123,14 @@ Components use this to download/build for the correct architecture.
123123

124124
**Steps**:
125125
1. Install spread testing framework
126-
2. Scan manifest for use-spread components
126+
2. Scan manifest for test components
127127
3. Clone component repos
128128
4. Execute spread tests
129129
5. Collect artifacts
130130

131131
**Key Features**:
132132
- Tests come from components and local tests/
133-
- Scans for use-spread: true in components
133+
- Scans for test: true in components
134134
- Reports results and failures
135135
- Preserves test artifacts
136136

.github/copilot-instructions.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Scalable Kubernetes testing infrastructure that validates custom-built component
77

88
**Manifest-Driven Design** - YAML cluster configurations:
99
- Define K8s version, node counts, networking, and component versions/sources
10-
- Components specify repo URL, release tag, format (Binary|Container|Binary+Container), and `use-spread` flag (component provides tests)
10+
- Components specify repo URL, release tag, format (Binary|Container|Binary+Container), and `test` flag (component provides tests)
1111
- 4 baseline manifests targeting K8s 1.33, 1.34, 1.35, 1.36 with 30+ components each (containerd, etcd, coredns, kube-* etc.)
1212

1313
**Python CLI Framework** - Cross-platform testing:
1414
- `kube-galaxy` CLI with command routing and automatic manifest discovery
1515
- `pkg/cluster/setup.py`: Manifest-based provisioning via kubeadm (not container shortcuts)
16-
- `pkg/testing/spread.py`: Executes spread tests from components marked `use-spread: true`
16+
- `pkg/testing/spread.py`: Executes spread tests from components marked `test: true`
1717
- `pkg/utils/logs.py`: Log collection and debugging utilities
1818
- Library utilities for arch detection, YAML manifest parsing, component installation
1919

@@ -42,25 +42,28 @@ components:
4242
- name: containerd # Component identifier
4343
category: containerd # Organizational
4444
release: "2.2.1" # Git tag or branch
45-
repo: "https://github.com/..." # Fetch source
45+
repo: # Repository info object
46+
base-url: "https://github.com/..." # Required: fetch source
47+
subdir: "path/to/component" # Optional: for monorepo components
48+
ref: "feature-branch" # Optional: override release with git ref
4649
format: Binary|Container|Binary+Container # Install method
47-
use-spread: false/true # Component provides spread tests
50+
test: false/true # Component provides spread tests
4851
networking:
4952
- name: calico
5053
service-cidr: "10.96.0.0/12"
5154
pod-cidr: "192.168.0.0/16"
5255
```
53-
Key insight: `use-spread: true` means component repo has spread.yaml tests that `kube-galaxy test spread` will execute.
56+
Key insight: `test: true` means component repo has spread.yaml tests that `kube-galaxy test` will execute.
5457

5558
### Local Development Workflow
5659
```bash
5760
# Validate manifest YAML syntax
58-
kube-galaxy validate manifests
61+
kube-galaxy validate
5962
6063
# Provision real cluster with kubeadm (no container shortcuts)
6164
kube-galaxy setup
6265
63-
# Run spread tests from components with use-spread: true
66+
# Run spread tests from components with test: true
6467
kube-galaxy test spread
6568
6669
# Clean cluster and artifacts
@@ -83,7 +86,7 @@ kube-galaxy cleanup all
8386
5. Components specify format: Binary (install to /usr/local/bin), Container (pull image), or both
8487

8588
### Test Execution Model
86-
- **Test discovery**: Only components with `use-spread: true` are tested
89+
- **Test discovery**: Only components with `test: true` are tested
8790
- **Test location**: Component repos contain `spread.yaml` at root
8891
- **Spread execution**: `kube-galaxy test spread` clones each component, finds spread.yaml, runs spread test suite
8992
- **Parallelism**: Spread tests run concurrently if specified in spread.yaml
@@ -142,7 +145,7 @@ Architecture detection happens at runtime in `pkg/cluster/setup.py`:
142145

143146
**When Adding Components**:
144147
1. Add entry to all 4 `manifests/baseline-k8s-*.yaml` files (don't skip versions)
145-
2. Set `use-spread: true` only if component repo has `spread.yaml` with test definitions
148+
2. Set `test: true` only if component repo has `spread.yaml` with test definitions
146149
3. Use canonical GitHub repos where available; verify release tag exists
147150
4. Set `format` correctly based on component's build/distribution (Binary, Container, or both)
148151

@@ -163,17 +166,15 @@ Architecture detection happens at runtime in `pkg/cluster/setup.py`:
163166

164167
```bash
165168
# Validation
166-
kube-galaxy validate all
167-
kube-galaxy validate manifests
168-
kube-galaxy test-manifest manifests/baseline-k8s-1.35.yaml
169+
kube-galaxy validate
170+
kube-galaxy validate --manifest manifests/baseline-k8s-1.35.yaml
169171
170172
# Testing
171-
kube-galaxy setup
172-
kube-galaxy test local
173-
kube-galaxy test spread
173+
kube-galaxy setup manifests/baseline-k8s-1.35.yaml
174+
kube-galaxy test manifests/baseline-k8s-1.35.yaml
174175
175176
# Management
176-
kube-galaxy cleanup all
177+
kube-galaxy cleanup manifests/baseline-k8s-1.35.yaml
177178
kube-galaxy status
178179
```
179180

.github/workflows/test-baseline-clusters.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ jobs:
9595
with:
9696
python-version: "3.12"
9797

98+
- name: Setup Go
99+
uses: actions/setup-go@v5
100+
with:
101+
go-version: ">=1.22"
102+
103+
- name: Install Spread
104+
run: go install github.com/snapcore/spread/cmd/spread@latest
105+
106+
- name: Setup LXD
107+
uses: canonical/setup-lxd@main
108+
98109
- name: Install kube-galaxy
99110
shell: bash
100111
run: |
@@ -151,28 +162,14 @@ jobs:
151162
id: run-tests
152163
shell: bash
153164
run: |
154-
kube-galaxy test spread
155-
156-
- name: Capture Test Results
157-
if: always()
158-
shell: bash
159-
run: |
160-
echo "## Test Execution Summary"
161-
echo "- **Manifest**: ${{ matrix.manifest-file }}"
162-
echo "- **Status**: ${{ steps.run-tests.outputs.test-status }}"
163-
echo "- **Results Path**: ${{ steps.run-tests.outputs.test-results }}"
164-
165-
if [ -f "test-results/summary.md" ]; then
166-
echo ""
167-
cat test-results/summary.md
168-
fi
165+
kube-galaxy test ${{ matrix.manifest-file }}
169166
170167
- name: Upload Test Results
171168
if: always()
172169
uses: actions/upload-artifact@v4
173170
with:
174171
name: test-results-${{ steps.setup-cluster.outputs.artifact-name }}
175-
path: test-results/
172+
path: logs/
176173
retention-days: 30
177174
if-no-files-found: warn
178175

README.md

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A scalable, multi-architecture testing infrastructure for Kubernetes using funct
99
- **Per-Component Definition**: Each component specifies its repo, release, and whether it provides tests
1010
- **GitHub Actions**: Automatic provisioning, testing, and cleanup workflows
1111
- **Multiarch Support**: Runtime architecture detection (amd64, arm64, riscv64, etc.)
12-
- **Component-Driven Tests**: Tests live in component repos, referenced via `use-spread` flag
12+
- **Component-Driven Tests**: Tests live in component repos, referenced via `test` flag
1313
- **Kubeadm-Based Provisioning**: Real cluster setup without container-based shortcuts
1414

1515
## 🏃 Quick Start
@@ -135,16 +135,25 @@ kubernetes-version: "v1.29.0"
135135
components:
136136
- name: containerd
137137
release: "v1.7.0"
138-
repo: "https://github.com/containerd/containerd"
139-
use-spread: false
138+
repo:
139+
base-url: "https://github.com/containerd/containerd"
140+
test: false
140141
- name: kubeadm
141142
release: "v1.29.0"
142-
repo: "https://github.com/kubernetes/kubernetes"
143-
use-spread: false
143+
repo:
144+
base-url: "https://github.com/kubernetes/kubernetes"
145+
test: false
144146
- name: my-custom-cni
145147
release: "main"
146-
repo: "https://github.com/myorg/custom-cni"
147-
use-spread: true
148+
repo:
149+
base-url: "https://github.com/myorg/custom-cni"
150+
test: true
151+
- name: monorepo-component
152+
repo:
153+
base-url: "https://github.com/myorg/monorepo"
154+
subdir: "components/my-component"
155+
ref: "feature-branch"
156+
test: true
148157
networking:
149158
- name: "calico"
150159
service-cidr: "10.96.0.0/12"
@@ -158,17 +167,44 @@ networking:
158167
- **kubernetes-version**: Kubernetes version (informational)
159168
- **components**: List of components to install
160169
- **name**: Component identifier
161-
- **release**: Git tag/branch to checkout
162-
- **repo**: Git repository URL
163-
- **use-spread**: If `true`, component repository provides spread tests
170+
- **release**: Git tag/branch to checkout (defaults to repo.ref if not specified)
171+
- **repo**: Repository information object
172+
- **base-url**: Git repository URL (required)
173+
- **subdir**: Optional subdirectory path for monorepo components
174+
- **ref**: Optional git reference (branch/tag/commit), defaults to release
175+
- **test**: If `true`, component repository provides spread tests
164176
- **networking**: CNI and network settings
165177

178+
### Repository Configuration
179+
180+
The `repo` field is an object that provides flexible repository configuration:
181+
182+
- **Simple component**: Only needs `base-url`
183+
```yaml
184+
repo:
185+
base-url: "https://github.com/containerd/containerd"
186+
```
187+
188+
- **Monorepo component**: Add `subdir` to specify component location
189+
```yaml
190+
repo:
191+
base-url: "https://github.com/kubernetes/kubernetes"
192+
subdir: "staging/src/k8s.io/kubectl"
193+
```
194+
195+
- **Development branch**: Use `ref` to override the release tag
196+
```yaml
197+
repo:
198+
base-url: "https://github.com/myorg/component"
199+
ref: "feature-branch"
200+
```
201+
166202
## 🔧 Component Repositories
167203

168204
Each component repository must contain a `spread.yaml` file that defines:
169205

170206
1. **Install instructions** (required if component is used)
171-
2. **Test definitions** (required if `use-spread: true`)
207+
2. **Test definitions** (required if `test: true`)
172208

173209
### Example Component spread.yaml
174210

docs/class-based-components.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ The class-based approach provides several advantages:
1919
- Pythonic, simple, no special methods needed
2020

2121
3. **Configuration**: Easy access to manifest configuration via properties:
22-
- `self.hook_config` - dict of hook-specific configuration
2322
- `self.custom_binary_url` - custom binary URL (if provided)
2423
- `self.install_method` - installation method
2524

@@ -118,23 +117,6 @@ def install_hook(self):
118117
install_binary(self.binary_path, 'mycomponent')
119118
```
120119

121-
### Hook Configuration
122-
123-
Access hook-specific configuration from manifest:
124-
125-
```python
126-
def bootstrap_hook(self):
127-
# Get hook configuration from manifest (via property)
128-
config = self.hook_config.get('bootstrap', {})
129-
pod_cidr = config.get('pod_network_cidr', '10.244.0.0/16')
130-
service_cidr = config.get('service_cidr', '10.96.0.0/12')
131-
132-
# Use configuration
133-
run(['kubeadm', 'init', f'--pod-network-cidr={pod_cidr}'])
134-
```
135-
136-
**Note**: Hook skipping is automatic! If you don't override a hook method, it simply won't run (the base class provides an empty default implementation).
137-
138120
## Complete Example
139121

140122
```python

docs/component-lifecycle-hooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ The `@register_component_class` decorator registers the component at module impo
119119

120120
2. **Use instance attributes for state**: Share data between hooks using `self.attribute_name`
121121

122-
3. **Use properties for configuration**: Access manifest config via `self.custom_binary_url`, `self.hook_config`, etc.
122+
3. **Use properties for configuration**: Access manifest config via `self.custom_binary_url`, etc.
123123

124124
4. **Don't override hooks you don't need**: The base class provides empty defaults
125125

0 commit comments

Comments
 (0)