Skip to content

Commit 36c5512

Browse files
authored
Merge pull request #60 from shiv-tyagi/improve-driver-checks
[Fix] improve the init container script for NL
2 parents 03939ec + b6fa1cc commit 36c5512

1 file changed

Lines changed: 27 additions & 16 deletions

File tree

internal/nodelabeller/nodelabeller.go

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -180,26 +180,37 @@ func getSimCommand(blacklist bool) []string {
180180
}
181181
}
182182

183+
const waitScript = `if grep -qi hypervisor /proc/cpuinfo; then
184+
IS_VM=true;
185+
echo "Running on VM"
186+
else
187+
IS_VM=false;
188+
echo "Running on bare metal"
189+
fi
190+
191+
drivers_not_ready() {
192+
if [ "$IS_VM" = "true" ]; then
193+
[ ! -d /sys/class/infiniband ] || \
194+
[ ! -d /sys/class/infiniband_verbs ] || \
195+
[ ! -d /sys/module/ionic/drivers ]
196+
else
197+
[ ! -d /sys/class/infiniband ] || \
198+
[ ! -d /sys/class/infiniband_verbs ] || \
199+
[ ! -d /sys/module/ionic/drivers ] || \
200+
([ ! -d /sys/module/tawk_ipc/drivers ] && [ ! -d /sys/module/pds_core/drivers ])
201+
fi
202+
}
203+
204+
while drivers_not_ready; do
205+
echo "waiting for drivers"
206+
sleep 2
207+
done`
208+
183209
func getOpenShiftWaitCommand() []string {
184-
return []string{
185-
"sh", "-c",
186-
`while [ ! -d /sys/class/infiniband ] ||
187-
[ ! -d /sys/class/infiniband_verbs ] ||
188-
[ ! -d /sys/module/ionic/drivers ]; do
189-
echo "amd ionic driver is not loaded "
190-
sleep 2
191-
done`,
192-
}
210+
return []string{"sh", "-c", waitScript}
193211
}
194212

195213
func getNonSimCommand(blacklist bool) []string {
196-
waitScript := `while [ ! -d /sys/class/infiniband ] ||
197-
[ ! -d /sys/class/infiniband_verbs ] ||
198-
[ ! -d /sys/module/ionic/drivers ]; do
199-
echo "amd ionic driver is not loaded "
200-
sleep 2
201-
done`
202-
203214
var modprobeAction string
204215
if blacklist {
205216
modprobeAction = fmt.Sprintf(`echo "blacklist ionic" > /host-etc/modprobe.d/%v`, defaultBlacklistFileName)

0 commit comments

Comments
 (0)