client

package
v1.10.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Controller                 = "CONTROLLER"
	Satellite                  = "SATELLITE"
	Online                     = "ONLINE"
	Offline                    = "OFFLINE"
	DefaultHTTPPort            = 3370
	DefaultHTTPSPort           = 3371
	ControllerReachableTimeout = 10 * time.Second
)

Various lapi consts yet to be defined in golinstor.

View Source
const (
	SecretCARootName = "ca.crt"
	SecretKeyName    = "tls.key"
	SecretCertName   = "tls.crt"
)

Consts for extracting TLS certificates from api resources

Variables

This section is empty.

Functions

func APIResourceAsEnvVars added in v0.4.0

func APIResourceAsEnvVars(endpoint string, resource *shared.LinstorClientConfig) []corev1.EnvVar

Convert a LinstorClientConfig into env variables understood by the CSI plugins and golinstor client See also: https://pkg.go.dev/github.com/LINBIT/golinstor/client?tab=doc#NewClient

func DefaultControllerServiceEndpoint added in v0.4.0

func DefaultControllerServiceEndpoint(serviceName types.NamespacedName, useHTTPS bool) string

func Logr added in v1.10.3

func Logr(l logr.Logger) lapi.Option

Types

type GlobalLinstorClientConfig added in v0.4.0

type GlobalLinstorClientConfig struct {
	// Comma separated list of of LINSTOR REST API endpoints
	Controllers []string `ini:"controllers" delim:"|"`
	// Path to the PEM encoded root certificates used for HTTPS connections
	CAFile string `ini:"cafile,omitempty"`
	// Path to the PEM encoded certificate to present when TLS authentication is required
	Certfile string `ini:"certfile,omitempty"`
	// Path to the PEM encoded private key used when TLS authentication is required
	Keyfile string `ini:"keyfile,omitempty"`
}

Global linstor client configuration, like controllers and connection settings

type HighLevelClient

type HighLevelClient struct {
	lapi.Client
}

HighLevelClient is a golinstor client with convience functions.

func NewHighLevelClient

func NewHighLevelClient(options ...lapi.Option) (*HighLevelClient, error)

NewHighLevelClient returns a pointer to a golinstor client with convience.

func NewHighLevelLinstorClientFromConfig added in v0.4.0

func NewHighLevelLinstorClientFromConfig(endpoint string, config *shared.LinstorClientConfig, secretFetcher SecretFetcher, log logr.Logger) (*HighLevelClient, error)

NewHighLevelLinstorClientFromConfig configures a HighLevelClient with an in-cluster url based on service naming convention.

func (*HighLevelClient) ControllerReachable added in v1.7.0

func (c *HighLevelClient) ControllerReachable(ctx context.Context) bool

ControllerReachable returns true if the LINSTOR controller is up.

func (*HighLevelClient) GetAllResourcesOnNode

func (c *HighLevelClient) GetAllResourcesOnNode(ctx context.Context, nodeName string) ([]lapi.ResourceWithVolumes, error)

GetAllResourcesOnNode returns a list of all resources on the specified node.

func (*HighLevelClient) GetAllStorageNodes

func (c *HighLevelClient) GetAllStorageNodes(ctx context.Context) ([]StorageNode, error)

GetAllStorageNodes returns a list of all Satellite nodes with a list of their storage pools.

func (*HighLevelClient) GetNodeOrCreate

func (c *HighLevelClient) GetNodeOrCreate(ctx context.Context, node lapi.Node) (*lapi.Node, error)

GetNodeOrCreate gets a linstor node, creating it if it is not already present.

type LinstorClientConfig added in v0.4.0

type LinstorClientConfig struct {
	Global GlobalLinstorClientConfig `ini:"global"`
}

LinstorClientConfig is the go representation of `/etc/linstor/linstor-client.conf`.

func NewClientConfigForAPIResource added in v0.4.0

func NewClientConfigForAPIResource(endpoint string, resource *shared.LinstorClientConfig) *LinstorClientConfig

Create a client config from an API resource.

func (*LinstorClientConfig) ToConfigFile added in v0.4.0

func (clientConfig *LinstorClientConfig) ToConfigFile() (string, error)

type SecretFetcher added in v0.4.0

type SecretFetcher func(string) (map[string][]byte, error)

func NamedSecret added in v1.7.0

func NamedSecret(ctx context.Context, client client.Client, namespace string) SecretFetcher

NamedSecret returns a SecretFetcher for the named secret.

type StorageNode

type StorageNode struct {
	lapi.Node
	StoragePools []lapi.StoragePool
}

StorageNode is a linstor node with its respective storage pools.

Jump to

Keyboard shortcuts

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