Skip to content

Commit b7a96a6

Browse files
committed
updates from code review
1 parent 34e4f2d commit b7a96a6

File tree

5 files changed

+38
-38
lines changed

5 files changed

+38
-38
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ applications/wg-easy/release/
5252
.aider*
5353
# SpecStory explanation file
5454
.specstory/.what-is-this.md
55+
preflightbundle-*.tar.gz

applications/wg-easy/Taskfile.yaml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -172,36 +172,25 @@ tasks:
172172
deps:
173173
- cluster-create
174174

175-
helm-preflight-dryrun:
176-
desc: Verify the preflight specs that will be run
175+
helm-preflight:
176+
desc: Run preflight checks on Helm charts using preflight CLI (use DRY_RUN=true for dry-run)
177177
silent: false
178+
vars:
179+
DRY_RUN: '{{.DRY_RUN | default "false"}}'
178180
cmds:
179181
- |
180-
TEMP_FILE=$(mktemp)
181-
182-
# Find all charts and append their templates to the temp file
183-
for chart_dir in $(find charts/ -maxdepth 1 -mindepth 1 -type d); do
184-
helm template "$chart_dir" >> "$TEMP_FILE"
185-
echo "---" >> "$TEMP_FILE" # Add separator between charts
186-
done
187-
188-
# Run preflight once on the combined templates
189-
echo "Running preflight checks on all templates"
190-
cat "$TEMP_FILE" | kubectl preflight - --dry-run
191-
192-
# Clean up
193-
rm "$TEMP_FILE"
182+
PREFLIGHT_FLAGS=""
183+
if [ "{{.DRY_RUN}}" = "true" ]; then
184+
PREFLIGHT_FLAGS="--dry-run"
185+
fi
194186
195-
helm-preflight:
196-
desc: Run preflight checks on Helm charts using preflight CLI
197-
silent: false
198-
cmds:
199-
- defer: rm -f preflightbundle-*.tar.gz
200-
- helm template charts/wg-easy | kubectl preflight -
201-
- helm template charts/cert-manager | kubectl preflight -
187+
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
188+
echo "Running preflight on $chart_dir"
189+
helm template $chart_dir | kubectl preflight - $PREFLIGHT_FLAGS
190+
done
202191
deps:
203192
- setup-kubeconfig
204-
193+
205194
helm-install:
206195
desc: Install all charts using helmfile
207196
silent: false

applications/wg-easy/charts/cert-manager/templates/secret-preflights.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ stringData:
1919
- fail:
2020
when: "< 1.22.0"
2121
message: The application requires at least Kubernetes 1.22.0, and recommends 1.25.0.
22-
uri: https://kubernetes.io
22+
uri: https://cert-manager.io/docs/installation/helm/#prerequisites
2323
- warn:
2424
when: "< 1.25.0"
2525
message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.25.0 or later.
26-
uri: https://kubernetes.io
26+
uri: https://cert-manager.io/docs/installation/helm/#prerequisites
2727
- pass:
2828
message: Your cluster meets the recommended and required versions of Kubernetes.

