package config

import "github.com/containerd/nydus-snapshotter/config"

Index

Constants

const (
	FsDriverBlockdev string = constant.FsDriverBlockdev
	FsDriverFusedev  string = constant.FsDriverFusedev
	FsDriverFscache  string = constant.FsDriverFscache
	FsDriverNodev    string = constant.FsDriverNodev
	FsDriverProxy    string = constant.FsDriverProxy
)
const (
	FailoverPolicyNone   string = constant.FailoverPolicyNone
	FailoverPolicyResend string = constant.FailoverPolicyResend
	FailoverPolicyFlush  string = constant.FailoverPolicyFlush
)
const (
	TarfsLayerVerityOnly      string = "layer_verity_only"
	TarfsImageVerityOnly      string = "image_verity_only"
	TarfsLayerBlockDevice     string = "layer_block"
	TarfsImageBlockDevice     string = "image_block"
	TarfsLayerBlockWithVerity string = "layer_block_with_verity"
	TarfsImageBlockWithVerity string = "image_block_with_verity"
)

Functions

func GetConfigRoot

func GetConfigRoot() string

func GetDaemonFailoverPolicy

func GetDaemonFailoverPolicy() string

func GetDaemonLogRotationSize

func GetDaemonLogRotationSize() int

func GetDaemonProfileCPUDuration

func GetDaemonProfileCPUDuration() int64

func GetDaemonThreadsNumber

func GetDaemonThreadsNumber() int

func GetFsDriver

func GetFsDriver() string

func GetLogDir

func GetLogDir() string

func GetLogLevel

func GetLogLevel() string

func GetLogToStdout

func GetLogToStdout() bool

func GetMirrorsConfigDir

func GetMirrorsConfigDir() string

func GetRootMountpoint

func GetRootMountpoint() string

func GetSkipSSLVerify

func GetSkipSSLVerify() bool

func GetSnapshotsRootDir

func GetSnapshotsRootDir() string

func GetSocketRoot

func GetSocketRoot() string

func GetTarfsExportEnabled

func GetTarfsExportEnabled() bool

func GetTarfsExportFlags

func GetTarfsExportFlags() (bool, bool, bool)

Returns (wholeImage, generateBlockImage, withVerityInfo) wholeImage: generate tarfs for the whole image instead of of a specific layer. generateBlockImage: generate a block image file. withVerityInfo: generate disk verity information.

func GetTarfsMountOnHost

func GetTarfsMountOnHost() bool

func IsBackendSourceEnabled

func IsBackendSourceEnabled() bool

func IsFusedevSharedModeEnabled

func IsFusedevSharedModeEnabled() bool

func IsSystemControllerEnabled

func IsSystemControllerEnabled() bool

func MergeConfig

func MergeConfig(to, from *SnapshotterConfig) error

func ParseCgroupConfig

func ParseCgroupConfig(config CgroupConfig) (cgroup.Config, error)

func ParseParameters

func ParseParameters(args *flags.Args, cfg *SnapshotterConfig) error

Parse command line arguments and fill the nydus-snapshotter configuration Always let options from CLI override those from configuration file.

func PrepareLogDir

func PrepareLogDir(c *SnapshotterConfig)

func ProcessConfigurations

func ProcessConfigurations(c *SnapshotterConfig) error

func SetUpEnvironment

func SetUpEnvironment(c *SnapshotterConfig) error

func SystemControllerAddress

func SystemControllerAddress() string

func SystemControllerPprofAddress

func SystemControllerPprofAddress() string

func ValidateConfig

func ValidateConfig(c *SnapshotterConfig) error

Types

type AuthConfig

type AuthConfig struct {
	// based on kubeconfig or ServiceAccount
	EnableKubeconfigKeychain bool   `toml:"enable_kubeconfig_keychain"`
	KubeconfigPath           string `toml:"kubeconfig_path"`
	// CRI proxy mode
	EnableCRIKeychain   bool   `toml:"enable_cri_keychain"`
	ImageServiceAddress string `toml:"image_service_address"`
	// Kubelet credential provider plugins
	EnableKubeletCredentialProviders bool   `toml:"enable_kubelet_credential_providers"`
	CredentialProviderConfig         string `toml:"credential_provider_config"`
	CredentialProviderBinDir         string `toml:"credential_provider_bin_dir"`
	// Periodic credential renewal interval. When set to a positive duration,
	// the snapshotter caches credentials from configured renewable providers and
	// refreshes them at this interval. Set to 0 (default) to disable.
	CredentialRenewalInterval time.Duration `toml:"credential_renewal_interval"`
}

Configure how nydus-snapshotter receive auth information

type CacheManagerConfig

