commonco

package
v3.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInitParams

func SetInitParams(ctx context.Context, clusterFlavor cnstypes.CnsClusterFlavor, initParams *interface{},
	supervisorFSSName, supervisorFSSNamespace, internalFSSName, internalFSSNamespace, serviceMode,
	operationMode string)

SetInitParams initializes the parameters required to create a container agnostic orchestrator instance.

Types

type COCommonInterface

type COCommonInterface interface {
	// IsFSSEnabled checks if feature state switch is enabled for the given feature indicated
	// by featureName.
	IsFSSEnabled(ctx context.Context, featureName string) bool
	// IsFakeAttachAllowed checks if the passed volume can be fake attached.
	IsFakeAttachAllowed(ctx context.Context, volumeID string, volumeManager cnsvolume.Manager) (bool, error)
	// MarkFakeAttached marks the volume as fake attached.
	MarkFakeAttached(ctx context.Context, volumeID string) error
	// ClearFakeAttached checks if the volume was fake attached, and unmark it as not fake attached.
	ClearFakeAttached(ctx context.Context, volumeID string) error
	// InitTopologyServiceInController initializes the necessary resources
	// required for topology related functionality in the controller.
	InitTopologyServiceInController(ctx context.Context) (types.ControllerTopologyService, error)
	// InitTopologyServiceInNode initializes the necessary resources
	// required for topology related functionality in the nodes.
	InitTopologyServiceInNode(ctx context.Context) (types.NodeTopologyService, error)
	// GetNodesForVolumes returns a map of volumeID to list of node names
	GetNodesForVolumes(ctx context.Context, volumeIds []string) map[string][]string
	// GetNodeIDtoNameMap returns a map of node ID  to node names
	GetNodeIDtoNameMap(ctx context.Context) map[string]string
	// GetFakeAttachedVolumes returns a map of volumeIDs to a bool, which is set
	// to true if volumeID key is fake attached else false
	GetFakeAttachedVolumes(ctx context.Context, volumeIDs []string) map[string]bool
	//GetVolumeAttachment is used to fetch the VA object from the cluster.
	GetVolumeAttachment(ctx context.Context, volumeId string, nodeName string) (*storagev1.VolumeAttachment, error)
	// GetAllVolumes returns list of volumes in a bound state
	GetAllVolumes() []string
	// GetAllK8sVolumes returns list of volumes in a bound state, in the K8s cluster
	// list Includes Migrated vSphere Volumes VMDK Paths and CSI Volume IDs
	GetAllK8sVolumes() []string
	// AnnotateVolumeSnapshot annotates the volumesnapshot CR in k8s cluster with the snapshot-id and fcd-id
	AnnotateVolumeSnapshot(ctx context.Context, volumeSnapshotName string,
		volumeSnapshotNamespace string, annotations map[string]string) (bool, error)
	// GetConfigMap checks if ConfigMap with given name exists in the given namespace.
	// If it exists, this function returns ConfigMap data, otherwise returns error.
	GetConfigMap(ctx context.Context, name string, namespace string) (map[string]string, error)
	// CreateConfigMap creates the ConfigMap with given name, namespace, data and immutable
	// parameter values.
	CreateConfigMap(ctx context.Context, name string, namespace string, data map[string]string,
		isImmutable bool) error
	// GetCSINodeTopologyInstancesList lists CSINodeTopology instances for a given cluster.
	GetCSINodeTopologyInstancesList() []interface{}
	// GetCSINodeTopologyInstanceByName fetches the CSINodeTopology instance for a given node name in the cluster.
	GetCSINodeTopologyInstanceByName(nodeName string) (item interface{}, exists bool, err error)
	// GetPVNameFromCSIVolumeID retrieves the pv name from the volumeID.
	// This method will not return pv name in case of in-tree migrated volumes
	GetPVNameFromCSIVolumeID(volumeID string) (string, bool)
	// InitializeCSINodes creates CSINode instances for each K8s node with the appropriate topology keys.
	InitializeCSINodes(ctx context.Context) error
}

COCommonInterface provides functionality to define container orchestrator related implementation to read resources/objects.

var ContainerOrchestratorUtility COCommonInterface

ContainerOrchestratorUtility represents the singleton instance of container orchestrator interface.

func GetContainerOrchestratorInterface

func GetContainerOrchestratorInterface(ctx context.Context, orchestratorType int,
	clusterFlavor cnstypes.CnsClusterFlavor, params interface{}) (COCommonInterface, error)

GetContainerOrchestratorInterface returns orchestrator object for a given container orchestrator type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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