Skip to content

Commit 34e4f2d

Browse files
committed
squash commits
1 parent 8481e4b commit 34e4f2d

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

applications/wg-easy/Taskfile.yaml

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

175+
helm-preflight-dryrun:
176+
desc: Verify the preflight specs that will be run
177+
silent: false
178+
cmds:
179+
- |
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"
194+
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 -
202+
deps:
203+
- setup-kubeconfig
204+
175205
helm-install:
176206
desc: Install all charts using helmfile
177207
silent: false
@@ -483,6 +513,7 @@ tasks:
483513
- task: setup-kubeconfig
484514
- task: cluster-ports-expose
485515
- task: dependencies-update
516+
- task: helm-preflight
486517
- task: helm-install
487518
- task: test
488519
- task: cluster-delete
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: cert-manager-preflights
5+
labels:
6+
troubleshoot.sh/kind: preflight
7+
type: Opaque
8+
stringData:
9+
preflight.yaml: |
10+
apiVersion: troubleshoot.sh/v1beta2
11+
kind: Preflight
12+
metadata:
13+
name: cert-manager-preflights
14+
spec:
15+
analyzers:
16+
# https://github.com/cert-manager/cert-manager/blob/master/deploy/charts/cert-manager/README.template.md#prerequisites
17+
- clusterVersion:
18+
outcomes:
19+
- fail:
20+
when: "< 1.22.0"
21+
message: The application requires at least Kubernetes 1.22.0, and recommends 1.25.0.
22+
uri: https://kubernetes.io
23+
- warn:
24+
when: "< 1.25.0"
25+
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
27+
- pass:
28+
message: Your cluster meets the recommended and required versions of Kubernetes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: wg-easy-preflights
5+
labels:
6+
troubleshoot.sh/kind: preflight
7+
type: Opaque
8+
stringData:
9+
preflight.yaml: |
10+
apiVersion: troubleshoot.sh/v1beta2
11+
kind: Preflight
12+
metadata:
13+
name: wg-easy-preflights
14+
spec:
15+
collectors:
16+
- sysctl:
17+
image: debian:buster-slim
18+
analyzers:
19+
- sysctl:
20+
checkName: IP forwarding enabled
21+
outcomes:
22+
- fail:
23+
when: 'net.ipv4.ip_forward == 0'
24+
message: "IP forwarding must be enabled. To enable it, edit /etc/sysctl.conf, add or uncomment the line 'net.ipv4.ip_forward=1', and run 'sudo sysctl -p'."
25+
- pass:
26+
when: 'net.ipv4.ip_forward == 1'
27+
message: "IP forwarding is enabled."

0 commit comments

Comments
 (0)