type CacheManagerConfig struct {
	Disable bool `toml:"disable"`
	// Trigger GC gc_period after the specified period.
	// Example format: 24h, 120min
	GCPeriod time.Duration `toml:"gc_period"`
	CacheDir string        `toml:"cache_dir"`
}

Configure cache manager that manages the cache files lifecycle

type CgroupConfig

type CgroupConfig struct {
	Enable      bool   `toml:"enable"`
	MemoryLimit string `toml:"memory_limit"`
}

type DaemonConfig

type DaemonConfig struct {
	NydusdPath       string `toml:"nydusd_path"`
	NydusdConfigPath string `toml:"nydusd_config"`
	NydusImagePath   string `toml:"nydusimage_path"`
	RecoverPolicy    string `toml:"recover_policy"`
	FsDriver         string `toml:"fs_driver"`
	ThreadsNumber    int    `toml:"threads_number"`
	LogRotationSize  int    `toml:"log_rotation_size"`
	FailoverPolicy   string `toml:"failover_policy"`
}

Configure how to start and recover nydusd daemons

type DaemonMode

type DaemonMode string

Define a policy how to fork nydusd daemon and attach file system instances to serve.

const (
	// Spawn a dedicated nydusd for each RAFS instance.
	DaemonModeMultiple DaemonMode = DaemonMode(constant.DaemonModeMultiple)
	// Spawn a dedicated nydusd for each RAFS instance.
	DaemonModeDedicated DaemonMode = DaemonMode(constant.DaemonModeDedicated)
	// Share a global nydusd to serve all RAFS instances.
	DaemonModeShared DaemonMode = DaemonMode(constant.DaemonModeShared)
	// Do not spawn nydusd for RAFS instances.
	//
	// For tarfs and rund, there's no need to create nydusd to serve RAFS instances,
	// the snapshotter just returns mount slices with additional information for runC/runD
	// to manage those snapshots.
	DaemonModeNone    DaemonMode = DaemonMode(constant.DaemonModeNone)
	DaemonModeInvalid DaemonMode = DaemonMode(constant.DaemonModeInvalid)
	// MaxRootPathLen defines the maximum allowed length of the root portion of a Unix domain socket path.
	//
	// This value is calculated based on the hard length limit of `sun_path` on Linux systems (108 bytes).
	// Nydusd's socket path format is "${rootPath}/socket/${xid}/api?.sock".
	// - The length of the fixed part "/socket/${xid}/api?.sock" is 38 bytes.
	//
	// Since the maximum upper limit of the total path length is 108 bytes, in order to avoid exceeding the limit, the maximum allowed length of rootPath is:
	// 108 - len("/socket/${xid}/api?.sock") = 108 - 38 = 70.
	// Therefore, we must set the effective maximum length of the root path to 70 bytes.
	MaxRootPathLen = 70
)

func GetDaemonMode

func GetDaemonMode() DaemonMode

type DaemonRecoverPolicy

type DaemonRecoverPolicy int
const (
	RecoverPolicyInvalid DaemonRecoverPolicy = iota
	RecoverPolicyNone
	RecoverPolicyRestart
	RecoverPolicyFailover
)

func ParseRecoverPolicy

func ParseRecoverPolicy(p string) (DaemonRecoverPolicy, error)

func (DaemonRecoverPolicy) String

func (p DaemonRecoverPolicy) String() string

type DebugConfig

type DebugConfig struct {
	ProfileDuration int64  `toml:"daemon_cpu_profile_duration_secs"`
	PprofAddress    string `toml:"pprof_address"`
}

type Experimental

type Experimental struct {
	EnableStargz         bool        `toml:"enable_stargz"`
	EnableReferrerDetect bool        `toml:"enable_referrer_detect"`
	EnableIndexDetect    bool        `toml:"enable_index_detect"`
	TarfsConfig          TarfsConfig `toml:"tarfs"`
	EnableBackendSource  bool        `toml:"enable_backend_source"`
}

type GlobalConfig

type GlobalConfig struct {
	SnapshotsDir     string
	DaemonMode       DaemonMode
	SocketRoot       string
	ConfigRoot       string
	RootMountpoint   string
	DaemonThreadsNum int
	MirrorsConfig    MirrorsConfig
	// contains filtered or unexported fields
}

Global cached configuration information to help: - access configuration information without passing a configuration object - avoid frequent generation of information from configuration information

type ImageConfig

type ImageConfig struct {
	PublicKeyFile     string `toml:"public_key_file"`
	ValidateSignature bool   `toml:"validate_signature"`
}

Nydus image layers additional process

type LoggingConfig

