From 20513a78d1f0090b3ce20564fc845a4bf84ee542 Mon Sep 17 00:00:00 2001 From: Shubharanshu Mahapatra Date: Wed, 19 Jun 2024 09:40:10 -0700 Subject: [PATCH] Fix daemon startup latency issue by providing an option to skip snapshotter supported flag --- cmd/soci-snapshotter-grpc/main.go | 15 +++++++++++++-- config/fs.go | 1 + docs/config.md | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd/soci-snapshotter-grpc/main.go b/cmd/soci-snapshotter-grpc/main.go index faa091455..0aab48385 100644 --- a/cmd/soci-snapshotter-grpc/main.go +++ b/cmd/soci-snapshotter-grpc/main.go @@ -125,8 +125,19 @@ func main() { log.G(ctx).WithError(err).Fatal(err) } - if err := service.Supported(*rootDir); err != nil { - log.G(ctx).WithError(err).Fatalf("snapshotter is not supported") + if !cfg.SkipCheckSnapshotterSupported { + if err := service.Supported(*rootDir); err != nil { + log.G(ctx).WithError(err).Fatalf("snapshotter is not supported") + } + log.G(ctx).WithFields(logrus.Fields{ + "version": version.Version, + "revision": version.Revision, + }).Debug("snapshotter is supported") + } else { + log.G(ctx).WithFields(logrus.Fields{ + "version": version.Version, + "revision": version.Revision, + }).Warn("Skipped snapshotter is supported check ") } // Create a gRPC server diff --git a/config/fs.go b/config/fs.go index 4088d9b6e..1e75c6498 100644 --- a/config/fs.go +++ b/config/fs.go @@ -56,6 +56,7 @@ type FSConfig struct { NoPrometheus bool `toml:"no_prometheus"` MountTimeoutSec int64 `toml:"mount_timeout_sec"` FuseMetricsEmitWaitDurationSec int64 `toml:"fuse_metrics_emit_wait_duration_sec"` + SkipCheckSnapshotterSupported bool `toml:"skip_check_snapshotter_supported"` RetryableHTTPClientConfig `toml:"http"` BlobConfig `toml:"blob"` diff --git a/docs/config.md b/docs/config.md index 65b6cdad3..ead96ade4 100644 --- a/docs/config.md +++ b/docs/config.md @@ -26,6 +26,7 @@ This set of variables must be at the top of your TOML file due to not belonging - `no_prometheus` (bool) — Toggle prometheus metrics. Default: false. - `mount_timeout_sec` (int) — Timeout for mount if a layer can't be resolved. Default: 30. - `fuse_metrics_emit_wait_duration_sec` (int) — The wait time before the snaphotter emits FUSE operation counts for an image. Default: 60. +- `skip_check_snapshotter_supported` (bool) - skip check for snapshotter is supported which can give performance benefits for soci daemon startup time. This config to be done if you are sure overlayfs is supported. Default: false ## config/config.go ### Config