flexvolume

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptionFSType    = "kubernetes.io/fsType"
	OptionReadWrite = "kubernetes.io/readwrite"
	OptionKeySecret = "kubernetes.io/secret"
	OptionFSGroup   = "kubernetes.io/fsGroup"
	OptionMountsDir = "kubernetes.io/mountsDir"

	OptionKeyPodName      = "kubernetes.io/pod.name"
	OptionKeyPodNamespace = "kubernetes.io/pod.namespace"
	OptionKeyPodUID       = "kubernetes.io/pod.uid"

	OptionKeyServiceAccountName = "kubernetes.io/serviceAccount.name"
)

Option keys

Variables

This section is empty.

Functions

func ExecDriver

func ExecDriver(logger *zap.SugaredLogger, driver Driver, args []string)

ExecDriver executes the appropriate FlexvolumeDriver command based on recieved call-out.

func ExitWithResult

func ExitWithResult(logger *zap.SugaredLogger, result DriverStatus)

ExitWithResult outputs the given Result and exits with the appropriate exit code.

Types

type Driver

type Driver interface {
	Init(logger *zap.SugaredLogger) DriverStatus
	Attach(logger *zap.SugaredLogger, opts Options, nodeName string) DriverStatus
	Detach(logger *zap.SugaredLogger, mountDevice, nodeName string) DriverStatus
	WaitForAttach(mountDevice string, opts Options) DriverStatus
	IsAttached(logger *zap.SugaredLogger, opts Options, nodeName string) DriverStatus
	MountDevice(logger *zap.SugaredLogger, mountDir, mountDevice string, opts Options) DriverStatus
	UnmountDevice(logger *zap.SugaredLogger, mountDevice string) DriverStatus
	Mount(logger *zap.SugaredLogger, mountDir string, opts Options) DriverStatus
	Unmount(logger *zap.SugaredLogger, mountDir string) DriverStatus
}

Driver is the main Flexvolume interface.

type DriverStatus

type DriverStatus struct {
	// Status of the callout. One of "Success", "Failure" or "Not supported".
	Status Status `json:"status"`
	// Reason for success/failure.
	Message string `json:"message,omitempty"`
	// Path to the device attached. This field is valid only for attach calls.
	// e.g: /dev/sdx
	Device string `json:"device,omitempty"`
	// Represents volume is attached on the node.
	Attached bool `json:"attached,omitempty"`
}

DriverStatus of a Flexvolume driver call.

func Fail

func Fail(logger *zap.SugaredLogger, a ...interface{}) DriverStatus

Fail creates a StatusFailure Result with a given message.

func NotSupported

func NotSupported(logger *zap.SugaredLogger, a ...interface{}) DriverStatus

NotSupported creates a StatusNotSupported Result with a given message.

func Succeed

func Succeed(logger *zap.SugaredLogger, a ...interface{}) DriverStatus

Succeed creates a StatusSuccess Result with a given message.

type Options

type Options map[string]string

Options is the map (passed as JSON) to some Flexvolume calls.

func DecodeKubeSecrets

func DecodeKubeSecrets(opts Options) (Options, error)

DecodeKubeSecrets takes the options passed to the driver and decodes any secrets.

type Status

type Status string

Status denotes the state of a Flexvolume call.

const (
	// StatusSuccess indicates that the driver call has succeeded.
	StatusSuccess Status = "Success"
	// StatusFailure indicates that the driver call has failed.
	StatusFailure Status = "Failure"
	// StatusNotSupported indicates that the driver call is not supported.
	StatusNotSupported Status = "Not supported"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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