type LoggingConfig struct {
	LogToStdout         bool   `toml:"log_to_stdout"`
	LogLevel            string `toml:"level"`
	LogDir              string `toml:"dir"`
	RotateLogMaxSize    int    `toml:"log_rotation_max_size"`
	RotateLogMaxBackups int    `toml:"log_rotation_max_backups"`
	RotateLogMaxAge     int    `toml:"log_rotation_max_age"`
	RotateLogLocalTime  bool   `toml:"log_rotation_local_time"`
	RotateLogCompress   bool   `toml:"log_rotation_compress"`
}

type MetricsConfig

type MetricsConfig struct {
	// Address is the network address for the metrics server. Empty indicates the server is disabled.
	Address string `toml:"address"`
	// HungIOInterval defines the timeout for a single I/O operation to be considered "hung".
	HungIOInterval time.Duration `toml:"hung_io_interval"`
	// CollectInterval defines how often metrics are collected and reported.
	CollectInterval time.Duration `toml:"collect_interval"`
}

type MirrorsConfig

type MirrorsConfig struct {
	Dir string `toml:"dir"`
}

type RemoteConfig

type RemoteConfig struct {
	AuthConfig         AuthConfig    `toml:"auth"`
	ConvertVpcRegistry bool          `toml:"convert_vpc_registry"`
	SkipSSLVerify      bool          `toml:"skip_ssl_verify"`
	MirrorsConfig      MirrorsConfig `toml:"mirrors_config"`
}

Configure remote storage like container registry

type SnapshotConfig

type SnapshotConfig struct {
	EnableNydusOverlayFS bool   `toml:"enable_nydus_overlayfs"`
	NydusOverlayFSPath   string `toml:"nydus_overlayfs_path"`
	EnableKataVolume     bool   `toml:"enable_kata_volume"`
	SyncRemove           bool   `toml:"sync_remove"`
	// EnableOverlayfsVolatile globally enables the "volatile" overlayfs mount option
	// on all writable snapshots. This skips sync on the upper layer, improving
	// write performance for ephemeral container filesystems at the cost of crash consistency.
	EnableOverlayfsVolatile bool `toml:"enable_overlayfs_volatile"`
}

Configure containerd snapshots interfaces and how to process the snapshots requests from containerd

type SnapshotterConfig

type SnapshotterConfig struct {
	// Configuration format version
	Version int `toml:"version"`
	// Snapshotter's root work directory
	Root    string `toml:"root"`
	Address string `toml:"address"`
	// UID to set on the snapshotter socket
	UID int `toml:"uid"`
	// GID to set on the snapshotter socket
	GID        int    `toml:"gid"`
	DaemonMode string `toml:"daemon_mode"`
	// Clean up all the resources when snapshotter is closed
	CleanupOnClose bool `toml:"cleanup_on_close"`

	SystemControllerConfig SystemControllerConfig `toml:"system"`
	MetricsConfig          MetricsConfig          `toml:"metrics"`
	DaemonConfig           DaemonConfig           `toml:"daemon"`
	SnapshotsConfig        SnapshotConfig         `toml:"snapshot"`
	RemoteConfig           RemoteConfig           `toml:"remote"`
	ImageConfig            ImageConfig            `toml:"image"`
	CacheManagerConfig     CacheManagerConfig     `toml:"cache_manager"`
	LoggingConfig          LoggingConfig          `toml:"log"`
	CgroupConfig           CgroupConfig           `toml:"cgroup"`
	Experimental           Experimental           `toml:"experimental"`
}

func LoadSnapshotterConfig

func LoadSnapshotterConfig(path string) (*SnapshotterConfig, error)

func (*SnapshotterConfig) FillUpWithDefaults

func (c *SnapshotterConfig) FillUpWithDefaults() error

func (*SnapshotterConfig) SetupNydusBinaryPaths

func (c *SnapshotterConfig) SetupNydusBinaryPaths() error

type SystemControllerConfig

type SystemControllerConfig struct {
	Enable  bool   `toml:"enable"`
	Address string `toml:"address"`
	// UID to set on the system controller socket
	UID int `toml:"uid"`
	// GID to set on the system controller socket
	GID         int         `toml:"gid"`
	DebugConfig DebugConfig `toml:"debug"`
}

type TarfsConfig

type TarfsConfig struct {
	EnableTarfs       bool   `toml:"enable_tarfs"`
	MountTarfsOnHost  bool   `toml:"mount_tarfs_on_host"`
	TarfsHint         bool   `toml:"tarfs_hint"`
	MaxConcurrentProc int    `toml:"max_concurrent_proc"`
	ExportMode        string `toml:"export_mode"`
}

Source Files

config.go default.go global.go

Directories

PathSynopsis
config/daemonconfig
Version
v0.15.15 (latest)
Published
Apr 17, 2026
Platform
linux/amd64
Imports
17 packages
Last checked
1 hour ago

Tools for package owners.