Skip to content

Commit

Permalink
Hack nfs-server image to run it 'graceless'
Browse files Browse the repository at this point in the history
The NFS grace period is set to 90 seconds and it stalls the clients
trying to access the share right after the server start. This may affect
the tests and lead to timeouts so disable the setting.

Signed-off-by: Vasiliy Ulyanov <[email protected]>
  • Loading branch information
vasiliy-ul committed Aug 25, 2023
1 parent d1faa68 commit 0e76688
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions images/nfs-server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ load(
"@io_bazel_rules_docker//container:container.bzl",
"container_image",
)
load("@rules_pkg//:pkg.bzl", "pkg_tar")

pkg_tar(
name = "entrypoint",
srcs = [":entrypoint.sh"],
mode = "0775",
package_dir = "/",
)

container_image(
name = "nfs-server-image",
Expand All @@ -13,6 +21,7 @@ container_image(
"@io_bazel_rules_go//go/platform:linux_arm64": "@nfs-server_aarch64//image",
"//conditions:default": "@nfs-server//image",
}),
cmd = ["/entrypoint.sh"],
ports = [
"111/udp",
"2049/udp",
Expand All @@ -25,5 +34,8 @@ container_image(
"32766/tcp",
"32767/tcp",
],
tars = [
":entrypoint",
],
visibility = ["//visibility:public"],
)
12 changes: 12 additions & 0 deletions images/nfs-server/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -euxo pipefail

# The NFS grace period is set to 90 seconds and it stalls the clients
# trying to access the share right after the server start. This may affect
# the tests and lead to timeouts so disable the setting.
sed -i"" \
-e "s#Grace_Period = 90#Graceless = true#g" \
/opt/start_nfs.sh

exec /opt/start_nfs.sh

0 comments on commit 0e76688

Please sign in to comment.