utils

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultReleaseName constant
	DefaultReleaseName = "<DriverDefaultReleaseName>"
	// DefaultReleaseNamespace constant
	DefaultReleaseNamespace = "<DriverDefaultReleaseNamespace>"
	// DefaultImagePullPolicy constant
	DefaultImagePullPolicy = "IfNotPresent"
	// KubeletConfigDir path
	KubeletConfigDir = "<KUBELET_CONFIG_DIR>"
	// ReplicationControllerNameSpace -
	ReplicationControllerNameSpace = "dell-replication-controller"
	// ReplicationControllerManager -
	ReplicationControllerManager = "dell-replication-controller-manager"
	// ReplicationControllerInit -
	ReplicationControllerInit = "dell-replication-controller-init"
	// ReplicationSideCarName -
	ReplicationSideCarName = "dell-csi-replicator"
	// ResiliencySideCarName -
	ResiliencySideCarName = "podmon"
	// DefaultSourceClusterID -
	DefaultSourceClusterID = "default-source-cluster"
	// ObservabilityNamespace - karavi
	ObservabilityNamespace = "karavi"
	// AuthorizationNamespace - authorization
	AuthorizationNamespace = "authorization"
	// AuthProxyServerComponent - karavi-authorization-proxy-server component
	AuthProxyServerComponent = "karavi-authorization-proxy-server"
	// PodmonControllerComponent - podmon-controller
	PodmonControllerComponent = "podmon-controller"
	// PodmonNodeComponent - podmon-node
	PodmonNodeComponent = "podmon-node"
	// ApplicationMobilityNamespace - application-mobility
	ApplicationMobilityNamespace = "application-mobility"
)

Variables

View Source
var NewControllerRuntimeClientWrapper = func(clusterConfigData []byte) (crclient.Client, error) {
	return k8sClient.NewControllerRuntimeClient(clusterConfigData)
}

NewControllerRuntimeClientWrapper -

View Source
var NewK8sClientWrapper = func(clusterConfigData []byte) (*kubernetes.Clientset, error) {
	restConfig, err := clientcmd.RESTConfigFromKubeConfig(clusterConfigData)
	if err != nil {
		return nil, err
	}

	return kubernetes.NewForConfig(restConfig)
}

NewK8sClientWrapper -

Functions

func ApplyCTRLObject added in v1.0.0

func ApplyCTRLObject(ctx context.Context, obj crclient.Object, ctrlClient crclient.Client) error

ApplyCTRLObject -

func ApplyObject added in v0.2.0

func ApplyObject(ctx context.Context, obj crclient.Object, ctrlClient crclient.Client) error

ApplyObject -

func Contains added in v1.0.0

func Contains(slice []string, str string) bool

Contains - check if slice contains the specified string

func DeleteObject added in v0.2.0

func DeleteObject(ctx context.Context, obj crclient.Object, ctrlClient crclient.Client) error

DeleteObject -

func DetermineUnitTestRun added in v1.4.3

func DetermineUnitTestRun(ctx context.Context) bool

DetermineUnitTestRun will determine if this reconcile call is part of unit test run

func GetBackupStorageLocation added in v1.4.0

func GetBackupStorageLocation(ctx context.Context, name, namespace string, ctrlClient crclient.Client) (*velerov1.BackupStorageLocation, error)

GetBackupStorageLocation - check if the Backup Storage Location is present

func GetCTRLObject added in v0.2.0

func GetCTRLObject(CtrlBuf []byte) ([]crclient.Object, error)

GetCTRLObject - get controller object

func GetDriverYaml

func GetDriverYaml(YamlString, kind string) (interface{}, error)

GetDriverYaml -

func GetModuleComponentObj added in v1.0.0

func GetModuleComponentObj(CtrlBuf []byte) ([]crclient.Object, error)

GetModuleComponentObj - get module component object from config yaml string

func GetModuleDefaultVersion

func GetModuleDefaultVersion(driverConfigVersion string, driverType csmv1.DriverType, moduleType csmv1.ModuleType, path string) (string, error)

GetModuleDefaultVersion -

func GetNginxControllerStatus added in v1.0.0

func GetNginxControllerStatus(ctx context.Context, instance csmv1.ContainerStorageModule, r ReconcileCSM) wait.ConditionFunc

GetNginxControllerStatus - gets deployment status of the NGINX ingress controller

func GetSecret added in v1.0.0

func GetSecret(ctx context.Context, name, namespace string, ctrlClient crclient.Client) (*corev1.Secret, error)

GetSecret - check if the secret is present

