sidecarmounter

package
v1.24.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GCSFuseAppName = "gke-gcs-fuse-csi"
	TempDir        = "/temp-dir"

	TokenFileName              = "token.sock" // #nosec G101
	KernelParamsFileConfigFlag = "file-system:kernel-params-file"
)

Variables

View Source
var DisallowedFlags = map[string]string{

	"log-file":   "logging:file-path",
	"log-format": "logging:format",
	"o":          "o",
	"cache-dir":  "cache-dir",

	"temp-dir":                 "temp-dir",
	"config-file":              "config-file",
	"foreground":               "foreground",
	"key-file":                 "gcs-auth:key-file",
	"token-url":                "gcs-auth:token-url",
	"reuse-token-from-url":     "gcs-auth:reuse-token-from-url",
	"prometheus-port":          "prometheus-port",
	"kernel-params-file":       "file-system:kernel-params-file",
	KernelParamsFileConfigFlag: KernelParamsFileConfigFlag,
}

DisallowedFlags is a map of flags that are disallowed to be passed to sidecar mounter directly. They are mapped to their config file style representation so that they can be passed in config file format as a workaround to bypass the disallowed flags validation. Note: If you add a new disallowed flag here that is needed for integration testing, you should also update the ParseConfigFlags() logic in test/e2e/utils/utils.go to handle it.

Functions

func NewErrorWriter

func NewErrorWriter(errorFile string) stderrWriterInterface

func ReadDriverFlagsForDefaulting added in v1.24.0

func ReadDriverFlagsForDefaulting(defaultFilePath string) (map[string]string, error)

ReadDriverFlagsForDefaulting reads the defaulting flags file written by the CSI driver into the emptyDir volume and parses its content into a map of flag key-value pairs. If the file does not exist, it returns an empty map and nil error.

func StartCloudProfiler added in v1.24.0

func StartCloudProfiler(serviceName string, podName string, podUID string)

StartCloudProfiler starts the Google Cloud Profiler. It uses sync.Once to ensure the profiler is started at most once per process.

func StartTokenServer added in v1.11.0

func StartTokenServer(ctx context.Context, tokenURLBasePath, tokenSocketName string, identityProvider string)

Types

type MountConfig

type MountConfig struct {
	FileDescriptor                 int                   `json:"-"`
	VolumeName                     string                `json:"volumeName,omitempty"`
	BucketName                     string                `json:"bucketName,omitempty"`
	BufferDir                      string                `json:"-"`
	CacheDir                       string                `json:"-"`
	TempDir                        string                `json:"-"`
	ConfigFile                     string                `json:"-"`
	Options                        []string              `json:"options,omitempty"`
	ErrWriter                      stderrWriterInterface `json:"-"`
	FlagMap                        map[string]string     `json:"-"`
	ConfigFileFlagMap              map[string]string     `json:"-"`
	TokenServerIdentityProvider    string                `json:"-"`
	HostNetworkKSAOptIn            bool                  `json:"-"`
	EnableGCSFuseKernelParams      bool                  `json:"-"`
	EnableCloudProfilerForSidecar  bool                  `json:"-"`
	PodNamespace                   string                `json:"-"`
	ServiceAccountName             string                `json:"-"`
	PodName                        string                `json:"-"`
	PodUID                         string                `json:"-"`
	EnableSidecarBucketAccessCheck bool                  `json:"-"`
	TokenServerIdentityPool        string                `json:"-"`
	SidecarRetryConfig             sidecarRetryConfig    `json:"-"`
	FileCacheMedium                string                `json:"-"`
	GcsFuseNumaNode                int                   `json:"-"`
	CustomEndpoint                 string                `json:"-"`
	EnableAutoGoMemLimit           bool                  `json:"-"`
	AutoGoMemLimitRatio            float64               `json:"-"`
	StorageEndpoint                string                `json:"-"`
	SharedMountPoint               string                `json:"-"`
}

MountConfig contains the information gcsfuse needs.

func NewMountConfig added in v0.1.14

func NewMountConfig(sp string, flagMapFromDriver map[string]string) *MountConfig

Fetch the following information from a given socket path: 1. Pod volume name 2. The file descriptor 3. GCS bucket name 4. Mount options passing to gcsfuse (passed by the csi mounter).

func (*MountConfig) EnsureErrWriter added in v1.23.19

func (mc *MountConfig) EnsureErrWriter()

EnsureErrWriter safely initializes ErrWriter to the correct writer if it is nil.

type Mounter

type Mounter struct {
	WaitGroup             sync.WaitGroup
	TokenManager          auth.TokenManager
	StorageServiceManager storage.ServiceManager
	// contains filtered or unexported fields
}

Mounter will be used in the sidecar container to invoke gcsfuse.

func New

func New(mounterPath string) *Mounter

New returns a Mounter for the current system. It provides an option to specify the path to gcsfuse binary.

func (*Mounter) Mount

func (m *Mounter) Mount(ctx context.Context, mc *MountConfig) error

func (*Mounter) MountToNode added in v1.24.0

func (m *Mounter) MountToNode(ctx context.Context, mountServerContext context.Context, mc *MountConfig) error

MountToNode uses the mount config to initialize the GCSFuse process for a share node mount architecture. mountServerContext is the long running context from the sidecar, using this prevents the gcsfuse process from being killed when the NodeStageVolume context (the ctx variable) is canceled.

func (*Mounter) SetupTokenAndStorageManager added in v1.19.0

func (m *Mounter) SetupTokenAndStorageManager(ctx context.Context, clientset clientset.Interface, mc *MountConfig) error

type MounterServer added in v1.24.0

type MounterServer struct {
	mounter.UnimplementedMounterServer
	// contains filtered or unexported fields
}

func NewMounterServer added in v1.24.0

func NewMounterServer(ctx context.Context, mounter *Mounter) *MounterServer

func (*MounterServer) Mount added in v1.24.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL