Skip to content

Commit a1a060b

Browse files
authored
feat: preflights for sysctl and modules (#1878)
* feat: preflights for sysctl and modules * feat: preflights for sysctl and modules * f * disable kernelModules preflights * update troubleshoot * add back kernel module preflights * update troubleshoot
1 parent 0b38967 commit a1a060b

File tree

7 files changed

+79
-16
lines changed

7 files changed

+79
-16
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ K0S_GO_VERSION = v1.30.9+k0s.0
1515
PREVIOUS_K0S_VERSION ?= v1.29.9+k0s.0-ec.0
1616
PREVIOUS_K0S_GO_VERSION ?= v1.29.9+k0s.0
1717
K0S_BINARY_SOURCE_OVERRIDE =
18-
TROUBLESHOOT_VERSION = v0.112.1
18+
TROUBLESHOOT_VERSION = v0.116.1
1919

2020
KOTS_VERSION = v$(shell awk '/^version/{print $$2}' pkg/addons/adminconsole/static/metadata.yaml | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
2121
# When updating KOTS_BINARY_URL_OVERRIDE, also update the KOTS_VERSION above or

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/replicatedhq/embedded-cluster/kinds v0.0.0
3333
github.com/replicatedhq/embedded-cluster/utils v0.0.0
3434
github.com/replicatedhq/kotskinds v0.0.0-20240814191029-3f677ee409a0
35-
github.com/replicatedhq/troubleshoot v0.115.3
35+
github.com/replicatedhq/troubleshoot v0.116.1
3636
github.com/sirupsen/logrus v1.9.3
3737
github.com/spf13/cobra v1.8.1
3838
github.com/spf13/viper v1.19.0
@@ -110,7 +110,7 @@ require (
110110
github.com/cespare/xxhash/v2 v2.3.0 // indirect
111111
github.com/chai2010/gettext-go v1.0.2 // indirect
112112
github.com/chzyer/readline v1.5.1 // indirect
113-
github.com/cilium/ebpf v0.17.1 // indirect
113+
github.com/cilium/ebpf v0.17.2 // indirect
114114
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect
115115
github.com/containerd/cgroups/v3 v3.0.5 // indirect
116116
github.com/containerd/containerd v1.7.24 // indirect
@@ -271,7 +271,7 @@ require (
271271
go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect
272272
go.opentelemetry.io/otel/trace v1.34.0 // indirect
273273
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
274-
golang.org/x/mod v0.22.0 // indirect
274+
golang.org/x/mod v0.23.0 // indirect
275275
golang.org/x/tools v0.28.0 // indirect
276276
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
277277
google.golang.org/api v0.197.0 // indirect
@@ -336,7 +336,7 @@ require (
336336
github.com/spf13/pflag v1.0.6
337337
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
338338
go.uber.org/zap v1.27.0 // indirect
339-
golang.org/x/net v0.34.0 // indirect
339+
golang.org/x/net v0.35.0 // indirect
340340
golang.org/x/oauth2 v0.25.0 // indirect
341341
golang.org/x/sys v0.30.0 // indirect
342342
golang.org/x/text v0.22.0 // indirect

go.sum

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,8 @@ github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObk
778778
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
779779
github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04=
780780
github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
781-
github.com/cilium/ebpf v0.17.1 h1:G8mzU81R2JA1nE5/8SRubzqvBMmAmri2VL8BIZPWvV0=
782-
github.com/cilium/ebpf v0.17.1/go.mod h1:vay2FaYSmIlv3r8dNACd4mW/OCaZLJKJOo+IHBvCIO8=
781+
github.com/cilium/ebpf v0.17.2 h1:IQTaTVu0vKA8WTemFuBnxW9YbAwMkJVKHsNHW4lHv/g=
782+
github.com/cilium/ebpf v0.17.2/go.mod h1:9X5VAsIOck/nCAp0+nCSVzub1Q7x+zKXXItTMYfNE+E=
783783
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
784784
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
785785
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
@@ -1440,8 +1440,8 @@ github.com/redis/go-redis/v9 v9.5.2/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0
14401440
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
14411441
github.com/replicatedhq/kotskinds v0.0.0-20240814191029-3f677ee409a0 h1:Gi+Fs6583v7GmgQKJyaZuBzcih0z5YXBREDQ8AWY2JM=
14421442
github.com/replicatedhq/kotskinds v0.0.0-20240814191029-3f677ee409a0/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I=
1443-
github.com/replicatedhq/troubleshoot v0.115.3 h1:sBTfQbogY/HEvHuhx1MRJ3P8gJrtIIStCezsbzPAzRM=
1444-
github.com/replicatedhq/troubleshoot v0.115.3/go.mod h1:RoVEqBrZ1uyireINqk2NAM8qlf2Ui85JfgNhR1RjzTs=
1443+
github.com/replicatedhq/troubleshoot v0.116.1 h1:IrSSW/eyU0BbjgbSZcKF5W00WtO1z8jBT7pOal8L3Rk=
1444+
github.com/replicatedhq/troubleshoot v0.116.1/go.mod h1:FbVwjHSSUboCd3G1Vz0pUUDU2ux/rW5m/BpkTrf86rc=
14451445
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
14461446
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
14471447
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
@@ -1727,8 +1727,8 @@ golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
17271727
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
17281728
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
17291729
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
1730-
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
1731-
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
1730+
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
1731+
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
17321732
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
17331733
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
17341734
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1795,8 +1795,9 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
17951795
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
17961796
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
17971797
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
1798-
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
17991798
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
1799+
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
1800+
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
18001801
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
18011802
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
18021803
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=

kinds/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/replicatedhq/embedded-cluster/kinds
33
go 1.23.2
44

55
require (
6-
github.com/evanphx/json-patch v5.9.11+incompatible
76
github.com/k0sproject/k0s v1.30.7-0.20241029184556-a942e759e13b
87
github.com/stretchr/testify v1.10.0
98
k8s.io/api v0.32.1

kinds/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
1313
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1414
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
1515
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
16-
github.com/evanphx/json-patch v5.9.11+incompatible h1:ixHHqfcGvxhWkniF1tWxBHA0yb4Z+d1UQi45df52xW8=
17-
github.com/evanphx/json-patch v5.9.11+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
1816
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
1917
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
2018
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=

pkg/preflights/host-preflight.yaml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ spec:
1414
- cpu: {}
1515
- time: {}
1616
- ipv4Interfaces: {}
17+
- kernelModules: {}
1718
- run:
1819
collectorName: 'ip-route-table'
1920
command: 'ip'
@@ -927,8 +928,71 @@ spec:
927928
when: 'net.ipv4.ip_forward == 0'
928929
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'."
929930
- pass:
930-
when: 'net.ipv4.ip_forward > 0'
931+
when: 'net.ipv4.ip_forward == 1'
931932
message: "IP forwarding is enabled."
933+
- sysctl:
934+
checkName: "IP forwarding for all interfaces"
935+
outcomes:
936+
- fail:
937+
when: 'net.ipv4.conf.all.forwarding == 0'
938+
message: "IP forwarding must be enabled. To enable it, edit /etc/sysctl.conf, add or uncomment the line 'net.ipv4.conf.all.forwarding=1', and run 'sudo sysctl -p'."
939+
- pass:
940+
when: 'net.ipv4.conf.all.forwarding == 1'
941+
message: "IP forwarding is enabled."
942+
- sysctl:
943+
checkName: "IP forwarding for the default interface"
944+
outcomes:
945+
- fail:
946+
when: 'net.ipv4.conf.default.forwarding == 0'
947+
message: "IP forwarding must be enabled. To enable it, edit /etc/sysctl.conf, add or uncomment the line 'net.ipv4.conf.default.forwarding=1', and run 'sudo sysctl -p'."
948+
- pass:
949+
when: 'net.ipv4.conf.default.forwarding == 1'
950+
message: "IP forwarding is enabled."
951+
- sysctl:
952+
checkName: "Bridge netfilter call iptables"
953+
outcomes:
954+
- fail:
955+
when: 'net.bridge.bridge-nf-call-iptables == 0'
956+
message: "Bridge netfilter call iptables must be enabled. To enable it, edit /etc/sysctl.conf, add or uncomment the line 'net.bridge.bridge-nf-call-iptables=1', and run 'sudo sysctl -p'."
957+
- pass:
958+
when: 'net.bridge.bridge-nf-call-iptables == 1'
959+
message: "Bridge netfilter call iptables is enabled."
960+
- kernelModules:
961+
checkName: "Overlay kernel module"
962+
outcomes:
963+
- fail:
964+
when: "overlay != loaded,loadable"
965+
message: The 'overlay' kernel module is not loaded or loadable
966+
- pass:
967+
when: "overlay == loaded,loadable"
968+
message: The 'overlay' kernel module is loaded or loadable
969+
- kernelModules:
970+
checkName: "IP tables kernel module"
971+
outcomes:
972+
- fail:
973+
when: "ip_tables != loaded,loadable"
974+
message: The 'ip_tables' kernel module is not loaded or loadable
975+
- pass:
976+
when: "ip_tables == loaded,loadable"
977+
message: The 'ip_tables' kernel module is loaded or loadable
978+
- kernelModules:
979+
checkName: "BR Netfilter kernel module"
980+
outcomes:
981+
- fail:
982+
when: "br_netfilter != loaded,loadable"
983+
message: The 'br_netfilter' kernel module is not loaded or loadable
984+
- pass:
985+
when: "br_netfilter == loaded,loadable"
986+
message: The 'br_netfilter' kernel module is loaded or loadable
987+
- kernelModules:
988+
checkName: "NF Conntrack kernel module"
989+
outcomes:
990+
- fail:
991+
when: "nf_conntrack != loaded,loadable"
992+
message: The 'nf_conntrack' kernel module is not loaded or loadable
993+
- pass:
994+
when: "nf_conntrack == loaded,loadable"
995+
message: The 'nf_conntrack' kernel module is loaded or loadable
932996
- networkNamespaceConnectivity:
933997
collectorName: check-network-namespace-connectivity
934998
outcomes:

pkg/preflights/template.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func GetClusterHostPreflights(ctx context.Context, data types.TemplateData) ([]v
2424
RawSpecs: []string{
2525
spec,
2626
},
27+
Strict: true,
2728
})
2829
if err != nil {
2930
return nil, fmt.Errorf("load host preflight specs: %w", err)

0 commit comments

Comments
 (0)