func GetVolumeSnapshotLocation added in v1.4.0

func GetVolumeSnapshotLocation(ctx context.Context, name, namespace string, ctrlClient crclient.Client) (*velerov1.VolumeSnapshotLocation, error)

GetVolumeSnapshotLocation - check if the Volume Snapshot Location is present

func HandleAccSuccess added in v1.4.0

func HandleAccSuccess(ctx context.Context, instance *csmv1.ApexConnectivityClient, r ReconcileCSM, newStatus, oldStatus *csmv1.ApexConnectivityClientStatus) (reconcile.Result, error)

HandleAccSuccess for csm

func HandleAccValidationError added in v1.4.0

func HandleAccValidationError(ctx context.Context, instance *csmv1.ApexConnectivityClient, r ReconcileCSM,
	validationError error,
) (reconcile.Result, error)

HandleAccValidationError for csm

func HandleSuccess

func HandleSuccess(ctx context.Context, instance *csmv1.ContainerStorageModule, r ReconcileCSM, newStatus, oldStatus *csmv1.ContainerStorageModuleStatus) (reconcile.Result, error)

HandleSuccess for csm

func HandleValidationError

func HandleValidationError(ctx context.Context, instance *csmv1.ContainerStorageModule, r ReconcileCSM,
	validationError error,
) (reconcile.Result, error)

HandleValidationError for csm

func IsAppMobilityComponentEnabled added in v1.4.0

func IsAppMobilityComponentEnabled(ctx context.Context, instance csmv1.ContainerStorageModule, _ ReconcileCSM, mod csmv1.ModuleType, componentType string) bool

IsAppMobilityComponentEnabled - check if Application Mobility componenets are enabled

func IsModuleComponentEnabled added in v1.3.0

func IsModuleComponentEnabled(ctx context.Context, instance csmv1.ContainerStorageModule, mod csmv1.ModuleType, componentType string) bool

IsModuleComponentEnabled - check if module components are enabled

func IsModuleEnabled added in v1.0.0

func IsModuleEnabled(_ context.Context, instance csmv1.ContainerStorageModule, mod csmv1.ModuleType) (bool, csmv1.Module)

IsModuleEnabled - check if the module is enabled

func IsResiliencyModuleEnabled added in v1.2.0

func IsResiliencyModuleEnabled(_ context.Context, instance csmv1.ContainerStorageModule, _ ReconcileCSM) bool

IsResiliencyModuleEnabled - check if resiliency module is enabled or not

func LogBannerAndReturn

func LogBannerAndReturn(result reconcile.Result, err error) (reconcile.Result, error)

LogBannerAndReturn -

func MinVersionCheck added in v0.2.0

func MinVersionCheck(minVersion string, version string) (bool, error)

MinVersionCheck takes a driver name and a version of the form "vA.B.C" and checks it against the minimum version for the specified driver

func ModifyCommonCR

func ModifyCommonCR(YamlString string, cr csmv1.ContainerStorageModule) string

ModifyCommonCR -

func ModifyCommonCRs added in v1.4.0

func ModifyCommonCRs(YamlString string, cr csmv1.ApexConnectivityClient) string

ModifyCommonCRs - update with common values

func ReplaceAllApplyCustomEnvs

func ReplaceAllApplyCustomEnvs(driverEnv []acorev1.EnvVarApplyConfiguration,
	commonEnv []corev1.EnvVar,
	nrEnv []corev1.EnvVar,
) []acorev1.EnvVarApplyConfiguration

ReplaceAllApplyCustomEnvs -

func ReplaceAllArgs

func ReplaceAllArgs(defaultArgs, crArgs []string) []string

ReplaceAllArgs -

func ReplaceAllContainerImageApply

func ReplaceAllContainerImageApply(img K8sImagesConfig, c *acorev1.ContainerApplyConfiguration)

ReplaceAllContainerImageApply -

func SetAccStatus added in v1.4.0

SetAccStatus of csm

func SetStatus

SetStatus of csm

func SplitYaml

func SplitYaml(gaintYAML []byte) ([][]byte, error)

SplitYaml divides a big bytes of yaml files in individual yaml files.

func UpdateAccStatus added in v1.4.0

func UpdateAccStatus(ctx context.Context, instance *csmv1.ApexConnectivityClient, r ReconcileCSM, newStatus *csmv1.ApexConnectivityClientStatus) error

UpdateAccStatus of csm

func UpdateSideCarApply

func UpdateSideCarApply(sideCars []csmv1.ContainerTemplate, c *acorev1.ContainerApplyConfiguration)

