@@ -55,6 +55,7 @@ import (
5555 "github.com/awslabs/soci-snapshotter/service"
5656 "github.com/awslabs/soci-snapshotter/service/keychain/cri/v1"
5757 crialpha "github.com/awslabs/soci-snapshotter/service/keychain/cri/v1alpha"
58+ "github.com/awslabs/soci-snapshotter/soci"
5859
5960 "github.com/awslabs/soci-snapshotter/service/keychain/dockerconfig"
6061 "github.com/awslabs/soci-snapshotter/service/keychain/kubeconfig"
@@ -84,7 +85,6 @@ const (
8485 defaultAddress = "/run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock"
8586 defaultConfigPath = "/etc/soci-snapshotter-grpc/config.toml"
8687 defaultLogLevel = logrus .InfoLevel
87- defaultRootDir = "/var/lib/soci-snapshotter-grpc"
8888)
8989
9090// logLevel of Debug or Trace may emit sensitive information
9393 address = flag .String ("address" , defaultAddress , "address for the snapshotter's GRPC server" )
9494 configPath = flag .String ("config" , defaultConfigPath , "path to the configuration file" )
9595 logLevel = flag .String ("log-level" , defaultLogLevel .String (), "set the logging level [trace, debug, info, warn, error, fatal, panic]" )
96- rootDir = flag .String ("root" , defaultRootDir , "path to the root directory for this snapshotter" )
96+ rootDir = flag .String ("root" , config . DefaultSociSnapshotterRootPath , "path to the root directory for this snapshotter" )
9797 printVersion = flag .Bool ("version" , false , "print the version" )
9898)
9999
@@ -361,7 +361,7 @@ func listen(ctx context.Context, address string) (net.Listener, error) {
361361
362362func listenUnix (addr string ) (net.Listener , error ) {
363363 // Prepare the directory for the socket
364- if err := os . MkdirAll (filepath .Dir (addr ), 0700 ); err != nil {
364+ if err := soci . EnsureSnapshotterRootPath (filepath .Dir (addr )); err != nil {
365365 return nil , fmt .Errorf ("failed to create directory %q: %w" , filepath .Dir (addr ), err )
366366 }
367367
0 commit comments