ndmutil

package
v0.1.0-RC2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NdmYAML is the name of Configuration file for node-disk-manager
	NdmYAML = "node-disk-manager.yaml"
	// NdmOperatorYAML is the name of the Complete Configuration file for node-disk-manager
	// with service-account, cluster-role and cluster-role-binding
	NdmOperatorYAML = "ndm-operator.yaml"
	// NdmTestYAMLPath is the directory name where we shall keep temporary configuration file
	NdmTestYAMLPath = "/tmp/"
	// NdmTestYAMLName is the name of temporary configuration file
	NdmTestYAMLName = "NDM_Test_" + NdmYAML
	// NdmNamespace is the namespace of the node-disk-manager
	NdmNamespace = core_v1.NamespaceDefault
)

Variables

View Source
var (
	// MaxTry is the number of tries that the functions in this package make. (Not all functions)
	MaxTry int = 5
	// WaitTimeUnit is the unit time duration that is mostly used by the functions in this package
	// to wait for after a try (Not always applicable)
	WaitTimeUnit time.Duration = 1 * time.Second
)

Functions

func Clean

func Clean()

Clean is intended to clean the residue of the testing. It should be run at the very end of the test. CAUTION: it calls `cr.CitfInstance.Environment.Teardown()` which stops all Docker Containers in your machine.

func GetDockerImageName

func GetDockerImageName() string

GetDockerImageName returns the docker image name of node-disk-manager that will build when we build the project

func GetDockerImageTag

func GetDockerImageTag() string

GetDockerImageTag returns the docker tag of the node-disk-manager docker image that wiil be used when we build the project

func GetLsblkOutputOnHost

func GetLsblkOutputOnHost() (map[string]map[string]string, error)

GetLsblkOutputOnHost runs `lsblk -bro name,size,type,mountpoint` on the host and parses the output in a map then returns the map

func GetNDMBinDir

func GetNDMBinDir() string

GetNDMBinDir returns the path of bin folder of node-disk-manager repository

func GetNDMConfigurationFileName

func GetNDMConfigurationFileName() string

GetNDMConfigurationFileName returns value of the constant NdmYAML which is the name of Configuration file for node-disk-manager

func GetNDMConfigurationFilePath

func GetNDMConfigurationFilePath() string

GetNDMConfigurationFilePath returns the path of Configuration file for node-disk-manager i.e. GetNDMDir(), "samples" and GetNDMConfigurationFileName() joined together

func GetNDMDeviceListOutputFromThePod

func GetNDMDeviceListOutputFromThePod(ndmPod *core_v1.Pod) (map[string]map[string]string, error)

GetNDMDeviceListOutputFromThePod runs `ndm device list` in the node-disk-manager pod and parses the output in a map then returns the map

func GetNDMDir

func GetNDMDir() string

GetNDMDir returns the path to the node-disk-manager repository

func GetNDMLogAndValidate

func GetNDMLogAndValidate() (bool, error)

GetNDMLogAndValidate extracts log of node-disk-manager and then validate return the validation status and error occured during process

func GetNDMLogAndValidateFor

func GetNDMLogAndValidateFor(ndmPod *core_v1.Pod) (bool, error)

GetNDMLogAndValidateFor extracts log of supplied pod of node-disk-manager and then validate return the validation status and error occured during process

func GetNDMNamespace

func GetNDMNamespace() string

GetNDMNamespace returns value of the constant NdmNamespace which is the namespace of the node-disk-manager

func GetNDMOperatorFileName

func GetNDMOperatorFileName() string

GetNDMOperatorFileName returns value of the constant NdmOperatorYAML which is the name of the Complete Configuration file for node-disk-manager with service-account, cluster-role and cluster-role-binding

func GetNDMOperatorFilePath

func GetNDMOperatorFilePath() string

GetNDMOperatorFilePath returns the path of Complete Configuration file for node-disk-manager i.e. GetNDMDir() and GetNDMOperatorFileName() joined together

func GetNDMTestConfigurationDir

func GetNDMTestConfigurationDir() string

GetNDMTestConfigurationDir returns value of the constant NdmTestYAMLPath which is the directory name where we shall keep temporary configuration file

func GetNDMTestConfigurationFileName

func GetNDMTestConfigurationFileName() string

GetNDMTestConfigurationFileName returns value of the constant NdmTestYAMLName which is the name of temporary configuration file

func GetNDMTestConfigurationFilePath

func GetNDMTestConfigurationFilePath() string

GetNDMTestConfigurationFilePath returns the path of Test Configuration file for node-disk-manager i.e. GetNDMTestConfigurationDir() and GetNDMTestConfigurationFileName() joined together

func MatchDisksOutsideAndInside

func MatchDisksOutsideAndInside() (bool, error)

MatchDisksOutsideAndInside takes output of `lsblk -brdno name,size,model` on the host and output of `ndm device list` inside all the ndm pod. Then it matches the two

func MatchDisksOutsideAndInsideFor

func MatchDisksOutsideAndInsideFor(ndmPod *core_v1.Pod) (bool, error)

MatchDisksOutsideAndInsideFor takes output of `lsblk -brdno name,size,model` on the host and output of `ndm device list` inside the pod supplied. Then it matches the two

func PrepareAndApplyYAML

func PrepareAndApplyYAML() error

PrepareAndApplyYAML prepares and applies the node-disk-manager configuration

func ReplaceImageInYAMLAndApply

func ReplaceImageInYAMLAndApply() error

ReplaceImageInYAMLAndApply prepares NDM Operator YAML by string replacement and applies the same using kubectl

func ValidateNdmLog

func ValidateNdmLog(log string) bool

ValidateNdmLog checks the supplied log and checks for any error in the log. :param string log: log of node-disk-manager-xxx Pod :return: bool: `true` if log contains no error otherwise return `false`.

func WaitTillDefaultNSisReady

func WaitTillDefaultNSisReady()

WaitTillDefaultNSisReady busy waits until default namespace is ready or number of try exceeds MaxTry (at least once). Each try is make after waiting for time period of WaitTimeUnit

func WaitTillNDMisUpOrTimeout

func WaitTillNDMisUpOrTimeout(timeout time.Duration) (err error)

WaitTillNDMisUpOrTimeout busy waits until all ndm pods are up or timeout hits. Each try is make after waiting for WaitTimeUnit number of seconds.

func YAMLPrepare

func YAMLPrepare() (v1beta1.DaemonSet, error)

YAMLPrepare reads and parse the configuration file into v1beta1.DaemonSet and changes some fields so that it can be applied to create node-disk-manager daemonset from recently built image. Then it returns that v1beta1.DaemonSet Structure

func YAMLPrepareAndWriteInTempPath

func YAMLPrepareAndWriteInTempPath() error

YAMLPrepareAndWriteInTempPath reads and parse the configuration file and changes some fields so that it can be applied to create node-disk-manager daemonset from recently built image. Then it saves that configuration to temp directory which will be cleaned by calling Clean()

Types

This section is empty.

Jump to

Keyboard shortcuts

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