Documentation ¶
Overview ¶
Package deploy contains code which provides information about the cluster and deploying PMEM-CSI inside it.
Index ¶
- Variables
- func AddInstallHook(h InstallHook)
- func AddUninstallHook(h UninstallHook)
- func CheckForLeftoverVolumes(d *Deployment, volBefore map[string][]string)
- func CheckPMEM()
- func CreateDeploymentCR(f *framework.Framework, dep api.Deployment) api.Deployment
- func DefineTests()
- func DeleteDeploymentCR(f *framework.Framework, name string)
- func DeploymentFromUnstructured(in *unstructured.Unstructured) *api.Deployment
- func DeploymentToUnstructured(in *api.Deployment) *unstructured.Unstructured
- func Describe(deployment, describe, what string, f func(d *Deployment)) bool
- func DescribeForAll(what string, f func(d *Deployment)) bool
- func DescribeForSome(what string, enabled func(d *Deployment) bool, f func(d *Deployment)) bool
- func EnsureDeploymentCR(f *framework.Framework, dep api.Deployment) api.Deployment
- func GetDeploymentCR(f *framework.Framework, name string) api.Deployment
- func GetHostVolumes(d *Deployment) map[string][]string
- func HasDriver(d *Deployment) bool
- func HasOperator(d *Deployment) bool
- func LogError(err error, format string, args ...interface{})
- func RemoveObjects(c *Cluster, deploymentName string) error
- func RunAllTests(d *Deployment) bool
- func UpdateDeploymentCR(f *framework.Framework, dep api.Deployment) api.Deployment
- func WaitForOperator(c *Cluster, namespace string) *v1.Pod
- func WaitForPMEMDriver(c *Cluster, name, namespace string) (metricsURL string)
- type Cluster
- func (c *Cluster) ClientSet() kubernetes.Interface
- func (c *Cluster) GetAppInstance(ctx context.Context, app, ip, namespace string) (*v1.Pod, error)
- func (c *Cluster) GetDaemonSet(ctx context.Context, setName, namespace string) (*appsv1.DaemonSet, error)
- func (c *Cluster) GetServicePort(ctx context.Context, serviceName, namespace string) (int, error)
- func (c *Cluster) GetStatefulSet(ctx context.Context, setName, namespace string) (*appsv1.StatefulSet, error)
- func (c *Cluster) NodeIP(node int) string
- func (c *Cluster) NodeServiceAddress(node int, port int) string
- func (c *Cluster) NumNodes() int
- func (c *Cluster) WaitForAppInstance(app, ip, namespace string) *v1.Pod
- func (c *Cluster) WaitForDaemonSet(setName, namespace string) *appsv1.DaemonSet
- func (c *Cluster) WaitForServicePort(serviceName, namespace string) int
- type Deployment
- type InstallHook
- type UninstallHook
Constants ¶
This section is empty.
Variables ¶
var ( DeploymentResource = schema.GroupVersionResource{ Group: api.SchemeGroupVersion.Group, Version: api.SchemeGroupVersion.Version, Resource: "deployments", } Scheme = runtime.NewScheme() )
Functions ¶
func AddInstallHook ¶
func AddInstallHook(h InstallHook)
AddInstallHook registers a callback which is invoked after a successful driver installation.
func AddUninstallHook ¶
func AddUninstallHook(h UninstallHook)
AddUninstallHook registers a callback which is invoked before a driver removal.
func CheckForLeftoverVolumes ¶
func CheckForLeftoverVolumes(d *Deployment, volBefore map[string][]string)
CheckForLeftovers lists volumes again after test, diff means leftovers.
func CheckPMEM ¶
func CheckPMEM()
CheckPMEM ensures that a test does not permanently use more than half of the available PMEM in each region. We want that to ensure that tests in direct mode still have space to work with.
Volume leaks (in direct mode) or allocating all space for a volume group (in LVM mode) trigger this check.
func CreateDeploymentCR ¶
func CreateDeploymentCR(f *framework.Framework, dep api.Deployment) api.Deployment
func DefineTests ¶
func DefineTests()
DefineTests must be called to register all tests defined so far via Describe.
func DeleteDeploymentCR ¶
func DeploymentFromUnstructured ¶
func DeploymentFromUnstructured(in *unstructured.Unstructured) *api.Deployment
func DeploymentToUnstructured ¶
func DeploymentToUnstructured(in *api.Deployment) *unstructured.Unstructured
func Describe ¶
func Describe(deployment, describe, what string, f func(d *Deployment)) bool
Describe remembers a certain test. The actual registration in Ginkgo happens in DefineTests, ordered such that all tests with the same "deployment" string are defined on after the after with the given "describe" string.
When "describe" is already unique, "what" can be left empty.
func DescribeForAll ¶
func DescribeForAll(what string, f func(d *Deployment)) bool
DescribeForAll registers tests like gomega.Describe does, except that each test will then be invoked for each supported PMEM-CSI deployment which has a functional PMEM-CSI driver.
func DescribeForSome ¶
func DescribeForSome(what string, enabled func(d *Deployment) bool, f func(d *Deployment)) bool
DescribeForSome registers tests like gomega.Describe does, except that each test will then be invoked for those PMEM-CSI deployments which pass the filter function.
func EnsureDeploymentCR ¶
func EnsureDeploymentCR(f *framework.Framework, dep api.Deployment) api.Deployment
func GetDeploymentCR ¶
func GetDeploymentCR(f *framework.Framework, name string) api.Deployment
func GetHostVolumes ¶
func GetHostVolumes(d *Deployment) map[string][]string
Register list of volumes before test, using out-of-band host commands (i.e. not CSI API).
func HasDriver ¶
func HasDriver(d *Deployment) bool
HasDriver is a filter function for DescribeForSome.
func HasOperator ¶
func HasOperator(d *Deployment) bool
HasOperator is a filter function for DescribeForSome.
func LogError ¶
LogError will log the message only if err is non-nil. The error must also be part of the arguments if it is to be included in the message.
func RemoveObjects ¶
RemoveObjects deletes everything that might have been created for a PMEM-CSI driver or operator installation (pods, daemonsets, statefulsets, driver info, storage classes, etc.).
func RunAllTests ¶
func RunAllTests(d *Deployment) bool
RunAllTests is a filter function for DescribeForSome which decides against what we run the full Kubernetes storage test suite. Currently do this for deployments created via .yaml files whereas testing with the operator is excluded. This is meant to keep overall test suite runtime reasonable and avoid duplication.
func UpdateDeploymentCR ¶
func UpdateDeploymentCR(f *framework.Framework, dep api.Deployment) api.Deployment
func WaitForOperator ¶
WaitForOperator ensures that the PMEM-CSI operator is ready for use, which is currently defined as the operator pod in Running phase.
func WaitForPMEMDriver ¶
WaitForPMEMDriver ensures that the PMEM-CSI driver is ready for use, which is defined as: - controller service is up and running - all nodes have registered
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func (*Cluster) ClientSet ¶
func (c *Cluster) ClientSet() kubernetes.Interface
func (*Cluster) GetAppInstance ¶
GetAppInstance looks for a pod with a certain app label and a specific host or pod IP. The IP may also be empty.
func (*Cluster) GetDaemonSet ¶
func (*Cluster) GetServicePort ¶
GetServicePort looks up the node port of a service.
func (*Cluster) GetStatefulSet ¶
func (*Cluster) NodeServiceAddress ¶
NodeServiceAddress returns the dial address for a certain port on a certain nodes.
func (*Cluster) NumNodes ¶
NumNodes returns the total number of nodes in the cluster. Node #0 is the master node, the rest are workers.
func (*Cluster) WaitForAppInstance ¶
WaitForAppInstance waits for a running pod which matches the app label, optional host or pod IP, and namespace.
func (*Cluster) WaitForDaemonSet ¶
func (*Cluster) WaitForServicePort ¶
WaitForServicePort waits for the service to appear and returns its ports.
type Deployment ¶
type Deployment struct { // Name string that all objects from the same deployment must // have in the DeploymentLabel. Name string // HasDriver is true if the driver itself is running. The // driver is reacting to the usual pmem-csi.intel.com driver // name. HasDriver bool // HasOperator is true if the operator is running. HasOperator bool // Mode is the driver mode of the deployment. Mode api.DeviceMode // Namespace where the namespaced objects of the deployment // were created. Namespace string // Testing is true when socat pods are available. Testing bool }
Deployment contains some information about a some deployed PMEM-CSI component(s). Those components can be a full driver installation and/or just the operator.
func EnsureDeployment ¶
func EnsureDeployment(deploymentName string) *Deployment
EnsureDeployment registers a BeforeEach function which will ensure that when a test runs, the desired deployment exists. Deployed drivers are intentionally kept running to speed up the execution of multiple tests that all want the same kind of deployment.
func FindDeployment ¶
func FindDeployment(c *Cluster) (*Deployment, error)
FindDeployment checks whether there is a PMEM-CSI driver and/or operator deployment in the cluster. A deployment is found via its deployment resp. statefulset object, which must have a pmem-csi.intel.com/deployment label.
func Parse ¶
func Parse(deploymentName string) (*Deployment, error)
Parse the deployment name and sets fields accordingly.
func (Deployment) DeploymentMode ¶
func (d Deployment) DeploymentMode() string
func (*Deployment) GetDriverDeployment ¶
func (d *Deployment) GetDriverDeployment() api.Deployment
GetDriverDeployment returns the spec for the driver deployment that is used for deployments like operator-lvm-production.
type InstallHook ¶
type InstallHook func(Deployment *Deployment)
InstallHook is the callback function for AddInstallHook.
type UninstallHook ¶
type UninstallHook func(deploymentName string)
UninstallHook is the callback function for AddUninstallHook.