cluster

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

func NumMetadataRepositoryNodes

func NumMetadataRepositoryNodes(numMetaReposNodes int32) Option

func NumStorageNodes

func NumStorageNodes(numStorageNodes int32) Option

func WithAdminServiceResourceName

func WithAdminServiceResourceName(serviceName string) Option

func WithAsyncTestCheckInterval

func WithAsyncTestCheckInterval(asyncTestCheckInterval time.Duration) Option

func WithAsyncTestWaitDuration

func WithAsyncTestWaitDuration(asyncTestWaitDuration time.Duration) Option

func WithClient

func WithClient(c *client.Client) Option

func WithIngressNamespace

func WithIngressNamespace(ingressNamespace string) Option

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithMetadataRepositoryServiceResourceName

func WithMetadataRepositoryServiceResourceName(serviceName string) Option

func WithVarlogNamespace

func WithVarlogNamespace(varlogNamespace string) Option

type TestCluster

type TestCluster struct {
	// contains filtered or unexported fields
}

TestCluster represents a controller for the cluster on which test suites run.

func NewTestCluster

func NewTestCluster(t *testing.T, opts ...Option) *TestCluster

func (*TestCluster) AdminServerAddress

func (tc *TestCluster) AdminServerAddress(ctx context.Context, t *testing.T) string

AdminServerAddress returns the address of the admin server.

func (*TestCluster) ClearMetadataRepositoryNodeData

func (tc *TestCluster) ClearMetadataRepositoryNodeData(ctx context.Context, t *testing.T)

ClearMetadataRepositoryNodeData wipes out data from metadata repositories. This method cleans up all nodes in the node group varlogmr regardless of whether the metadata repositories are running or not.

func (*TestCluster) ClearStorageNodeData

func (tc *TestCluster) ClearStorageNodeData(ctx context.Context, t *testing.T)

ClearStorageNodeData wipes out data from storage nodes. This method cleans up all nodes in the node group varlogsn regardless of whether the storage nodes are running or not.

func (*TestCluster) GetMetadataRepositoryNodeName

func (tc *TestCluster) GetMetadataRepositoryNodeName(ctx context.Context, t *testing.T, nid types.NodeID) string

GetMetadataRepositoryNodeName returns a Kubernetes node name of the repository node specified by the argument nid.

Note that the metadata repository should use the hostNetwork of Kubernetes. To get a node name, this method compares the host IP and container port of the metadata repository pods to the RPC address of the metadata repository.

func (*TestCluster) GetStorageNodeName

func (tc *TestCluster) GetStorageNodeName(ctx context.Context, t *testing.T, snid types.StorageNodeID) string

func (*TestCluster) ListAdminPods

func (tc *TestCluster) ListAdminPods(ctx context.Context, t *testing.T) []core.Pod

func (*TestCluster) ListMetadataRepositoryNodes

func (tc *TestCluster) ListMetadataRepositoryNodes(ctx context.Context, t *testing.T) []core.Node

ListMetadataRepositoryNodes returns a list of Kubernetes nodes labeled the node group varlogmr. Note that there can be no running pods in the result nodes.

func (*TestCluster) ListMetadataRepositoryPods

func (tc *TestCluster) ListMetadataRepositoryPods(ctx context.Context, t *testing.T) []core.Pod

ListMetadataRepositoryPods returns a list of all pods running varlogmr.

func (*TestCluster) ListStorageNodeNodes

func (tc *TestCluster) ListStorageNodeNodes(ctx context.Context, t *testing.T) []core.Node

ListStorageNodeNodes returns a list of Kubernetes nodes labeled the node group varlogsn. Note that there can be no running pods in the result nodes.

func (*TestCluster) ListStorageNodePods

func (tc *TestCluster) ListStorageNodePods(ctx context.Context, t *testing.T) []core.Pod

ListStorageNodePods returns a list of all pods running varlogsn.

func (*TestCluster) MetadataRepositoryAddress

func (tc *TestCluster) MetadataRepositoryAddress(ctx context.Context, t *testing.T) string

func (*TestCluster) SetNumMetadataRepositories

func (tc *TestCluster) SetNumMetadataRepositories(ctx context.Context, t *testing.T, desired int32)

SetNumMetadataRepositories sets the number of running metadata repositories to the given number. It can either shrink or expand the number of metadata repositories.

func (*TestCluster) Setup

func (tc *TestCluster) Setup(ctx context.Context, t *testing.T)

Setup initializes test cluster.

It stops the admin server, metadata repositories, and storage nodes if they are running yet. It also wipes out data from metadata repositories and storage nodes. To start up the cluster, a metadata repository starts at first. The admin server, then, starts. The remaining metadata repositories start after beginning the admin server. At last, the storage nodes are created.

func (*TestCluster) StartAdminServer

func (tc *TestCluster) StartAdminServer(ctx context.Context, t *testing.T)

StartAdminServer starts the admin server on the node group varlogadm of the cluster.

It sets the number of desired replicas of the varlogadm to one and waits until the pod runs.

func (*TestCluster) StartMetadataRepositoryNodes

func (tc *TestCluster) StartMetadataRepositoryNodes(ctx context.Context, t *testing.T, desired int32)

StartMetadataRepositoryNodes will result in the given number of running metadata repositories on the node group varlogmr of the cluster. If there are already nodes in the cluster more than the given number, this method will fail.

func (*TestCluster) StartStorageNode

func (tc *TestCluster) StartStorageNode(ctx context.Context, t *testing.T, nodeName string) bool

func (*TestCluster) StartStorageNodes

func (tc *TestCluster) StartStorageNodes(ctx context.Context, t *testing.T, desired int32)

StartStorageNodes will result in the given number of running storage nodes on the node group varlogsn of the cluster. If there are already nodes in the cluster more than the given number, this method will fail.

Note that the DaemonSet varlogsn should have a proper nodeAffinity setting since it sets the node label `varlogsn-status` of the node group varlogsn to `started`.

func (*TestCluster) StopAdminServer

func (tc *TestCluster) StopAdminServer(ctx context.Context, t *testing.T)

StopAdminServer stops the admin server.

It sets the number of desired replicas of the varlogadm to zero and waits until the pod stops.

func (*TestCluster) StopMetadataRepositoryNodes

func (tc *TestCluster) StopMetadataRepositoryNodes(ctx context.Context, t *testing.T)

StopMetadataRepositoryNodes stops all metadata repositories.

func (*TestCluster) StopStorageNode

func (tc *TestCluster) StopStorageNode(ctx context.Context, t *testing.T, snid types.StorageNodeID) (nodeName string)

StopStorageNode stops the storage node specified by the argument snid and returns the Kubernetes node name that had run the storage node.

func (*TestCluster) StopStorageNodes

func (tc *TestCluster) StopStorageNodes(ctx context.Context, t *testing.T)

StopStorageNodes stops all storage nodes. It changes the node label DefaultNodeStatusLabelStorageNode from DefaultNodeStatusStarted to DefaultNodeStatusStopped.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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