Skip to content

Commit 2de34f8

Browse files
committed
squash commits
1 parent 4d24cb6 commit 2de34f8

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

184+
helm-preflight-dryrun:
185+
desc: Verify the preflight specs that will be run
186+
silent: false
187+
cmds:
188+
- |
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"
203+
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 -
211+
deps:
212+
- setup-kubeconfig
213+
184214
helm-install:
185215
desc: Install all charts using helmfile
186216
silent: false
@@ -492,6 +522,7 @@ tasks:
492522
- task: setup-kubeconfig
493523
- task: cluster-ports-expose
494524
- task: dependencies-update
525+
- task: helm-preflight
495526
- task: helm-install
496527
- task: test
497528
- 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)