plugin

package
v4.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DriverConfigFile represents volume driver config file
	DriverConfigFile = "volume-driver.json"
	// EnvManagedPlugin represents if running as docker managed plugin
	EnvManagedPlugin = "MANAGED_PLUGIN"
	// EnvPluginType represents underlying storage platform type which plugin is servicing
	EnvPluginType = "PLUGIN_TYPE"
	// EnvScope represents plugin scope, i.e global or local
	EnvScope = "SCOPE"
	// DeleteConflictDelayKey represents key name for wait on conflicts during remove
	DeleteConflictDelayKey = "deleteConflictDelay"
	// DefaultDeleteConflictDelay represents delay to wait on conflicts during remove
	DefaultDeleteConflictDelay = 150
	// MountConflictDelayKey represents the key name for wait on conflicts for mount
	MountConflictDelayKey = "mountConflictDelay"
	// DefaultMountConflictDelay represents the default delay to wait on conflicts during mount
	DefaultMountConflictDelay = 120
)
View Source
const (
	// Global section type
	Global = iota + 1
	// Defaults section type
	Defaults
	// Overrides section type
	Overrides
)
View Source
const (
	// PluginBaseDir represents base directory for plugin install
	PluginBaseDir = "/opt/hpe-storage/"
	// PluginSocketPath represents flexvolume plugin sockets directory
	PluginSocketPath = "/etc/hpe-storage/"
	// ManagedPluginSocketPath represents plugin socket path for docker managed plugins
	ManagedPluginSocketPath = "/run/docker/plugins/"
	// PluginSpecPath represents docker plugin spec directory
	PluginSpecPath = "/etc/docker/plugins/"
	// ConfigBaseDir represents user facing config directory for plugin
	ConfigBaseDir = "/etc/hpe-storage/"
	// MountBaseDir represents base directory for plugin volume mounts
	MountBaseDir = "/var/lib/kubelet/plugins/hpe.com/mounts/"
	// PluginLogFile represents plugin log location
	PluginLogFile = "/var/log/hpe-docker-plugin.log"
	// ManagedPluginSocketName represents plugin socket name for managed plugins
	ManagedPluginSocketName = "hpe-plugin.sock"
)

Variables

View Source
var (
	// VolumeDriverConfig represent cache of volume-driver.json loaded
	VolumeDriverConfig *ConfigCache

	// Version of Plugin
	Version = "dev"
	// DeleteConflictDelay represent conflict delay to wait during remove
	DeleteConflictDelay = DefaultDeleteConflictDelay
	// MountConflictDelay represent conflict delay to wait during mount
	MountConflictDelay = DefaultMountConflictDelay
)
View Source
var (
	// PluginConfigDir represents config directory for plugin
	PluginConfigDir = ""
	// MountDir represents volume mount directory for the plugin
	MountDir = ""
	// SupportedFileSystems represent filesystem types supported for formatting with our plugin
	SupportedFileSystems = []string{"xfs", "btrfs", "ext2", "ext3", "ext4"}
)

Functions

func CreateConfDirectory

func CreateConfDirectory(confDir string) error

CreateConfDirectory :

func GetDriverScope

func GetDriverScope() (scope string)

GetDriverScope returns plugin scope configured

func GetOrCreatePluginConfigDirectory

func GetOrCreatePluginConfigDirectory() (string, error)

GetOrCreatePluginConfigDirectory get or create plugin config directory

func GetOrCreatePluginMountDirectory

func GetOrCreatePluginMountDirectory() (string, error)

GetOrCreatePluginConfigDirectory get or create plugin mount directory TODO: handle mountDir from volume-driver.json

func GetUpdatedOptsFromConfig

func GetUpdatedOptsFromConfig(reqOpts map[string]interface{}) (updatedOpts map[string]interface{}, err error)

GetUpdatedOptsFromConfig returns updated options after combining options from config files

func InitializeDeleteConflictDelay

func InitializeDeleteConflictDelay()

InitializeDeleteConflictDelay initializes deleteConflictDelay nolint : dupl

func InitializeMountConflictDelay

func InitializeMountConflictDelay()

InitializeMountConflictDelay initializes mountConflictDelay nolint : dupl

func IsLocalScopeDriver

func IsLocalScopeDriver() bool

IsLocalScopeDriver return true if its a local scoped driver, false otherwise

func IsManagedPlugin

func IsManagedPlugin() bool

IsManagedPlugin returns true if the plugin is deployed as docker managed plugin

func LoadHPEVolConfig

func LoadHPEVolConfig() (err error)

LoadHPEVolConfig loads the container config json file

func PreparePluginSocket

func PreparePluginSocket() (listener net.Listener, err error)

PreparePluginSocket will setup socket path and listener

func UpdateVolumeDriverConfigCache

func UpdateVolumeDriverConfigCache(volumeDriverConfigFile string)

UpdateVolumeDriverConfigCache updates the volume driver config cache

Types

type ConfigCache

type ConfigCache struct {
	// contains filtered or unexported fields
}

ConfigCache to store config options

func (*ConfigCache) GetCache

func (c *ConfigCache) GetCache() *jconfig.Config

GetCache returns volume-driver.json config

type PluginType

type PluginType int

PluginType indicates the docker volume plugin type

const (
	// nimble on-prem plugin type
	Nimble PluginType = 1 + iota
	// hpe cloud volumes plugin type
	Cv
	// simplivity plugin type
	Simplivity
)

func GetPluginType

func GetPluginType() (plugin PluginType)

func (PluginType) String

func (plugin PluginType) String() string

type Section

type Section int

Section different config section

func (Section) String

func (s Section) String() string

Jump to

Keyboard shortcuts

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