Skip to content

Commit 15c3816

Browse files
committed
updates from code review
1 parent 2de34f8 commit 15c3816

File tree

5 files changed

+37
-37
lines changed

5 files changed

+37
-37
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
@@ -181,36 +181,25 @@ tasks:
181181
deps:
182182
- cluster-create
183183

184-
helm-preflight-dryrun:
185-
desc: Verify the preflight specs that will be run
184+
helm-preflight:
185+
desc: Run preflight checks on Helm charts using preflight CLI (use DRY_RUN=true for dry-run)
186186
silent: false
187+
vars:
188+
DRY_RUN: '{{.DRY_RUN | default "false"}}'
187189
cmds:
188190
- |
189-
TEMP_FILE=$(mktemp)
190-
191-
# Find all charts and append their templates to the temp file
192-
for chart_dir in $(find charts/ -maxdepth 1 -mindepth 1 -type d); do
193-
helm template "$chart_dir" >> "$TEMP_FILE"
194-
echo "---" >> "$TEMP_FILE" # Add separator between charts
195-
done
196-
197-
# Run preflight once on the combined templates
198-
echo "Running preflight checks on all templates"
199-
cat "$TEMP_FILE" | kubectl preflight - --dry-run
200-
201-
# Clean up
202-
rm "$TEMP_FILE"
191+
PREFLIGHT_FLAGS=""
192+
if [ "{{.DRY_RUN}}" = "true" ]; then
193+
PREFLIGHT_FLAGS="--dry-run"
194+
fi
203195
204-
helm-preflight:
205-
desc: Run preflight checks on Helm charts using preflight CLI
206-
silent: false
207-
cmds:
208-
- defer: rm -f preflightbundle-*.tar.gz
209-
- helm template charts/wg-easy | kubectl preflight -
210-
- helm template charts/cert-manager | kubectl preflight -
196+
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
197+
echo "Running preflight on $chart_dir"
198+
helm template $chart_dir | kubectl preflight - $PREFLIGHT_FLAGS
199+
done
211200
deps:
212201
- setup-kubeconfig
213-
202+
214203
helm-install:
215204
desc: Install all charts using helmfile
216205
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: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,33 +135,41 @@ Deploy individual charts to a test cluster to verify functionality.
135135
task setup-kubeconfig
136136
```
137137

138-
2. Install a single chart:
138+
2. Run preflight checks on your chart:
139+
140+
```bash
141+
task helm-preflight
142+
# Or for a single chart with dry-run:
143+
helm template ./charts/wg-easy | kubectl preflight - --dry-run
144+
```
145+
146+
3. Install a single chart:
139147

140148
```bash
141149
helm install cert-manager ./charts/cert-manager -n cert-manager --create-namespace
142150
```
143151

144-
3. Verify the deployment:
152+
4. Verify the deployment:
145153

146154
```bash
147155
kubectl get pods -n cert-manager
148156
```
149157

150-
4. Test chart functionality:
158+
5. Test chart functionality:
151159

152160
```bash
153161
# Example: Test cert-manager with a test certificate
154162
kubectl apply -f ./some-test-certificate.yaml
155163
kubectl get certificate -A
156164
```
157165

158-
5. Uninstall when done or making changes and repeat step 2:
166+
6. Uninstall when done or making changes and repeat step 3:
159167

160168
```bash
161169
helm uninstall cert-manager -n cert-manager
162170
```
163171

164-
**Validation point**: Chart should deploy successfully and function as expected.
172+
**Validation point**: Preflight checks should pass without errors, and the chart should deploy successfully and function as expected.
165173

166174
### Stage 5: Integration Testing with helmfile
167175

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)