k8s

package
v0.20.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

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

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

func New

func New(t *testing.T, opts ...Option) *Cluster

func (*Cluster) AdminServerAddress

func (c *Cluster) AdminServerAddress(ctx context.Context, t *testing.T) string

AdminServerAddress returns the address of the admin server.

func (*Cluster) ClearMetadataRepositoryNodeData

func (c *Cluster) 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 (*Cluster) ClearStorageNodeData

func (c *Cluster) 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 (*Cluster) Close

func (c *Cluster) Close(context.Context, *testing.T)

func (*Cluster) Controller

func (c *Cluster) Controller() *controller.Controller

func (*Cluster) GetMetadataRepositoryNodeName

func (c *Cluster) 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 (*Cluster) GetStorageNodeName

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

func (*Cluster) ListAdminPods

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

func (*Cluster) ListMetadataRepositoryNodes

func (c *Cluster) 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 (*Cluster) ListMetadataRepositoryPods

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

ListMetadataRepositoryPods returns a list of all pods running varlogmr.

func (*Cluster) ListStorageNodeNodes

func (c *Cluster) 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 (*Cluster) ListStorageNodePods

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

ListStorageNodePods returns a list of all pods running varlogsn.

func (*Cluster) MetadataRepositoryAddress

func (c *Cluster) MetadataRepositoryAddress(ctx context.Context, t *testing.T) string

func (*Cluster) SetNumMetadataRepositories

func (c *Cluster) SetNumMetadataRepositories(ctx context.Context, t *testing.T, desired int)

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

func (*Cluster) Setup

func (c *Cluster) 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 (*Cluster) StartAdminServer

func (c *Cluster) 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 (*Cluster) StartMetadataRepositoryNodes

func (c *Cluster) StartMetadataRepositoryNodes(ctx context.Context, t *testing.T, desired int)

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 (*Cluster) StartStorageNode

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

func (*Cluster) StartStorageNodes

func (c *Cluster) StartStorageNodes(ctx context.Context, t *testing.T, desired int)

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 (*Cluster) StopAdminServer

func (c *Cluster) 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 (*Cluster) StopMetadataRepositoryNodes

func (c *Cluster) StopMetadataRepositoryNodes(ctx context.Context, t *testing.T)

StopMetadataRepositoryNodes stops all metadata repositories.

func (*Cluster) StopStorageNode

func (c *Cluster) 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 (*Cluster) StopStorageNodes

func (c *Cluster) StopStorageNodes(ctx context.Context, t *testing.T)

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

func (*Cluster) String

func (c *Cluster) String() string

type Option

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

func WithAdminServiceResourceName

func WithAdminServiceResourceName(serviceName string) Option

func WithAsyncTestCheckInterval

func WithAsyncTestCheckInterval(asyncTestCheckInterval time.Duration) Option

func WithAsyncTestWaitDuration

func WithAsyncTestWaitDuration(asyncTestWaitDuration time.Duration) Option

func WithCommonConfig

func WithCommonConfig(commonConfig cluster.Config) Option

func WithIngressNamespace

func WithIngressNamespace(ingressNamespace string) Option

func WithMetadataRepositoryServiceResourceName

func WithMetadataRepositoryServiceResourceName(serviceName string) Option

func WithVarlogNamespace

func WithVarlogNamespace(varlogNamespace string) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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