UpdateSideCarApply -

func UpdateStatus

UpdateStatus of csm

func UpdateinitContainerApply added in v1.0.0

func UpdateinitContainerApply(initContainers []csmv1.ContainerTemplate, c *acorev1.ContainerApplyConfiguration)

UpdateinitContainerApply -

func WaitForNginxController added in v1.0.0

func WaitForNginxController(ctx context.Context, instance csmv1.ContainerStorageModule, r ReconcileCSM, timeout time.Duration) error

WaitForNginxController - polls deployment status

Types

type ControllerYAML

type ControllerYAML struct {
	Deployment confv1.DeploymentApplyConfiguration
	Rbac       RbacYAML
}

ControllerYAML -

type FakeReconcileCSM added in v0.2.0

type FakeReconcileCSM struct {
	reconcile.Reconciler
	crclient.Client
	K8sClient kubernetes.Interface
	// contains filtered or unexported fields
}

FakeReconcileCSM -

func (*FakeReconcileCSM) GetClient added in v0.2.0

func (r *FakeReconcileCSM) GetClient() crclient.Client

GetClient -

func (*FakeReconcileCSM) GetK8sClient added in v0.2.0

func (r *FakeReconcileCSM) GetK8sClient() kubernetes.Interface

GetK8sClient - Returns the current update count

func (*FakeReconcileCSM) GetUpdateCount added in v0.2.0

func (r *FakeReconcileCSM) GetUpdateCount() int32

GetUpdateCount - Returns the current update count

func (*FakeReconcileCSM) IncrUpdateCount added in v0.2.0

func (r *FakeReconcileCSM) IncrUpdateCount()

IncrUpdateCount - Increments the update count

type K8sImagesConfig

type K8sImagesConfig struct {
	K8sVersion string `json:"kubeversion" yaml:"kubeversion"`
	Images     struct {
		Attacher              string `json:"attacher" yaml:"attacher"`
		Provisioner           string `json:"provisioner" yaml:"provisioner"`
		Snapshotter           string `json:"snapshotter" yaml:"snapshotter"`
		Registrar             string `json:"registrar" yaml:"registrar"`
		Resizer               string `json:"resizer" yaml:"resizer"`
		Externalhealthmonitor string `json:"externalhealthmonitorcontroller" yaml:"externalhealthmonitorcontroller"`
		Sdc                   string `json:"sdc" yaml:"sdc"`
		Sdcmonitor            string `json:"sdcmonitor" yaml:"sdcmonitor"`
		Podmon                string `json:"podmon" yaml:"podmon"`
	} `json:"images" yaml:"images"`
}

K8sImagesConfig -

type NodeYAML

type NodeYAML struct {
	DaemonSetApplyConfig confv1.DaemonSetApplyConfiguration
	Rbac                 RbacYAML
}

NodeYAML -

type OperatorConfig

type OperatorConfig struct {
	IsOpenShift     bool
	K8sVersion      K8sImagesConfig
	ConfigDirectory string
}

OperatorConfig -

type RbacYAML

type RbacYAML struct {
	ServiceAccount     corev1.ServiceAccount
	ClusterRole        rbacv1.ClusterRole
	ClusterRoleBinding rbacv1.ClusterRoleBinding
}

RbacYAML -

type ReconcileCSM

type ReconcileCSM interface {
	reconcile.Reconciler
	GetClient() crclient.Client
	GetK8sClient() kubernetes.Interface
	GetUpdateCount() int32
	IncrUpdateCount()
}

ReconcileCSM is the interface which extends each of the respective Reconcile interfaces for drivers

type ReplicaCluster added in v0.2.0

type ReplicaCluster struct {
	ClusterID         string
	ClusterCTRLClient crclient.Client
	ClusterK8sClient  kubernetes.Interface
}

ReplicaCluster -

func GetAccDefaultClusters added in v1.4.0

func GetAccDefaultClusters(_ context.Context, _ csmv1.ApexConnectivityClient, r ReconcileCSM) (bool, []ReplicaCluster, error)

GetAccDefaultClusters - get default clusters

func GetDefaultClusters added in v0.2.0

func GetDefaultClusters(ctx context.Context, instance csmv1.ContainerStorageModule, r ReconcileCSM) (bool, []ReplicaCluster, error)

GetDefaultClusters -

type UpgradePaths added in v0.2.0

type UpgradePaths struct {
	MinUpgradePath string `json:"minUpgradePath" yaml:"minUpgradePath"`
}

UpgradePaths a list of versions eligible to upgrade the current version

Jump to

Keyboard shortcuts

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