applications/wg-easy/docs/development-workflow.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,33 +121,41 @@ Deploy individual charts to a test cluster to verify functionality.
121121
task setup-kubeconfig
122122
```
123123

124-
2. Install a single chart:
124+
2. Run preflight checks on your chart:
125+
126+
```bash
127+
task helm-preflight
128+
# Or for a single chart with dry-run:
129+
helm template ./charts/wg-easy | kubectl preflight - --dry-run
130+
```
131+
132+
3. Install a single chart:
125133

126134
```bash
127135
helm install cert-manager ./cert-manager -n cert-manager --create-namespace
128136
```
129137

130-
3. Verify the deployment:
138+
4. Verify the deployment:
131139

132140
```bash
133141
kubectl get pods -n cert-manager
134142
```
135143

136-
4. Test chart functionality:
144+
5. Test chart functionality:
137145

138146
```bash
139147
# Example: Test cert-manager with a test certificate
140148
kubectl apply -f ./some-test-certificate.yaml
141149
kubectl get certificate -A
142150
```
143151

144-
5. Uninstall when done or making changes and repeat step 2:
152+
6. Uninstall when done or making changes and repeat step 3:
145153

146154
```bash
147155
helm uninstall cert-manager -n cert-manager
148156
```
149157

150-
**Validation point**: Chart should deploy successfully and function as expected.
158+
**Validation point**: Preflight checks should pass without errors, and the chart should deploy successfully and function as expected.
151159

152160
### Stage 5: Integration Testing with helmfile
153161

@@ -172,7 +180,7 @@ Test multiple charts working together using Helmfile orchestration.
172180
2. Deploy all charts:
173181
174182
```bash
175-
task helm-deploy
183+
task helm-install
176184
```
177185

178186
3. Verify cross-component integration:

applications/wg-easy/docs/task-reference.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ These tasks support the iterative development process, focusing on fast feedback
99
| Task | Description | Related Workflow Stage |
1010
|------|-------------|------------------------|
1111
| `dependencies-update` | Updates Helm dependencies for all charts in the repository | Stage 1: Dependencies |
12-
| `helm-deploy` | Deploys all charts using helmfile with proper sequencing | Stage 5: Integration Testing |
12+
| `helm-preflight` | Runs preflight checks on Helm charts using the preflight CLI | Stage 4: Validation |
13+
| `helm-install` | Installs all charts using helmfile with proper sequencing | Stage 5: Integration Testing |
1314
| `ports-expose` | Exposes the configured ports on the cluster for testing | Stage 4-5: Chart Installation/Integration |
1415
| `remove-k3s-traefik` | Removes pre-installed Traefik from k3s clusters to avoid conflicts | Stage 4-5: Chart Installation/Integration |
1516

1617
### Common Development Combinations
1718

1819
**Complete Update and Deploy:**
1920
```bash
20-
task update-dependencies && task deploy-helm
21+
task update-dependencies && task helm-install
2122
```
2223

2324
**Single Chart Testing:**
@@ -94,9 +95,9 @@ This task performs the following sequence:
9495
1. Creates a cluster
9596
2. Sets up the kubeconfig
9697
3. Exposes ports
97-
4. Removes pre-installed Traefik
98-
5. Updates dependencies
99-
6. Deploys all charts
98+
4. Updates dependencies
99+
5. Runs preflight checks on charts
100+
6. Installs all charts
100101
7. Runs tests
101102
8. Deletes the cluster
102103

@@ -109,6 +110,7 @@ Many tasks accept parameters to customize their behavior. Here are the most comm
109110
| `CLUSTER_NAME` | `cluster-create`, `setup-kubeconfig` | Name for the cluster | "test-cluster" |
110111
| `K8S_VERSION` | `cluster-create` | Kubernetes version | "1.32.2" |
111112
| `DISTRIBUTION` | `cluster-create` | Cluster distribution | "k3s" |
113+
| `DRY_RUN` | `helm-preflight` | Run preflight checks in dry-run mode | "false" |
112114
| `CHANNEL` | `release-create` | Channel to promote to | "Unstable" |
113115
| `RELEASE_NOTES` | `release-create` | Notes for the release | "" |
114116
| `GCP_PROJECT` | `gcp-vm-create` | GCP project ID | Required |
@@ -121,7 +123,7 @@ Parameters in the Taskfile.yaml try to always have defaults so that it works out
121123
These tasks are designed to support the progressive complexity approach:
122124

123125
1. **Early Stages** - Use `dependencies-update` and helm commands directly
124-
2. **Middle Stages** - Use `cluster-create`, `helm-deploy`, and `test`
126+
2. **Middle Stages** - Use `cluster-create`, `helm-install`, and `test`
125127
3. **Later Stages** - Use `release-prepare`, `release-create`, and embedded cluster tasks
126128

127129
This organization allows developers to focus on the appropriate level of complexity at each stage of development.

0 commit comments

Comments
 (0)