fixtures

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrimaryID is the suffix for the primary FoundationDBCluster
	PrimaryID = "primary"
	// RemoteID is the suffix for the remote FoundationDBCluster
	RemoteID = "remote"
	// PrimarySatelliteID is the suffix for the primary satellite FoundationDBCluster
	PrimarySatelliteID = "primary-satellite"
	// RemoteSatelliteID is the suffix for the remote satellite FoundationDBCluster
	RemoteSatelliteID = "remote-satellite"
	// SatelliteID is the suffix for the satellite FoundationDBCluster
	SatelliteID = "satellite"
)

This file contains fixtures to set up HA configurations.

View Source
const ChaosDurationForever = "998h"

ChaosDurationForever represents a very long duration if an experiment should run for the whole test duration.

Variables

This section is empty.

Functions

func CheckInvariant

func CheckInvariant(
	invariantName string,
	shutdownHooks *ShutdownHooks,
	threshold time.Duration,
	f func() error,
) error

CheckInvariant will test the invariant method provided and will return an error if the invariant returns an error

func ChooseRandomPod

func ChooseRandomPod(pods *corev1.PodList) *corev1.Pod

ChooseRandomPod returns a random pod from the provided array, passing through the provided error.

func FdbPrintable added in v1.35.0

func FdbPrintable(d []byte) string

FdbPrintable copied from foundationdb bindings/go/src/fdb/fdb.go func Printable(d []byte) string Printable returns a human readable version of a byte array. The bytes that correspond with ASCII printable characters [32-127) are passed through. Other bytes are replaced with \x followed by a two character zero-padded hex code for byte.

func GenerateCertificate

func GenerateCertificate() (*corev1.Secret, error)

GenerateCertificate generates a Kubernetes Secret that contains a valid certificate, key and ca.pem. This method can be used to create e2e test FDB clusters.

func GenerateUpgradeTableEntries

func GenerateUpgradeTableEntries(options *FactoryOptions) []ginkgo.TableEntry

GenerateUpgradeTableEntries creates the ginkgo.TableEntry slice based of the provided options.

func GetBaseImageAndTag

func GetBaseImageAndTag(image string) (string, string)

GetBaseImageAndTag returns the base image and if present the tag.

func GetDcIDsFromConfig

func GetDcIDsFromConfig(databaseConfiguration fdbv1beta2.DatabaseConfiguration) []string

GetDcIDsFromConfig returns unique DC IDs from the current config. TODO (johscheuer): Should this be part of v1beta2?

func GetDebugImage

func GetDebugImage(debug bool, image string) string

GetDebugImage returns the debugging image if enabled.

func GetOperatorSelector

func GetOperatorSelector(namespace string) chaosmeshv1alpha1.PodSelectorSpec

GetOperatorSelector returns the operator Pod selector for chaos mesh.

func GetProcessClass

func GetProcessClass(pod corev1.Pod) fdbv1beta2.ProcessClass

GetProcessClass returns the Process class of this Pod.

func GetProcessGroupID

func GetProcessGroupID(pod corev1.Pod) fdbv1beta2.ProcessGroupID

GetProcessGroupID returns the Process Group ID class of this Pod.

func GetPvc

func GetPvc(pod *corev1.Pod) string

GetPvc returns the PVC name of this Pod.

func LoadControllerRuntimeFromContext added in v1.23.0

func LoadControllerRuntimeFromContext(context string, configScheme *runtime.Scheme) (client.Client, error)

LoadControllerRuntimeFromContext will load a client.Client from the provided context. The context must be existing in the kube config.

func PodSelector

func PodSelector(pod *corev1.Pod) chaosmeshv1alpha1.PodSelectorSpec

PodSelector returns the PodSelectorSpec for the provided Pod. TODO(j-scheuermann): This should be merged with the method below (PodsSelector).

func PodsSelector

func PodsSelector(v1pods []corev1.Pod) chaosmeshv1alpha1.PodSelectorSpec

PodsSelector returns the PodSelectorSpec for the provided Pods.

func RandStringRunes

func RandStringRunes(n int) string

RandStringRunes randomly generates a string of length n.

func RandomPickOnePod

func RandomPickOnePod(input []corev1.Pod) corev1.Pod

RandomPickOnePod will pick on Pods randomly from the Pod slice.

func RandomPickPod

func RandomPickPod(input []corev1.Pod, count int) []corev1.Pod

RandomPickPod randomly picks the number of Pods from the slice. If the slice contains less than count Pods, all Pods will be returned in a random order.

func RunGinkgoTests

func RunGinkgoTests(t *testing.T, name string)

RunGinkgoTests sets up the current test suite to run Ginkgo tests, then invokes the tests. It should be invoked by each top level Test* function.

func ToJSON

func ToJSON(v interface{}) string

ToJSON tries to convert any object to a string representing the struct as JSON.

func UseVersionBeforeUpgrade

func UseVersionBeforeUpgrade(factory *Factory, cluster *fdbv1beta2.FoundationDBCluster)

UseVersionBeforeUpgrade is an option that uses an older version of FDB to prepare a cluster for being upgraded.

func VersionsAreProtocolCompatible

func VersionsAreProtocolCompatible(versionA string, versionB string) bool

VersionsAreProtocolCompatible returns true if versionA and versionB are protocol compatible e.g. a patch upgrade.

func WithDNSEnabled

func WithDNSEnabled(_ *Factory, cluster *fdbv1beta2.FoundationDBCluster)

WithDNSEnabled is an option that enables DNS for a cluster.

func WithLocalitiesForExclusion

func WithLocalitiesForExclusion(_ *Factory, cluster *fdbv1beta2.FoundationDBCluster)

WithLocalitiesForExclusion is an option that exclusions based on localities for a cluster.

func WithOneMinuteMinimumUptimeSecondsForBounce

func WithOneMinuteMinimumUptimeSecondsForBounce(
	_ *Factory,
	cluster *fdbv1beta2.FoundationDBCluster,
)

WithOneMinuteMinimumUptimeSecondsForBounce sets the MinimumUptimeSecondsForBounce setting to 60.

func WithTLSEnabled

func WithTLSEnabled(_ *Factory, cluster *fdbv1beta2.FoundationDBCluster)

WithTLSEnabled is an option that enables TLS for a cluster.

func WithUnifiedImage added in v1.20.0

func WithUnifiedImage(_ *Factory, cluster *fdbv1beta2.FoundationDBCluster)

WithUnifiedImage is an option that enables the unified image for a cluster.

Types

type ChaosMeshExperiment

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

ChaosMeshExperiment is a wrapper around an actual chaos mesh experiment and should provide some useful abstractions, to make it easier to run experiments.

type ClusterConfig

type ClusterConfig struct {
	// If enabled we will use the performance setup.
	Performance bool
	// If enabled the debug images will be used for this test case.
	DebugSymbols bool
	// UseMaintenanceMode if enabled the FoundationDBCluster resource will enable the maintenance mode.
	UseMaintenanceMode bool
	// UseLocalityBasedExclusions if enabled the FoundationDBCluster resource will enable the locality based exclusions.
	UseLocalityBasedExclusions bool
	// UseDNS if enabled the FoundationDBCluster resource will enable the DNS feature.
	UseDNS bool
	// CreationTracker if specified will be used to log the time between the creations steps.
	CreationTracker CreationTrackerLogger
	// Number of machines, this is used for calculating the number of Pods and is not correlated to the actual number
	// of machines that will be used.
	MachineCount int
	// This is also used for calculating the number of Pods.
	DisksPerMachine int
	// StorageServerPerPod defines the value that is set in the FoundationDBClusterSpec for this setting.
	StorageServerPerPod int
	// LogServersPerPod defines the value that is set in the FoundationDBClusterSpec for this setting.
	LogServersPerPod int
	// VolumeSize the size of the volumes that should be created for stateful Pods.
	VolumeSize string
	// Namespace to create the cluster in, if empty will use a randomly generated namespace. The setup won't create the
	// namespace if it's not created.
	Namespace string
	// Name of the cluster to be created, if empty a random name will be used.
	Name string

	// The storage engine that should be used to create the cluster
	StorageEngine fdbv1beta2.StorageEngine
	// NodeSelector of the cluster to be created.
	NodeSelector map[string]string
	// Defines the HA mode that will be used, per default this will point to HaModeNone.
	HaMode HaMode
	// CustomParameters allows to define the custom parameters that should be set during the cluster creation.
	CustomParameters map[fdbv1beta2.ProcessClass]fdbv1beta2.FoundationDBCustomParameters
	// CreationCallback allows to specify a method that will be called after the cluster was created.
	CreationCallback func(fdbCluster *FdbCluster)
	// contains filtered or unexported fields
}

ClusterConfig defines the target configuration for the FoundationDBCLuster.

func DefaultClusterConfig

func DefaultClusterConfig(debugSymbols bool) *ClusterConfig

DefaultClusterConfig returns the default cluster configuration with the HA Mode None.

func DefaultClusterConfigWithHaMode

func DefaultClusterConfigWithHaMode(haMode HaMode, debugSymbols bool) *ClusterConfig

DefaultClusterConfigWithHaMode returns the default cluster configuration with the provided HA Mode.

func (*ClusterConfig) CalculateRoleCounts

func (config *ClusterConfig) CalculateRoleCounts() fdbv1beta2.RoleCounts

CalculateRoleCounts attempt to scale role counts in a way that is reasonable for read-heavy OLTP-style workloads 1 disk will hold logs. The rest holds data.

func (*ClusterConfig) Copy added in v1.23.0

func (config *ClusterConfig) Copy() *ClusterConfig

Copy will return a new struct of the ClusterConfig.

func (*ClusterConfig) CreateDatabaseConfiguration

func (config *ClusterConfig) CreateDatabaseConfiguration() fdbv1beta2.DatabaseConfiguration

CreateDatabaseConfiguration returns the fdbv1beta2.DatabaseConfiguration based on the provided cluster configuration.

func (ClusterConfig) GetRedundancyMode

func (config ClusterConfig) GetRedundancyMode() fdbv1beta2.RedundancyMode

GetRedundancyMode returns the redundancy mode based on the cluster configuration.

func (*ClusterConfig) SetDefaults

func (config *ClusterConfig) SetDefaults(factory *Factory)

SetDefaults will set all unset fields to the default values.

type ClusterOption

type ClusterOption func(*Factory, *fdbv1beta2.FoundationDBCluster)

ClusterOption provides a fluid mechanism for chaining together options for building clusters.

type CreationTrackerLogger

type CreationTrackerLogger interface {
	// NewEntry adds an entry to the internal map.
	NewEntry() map[string]interface{}
	// Log will write the values in  the map directly to the logger.
	Log(values map[string]interface{}) error
	// Flush will write all values from the entry map to the logger.
	Flush() error
}

CreationTrackerLogger is an interface that can be used to log the time between different creation steps.

func NewDefaultCreationTrackerLogger

func NewDefaultCreationTrackerLogger() CreationTrackerLogger

NewDefaultCreationTrackerLogger creates a no-op logger which is not writing anything.

type DefaultCreationTrackerLogger

type DefaultCreationTrackerLogger struct{}

DefaultCreationTrackerLogger is an implementation of CreationTrackerLogger that is not printing any values.

func (*DefaultCreationTrackerLogger) Flush

func (logger *DefaultCreationTrackerLogger) Flush() error

Flush will write all values from the entry map to the logger.

func (*DefaultCreationTrackerLogger) Log

func (logger *DefaultCreationTrackerLogger) Log(_ map[string]interface{}) error

Log will write the values in the map directly to the logger.

func (*DefaultCreationTrackerLogger) NewEntry

func (logger *DefaultCreationTrackerLogger) NewEntry() map[string]interface{}

NewEntry adds an entry to the internal map.

type Factory

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

Factory is a helper struct to organize tests.

func CreateFactory

func CreateFactory(options *FactoryOptions) *Factory

CreateFactory will create a factory based on the provided options.

func (*Factory) AddShutdownHook

func (factory *Factory) AddShutdownHook(f func() error)

AddShutdownHook will add the provided shut down hook.

func (*Factory) ChaosTestsEnabled

func (factory *Factory) ChaosTestsEnabled() bool

ChaosTestsEnabled returns true if chaos tests should be executed.

func (*Factory) CleanupChaosMeshExperiments

func (factory *Factory) CleanupChaosMeshExperiments() error

CleanupChaosMeshExperiments deletes any chaos experiments created by this handle. Invoked at shutdown. Tests that need to delete experiments should invoke Delete on their ChaosMeshExperiment objects.

func (*Factory) CreateDataLoaderIfAbsent added in v1.27.0

func (factory *Factory) CreateDataLoaderIfAbsent(cluster *FdbCluster)

CreateDataLoaderIfAbsent will create the data loader for the provided cluster and load some random data into the cluster.

func (*Factory) CreateExperiment

func (factory *Factory) CreateExperiment(chaos client.Object) *ChaosMeshExperiment

CreateExperiment creates a chaos experiment in the cluster with specified type, name and chaos object.

func (*Factory) CreateFDBOperatorIfAbsent

func (factory *Factory) CreateFDBOperatorIfAbsent(namespace string) error

CreateFDBOperatorIfAbsent creates the operator Deployment based on the template.

func (*Factory) CreateFdbCluster

func (factory *Factory) CreateFdbCluster(
	config *ClusterConfig,
	options ...ClusterOption,
) *FdbCluster

CreateFdbCluster creates a FDB cluster.

func (*Factory) CreateFdbClusterFromSpec added in v1.20.0

func (factory *Factory) CreateFdbClusterFromSpec(
	spec *fdbv1beta2.FoundationDBCluster,
	config *ClusterConfig,
	options ...ClusterOption,
) *FdbCluster

CreateFdbClusterFromSpec creates a FDB cluster. This method can be used in combination with the GenerateFDBClusterSpec method. In general this should only be used for special cases that are not covered by changing the ClusterOptions or the ClusterConfig.

func (*Factory) CreateFdbHaCluster

func (factory *Factory) CreateFdbHaCluster(
	config *ClusterConfig,
	options ...ClusterOption,
) *HaFdbCluster

CreateFdbHaCluster creates a HA FDB Cluster based on the cluster config and cluster options

func (*Factory) CreateIfAbsent

func (factory *Factory) CreateIfAbsent(object client.Object) error

CreateIfAbsent will create the provided resource if absent.

func (*Factory) Delete added in v1.29.0

func (factory *Factory) Delete(object client.Object)

Delete will delete the provided resource if it exists.

func (*Factory) DeleteChaosMeshExperimentSafe

func (factory *Factory) DeleteChaosMeshExperimentSafe(experiment *ChaosMeshExperiment)

DeleteChaosMeshExperimentSafe will delete a running Chaos Mesh experiment.

func (*Factory) DeletePod

func (factory *Factory) DeletePod(pod *corev1.Pod)

DeletePod deletes the provided Pod

func (*Factory) DoesPodExist

func (factory *Factory) DoesPodExist(pod corev1.Pod) (bool, error)

DoesPodExist checks to see if Kubernetes still knows about this pod.

func (*Factory) DumpState

func (factory *Factory) DumpState(fdbCluster *FdbCluster)

DumpState writes the state of the cluster to the log output. Useful for debugging test failures.

func (*Factory) DumpStateHaCluster

func (factory *Factory) DumpStateHaCluster(fdbCluster *HaFdbCluster)

DumpStateHaCluster can be used to dump the state of the HA cluster. This includes the Kubernetes custom resource information as well as the operator logs and the Pod state.

func (*Factory) ExecuteCmd

func (factory *Factory) ExecuteCmd(
	namespace string,
	name string,
	container string,
	command string,
	printOutput bool,
) (string, string, error)

ExecuteCmd executes command in the default container of a Pod with shell, returns stdout and stderr.

func (*Factory) ExecuteCmdOnPod

func (factory *Factory) ExecuteCmdOnPod(
	pod *corev1.Pod,
	container string,
	command string,
	printOutput bool,
) (string, string, error)

ExecuteCmdOnPod runs a command on the provided Pod. The command will be executed inside a bash -c ”.

func (*Factory) ExecuteCommandRaw

func (factory *Factory) ExecuteCommandRaw(
	namespace string,
	name string,
	container string,
	command []string,
	stdin io.Reader,
	stdout io.Writer,
	stderr io.Writer,
	isTty bool,
) error

ExecuteCommandRaw will run the command without putting it into a shell.

func (*Factory) GenerateFDBClusterSpec added in v1.20.0

func (factory *Factory) GenerateFDBClusterSpec(config *ClusterConfig) *fdbv1beta2.FoundationDBCluster

GenerateFDBClusterSpec will generate a *fdbv1beta2.FoundationDBCluster based on the input ClusterConfig.

func (*Factory) GetAdditionalSidecarVersions

func (factory *Factory) GetAdditionalSidecarVersions() []fdbv1beta2.Version

GetAdditionalSidecarVersions returns all additional FoundationDB versions that should be added to the sidecars. This method make sure that the operator has all required client libraries.

func (*Factory) GetBackupSecretName

func (factory *Factory) GetBackupSecretName() string

GetBackupSecretName returns the name of the backup secret.

func (*Factory) GetBeforeVersion

func (factory *Factory) GetBeforeVersion() string

GetBeforeVersion returns the before version if set. This is used during upgrade tests.

func (*Factory) GetChaosNamespace

func (factory *Factory) GetChaosNamespace() string

GetChaosNamespace returns the chaos namespace that was provided per command line.

func (*Factory) GetClusterOptions

func (factory *Factory) GetClusterOptions(options ...ClusterOption) []ClusterOption

GetClusterOptions returns the cluster options that should be used for the operator testing. Those options can be changed by changing the according feature flags.

func (*Factory) GetContext added in v1.24.0

func (factory *Factory) GetContext() string

GetContext returns the Kubernetes context provided via command line.

func (*Factory) GetControllerRuntimeClient

func (factory *Factory) GetControllerRuntimeClient() client.Client

GetControllerRuntimeClient returns the controller runtime client.

func (*Factory) GetDataLoaderImage added in v1.27.0

func (factory *Factory) GetDataLoaderImage() string

GetDataLoaderImage returns the dataloader image provided via command line. If a registry was defined the registry will be prepended.

func (*Factory) GetDefaultLabels

func (factory *Factory) GetDefaultLabels() map[string]string

GetDefaultLabels returns the default labels set to all resources.

func (*Factory) GetDefaultStorageClass

func (factory *Factory) GetDefaultStorageClass() string

GetDefaultStorageClass returns either the StorageClass provided by the command line or fetches the StorageClass passed on the default Annotation.

func (*Factory) GetFDBVersion

func (factory *Factory) GetFDBVersion() fdbv1beta2.Version

GetFDBVersion returns the parsed FDB version.

func (*Factory) GetFDBVersionAsString

func (factory *Factory) GetFDBVersionAsString() string

GetFDBVersionAsString returns the FDB version as string.

func (*Factory) GetFoundationDBImage

func (factory *Factory) GetFoundationDBImage() string

GetFoundationDBImage returns the FoundationDB image provided via command line. If a registry was defined the registry will be prepended.

func (*Factory) GetLogsForPod added in v1.20.0

func (factory *Factory) GetLogsForPod(pod corev1.Pod, container string, since *int64) string

GetLogsForPod will fetch the logs for the specified Pod and container since the provided seconds.

func (*Factory) GetLogsFromPod

func (factory *Factory) GetLogsFromPod(pod *corev1.Pod, container string) string

GetLogsFromPod returns the logs for the provided Pod and container

func (*Factory) GetOperatorImage

func (factory *Factory) GetOperatorImage() string

GetOperatorImage returns the operator image provided via command line. If a registry was defined the registry will be prepended.

func (*Factory) GetOperatorPods

func (factory *Factory) GetOperatorPods(namespace string) *corev1.PodList

GetOperatorPods returns the operator Pods in the provided namespace.

func (*Factory) GetPod

func (factory *Factory) GetPod(namespace string, name string) (*corev1.Pod, error)

GetPod returns the Pod matching the namespace and name

func (*Factory) GetSecretName

func (factory *Factory) GetSecretName() string

GetSecretName returns the secret name that contains the certificates used for the current test run.

func (*Factory) GetSidecarConfigs

func (factory *Factory) GetSidecarConfigs() []SidecarConfig

GetSidecarConfigs returns the sidecar configs. The sidecar configs can be used to template applications that will use all provided sidecar versions to inject FDB client libraries.

func (*Factory) GetSidecarImage

func (factory *Factory) GetSidecarImage() string

GetSidecarImage returns the sidecar image provided via command line. If a registry was defined the registry will be prepended.

func (*Factory) GetStorageClasses

func (factory *Factory) GetStorageClasses(labels map[string]string) *storagev1.StorageClassList

GetStorageClasses returns all StorageClasses present in this Kubernetes cluster that have the label foundationdb.org/operator-testing=true.

func (*Factory) GetUpgradeVersions

func (factory *Factory) GetUpgradeVersions() []*UpgradeTestConfiguration

GetUpgradeVersions returns the upgrade versions as a string slice based on the command line flag. Each entry will be a FoundationDB version. This slice can contain duplicate entries. For upgrade tests it's expected that two versions form one test, e.g. where the odd number is the initial version and the even number is the

func (*Factory) InjectDiskFailure

func (factory *Factory) InjectDiskFailure(selector chaosmesh.PodSelectorSpec) *ChaosMeshExperiment

InjectDiskFailure injects a disk failure for all Pods selected by the selector.

func (*Factory) InjectDiskFailureWithPath

func (factory *Factory) InjectDiskFailureWithPath(selector chaosmesh.PodSelectorSpec, volumePath string, path string, methods []chaosmesh.IoMethod, containers []string) *ChaosMeshExperiment

InjectDiskFailureWithPath injects a disk failure for all Pods selected by the selector. volumePath and path can be used to specify the affected files and methods allow to specify the affected methods.

func (*Factory) InjectHTTPClientChaosWrongResultFdbMonitorConf

func (factory *Factory) InjectHTTPClientChaosWrongResultFdbMonitorConf(selector chaosmeshv1alpha1.PodSelectorSpec, namespace string) *ChaosMeshExperiment

InjectHTTPClientChaosWrongResultFdbMonitorConf this method can be used to simulate a bad response from the operator to the sidecar. Currently this method returns as body the value "wrong" when the operator does a request against the check_hash/fdbmonitor.conf endpoint, e.g. during upgrades.

func (*Factory) InjectIOLatency

func (factory *Factory) InjectIOLatency(selector chaosmesh.PodSelectorSpec, delay string) *ChaosMeshExperiment

InjectIOLatency injects IOLatency for single pod.

func (*Factory) InjectNetworkLoss

func (factory *Factory) InjectNetworkLoss(lossPercentage string, source chaosmesh.PodSelectorSpec, target chaosmesh.PodSelectorSpec, direction chaosmesh.Direction) *ChaosMeshExperiment

InjectNetworkLoss injects network loss between the source and the target.

func (*Factory) InjectNetworkLossBetweenPods

func (factory *Factory) InjectNetworkLossBetweenPods(pods []chaosmesh.PodSelectorSpec, loss string)

InjectNetworkLossBetweenPods Injects network loss b/w each combination of podGroups.

func (*Factory) InjectPartition

func (factory *Factory) InjectPartition(selector chaosmesh.PodSelectorSpec) *ChaosMeshExperiment

InjectPartition injects a partition to the provided selector.

func (*Factory) InjectPartitionBetween

func (factory *Factory) InjectPartitionBetween(
	source chaosmesh.PodSelectorSpec,
	target chaosmesh.PodSelectorSpec,
) *ChaosMeshExperiment

InjectPartitionBetween injects a partition between the source and the target.

func (*Factory) InjectPartitionBetweenWithDirection added in v1.32.0

func (factory *Factory) InjectPartitionBetweenWithDirection(
	source chaosmesh.PodSelectorSpec,
	target chaosmesh.PodSelectorSpec,
	direction chaosmesh.Direction,
) *ChaosMeshExperiment

InjectPartitionBetweenWithDirection injects a partition between the source and the target for the specified direction.

func (*Factory) InjectPartitionOnSomeTargetPods

func (factory *Factory) InjectPartitionOnSomeTargetPods(
	source chaosmesh.PodSelectorSpec,
	target chaosmesh.PodSelectorSpec,
	fixedNumber int,
) *ChaosMeshExperiment

InjectPartitionOnSomeTargetPods injects a partition on some Pods instead of all Pods. It picks a specific number of pods randomly. If the specified "fixedNumber" is greater than the number of all targets, all targets will be chosen.

func (*Factory) MultipleNamespaces

func (factory *Factory) MultipleNamespaces(dcIDs []string) []string

MultipleNamespaces creates multiple namespaces for HA testing.

func (*Factory) OperatorIsAtLeast

func (factory *Factory) OperatorIsAtLeast(version string) bool

OperatorIsAtLeast is a helper method to check is the running operator is at least in the specified version.

func (*Factory) PrependRegistry

func (factory *Factory) PrependRegistry(container string) string

PrependRegistry if a registry was provided as flag, the registry will be prepended.

func (*Factory) RecreateOperatorPods

func (factory *Factory) RecreateOperatorPods(namespace string)

RecreateOperatorPods will recreate all operator Pods in the specified namespace and wait until the new Pods are up and running.

func (*Factory) ScheduleInjectPodKill

func (factory *Factory) ScheduleInjectPodKill(target chaosmesh.PodSelectorSpec, schedule string, mode chaosmesh.SelectorMode) *ChaosMeshExperiment

ScheduleInjectPodKill schedules a Pod Kill action.

func (*Factory) SetBeforeVersion

func (factory *Factory) SetBeforeVersion(version string)

SetBeforeVersion allows a user to overwrite the before version that should be used.

func (*Factory) SetFinalizerForPod

func (factory *Factory) SetFinalizerForPod(pod *corev1.Pod, finalizers []string)

SetFinalizerForPod will set the provided finalizer slice for the Pods

func (*Factory) Shutdown

func (factory *Factory) Shutdown()

Shutdown executes all the shutdown handlers, usually called in afterSuite or afterTest depending on your scoping of the factory.

func (*Factory) SingleNamespace

func (factory *Factory) SingleNamespace() string

SingleNamespace returns a single namespace.

func (*Factory) StopInvariantCheck

func (factory *Factory) StopInvariantCheck()

StopInvariantCheck will stop the current invariant checker by triggering the shutdown hook and resetting the shutdown hooks.

func (*Factory) WaitUntilDataLoaderIsDone added in v1.27.0

func (factory *Factory) WaitUntilDataLoaderIsDone(cluster *FdbCluster)

WaitUntilDataLoaderIsDone will wait until the data loader Job has finished.

func (*Factory) WaitUntilOperatorPodsRunning

func (factory *Factory) WaitUntilOperatorPodsRunning(namespace string)

WaitUntilOperatorPodsRunning waits until the Operator Pods are running.

type FactoryOptions

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

FactoryOptions defines the (command line) options that are support for the e2e test cases.

func InitFlags

func InitFlags() *FactoryOptions

InitFlags sets up the custom flags for this test suite and returns the parsed FactoryOptions struct. This method will take care of including the command line flags from Ginkgo and the testing framework.

func (*FactoryOptions) BindFlags

func (options *FactoryOptions) BindFlags(fs *flag.FlagSet)

BindFlags binds the FactoryOptions flags to the provided FlagSet. This can be used to extend the current test setup with custom/additional flags.

type FdbCluster

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

FdbCluster is a fixture that allows tests to manipulate an FDB cluster with some name. Depending on how it was instantiated, the cluster may or may not exist, and may or may not be part of an HA configuration.

func (*FdbCluster) AllProcessGroupsHaveCondition

func (fdbCluster *FdbCluster) AllProcessGroupsHaveCondition(
	condition fdbv1beta2.ProcessGroupConditionType,
) bool

AllProcessGroupsHaveCondition returns true if all process groups have the specified condition. If allowOtherConditions is set to true only this condition is allowed.

func (*FdbCluster) BounceClusterWithoutWait

func (fdbCluster *FdbCluster) BounceClusterWithoutWait() error

BounceClusterWithoutWait will restart all fdberver processes in the current FoundationDBCluster without waiting for the cluster to become available again.

func (*FdbCluster) CheckPodIsDeleted added in v1.18.0

func (fdbCluster *FdbCluster) CheckPodIsDeleted(podName string) bool

CheckPodIsDeleted return true if Pod no longer exists at the executed time point

func (*FdbCluster) ClearBuggifyNoSchedule

func (fdbCluster *FdbCluster) ClearBuggifyNoSchedule(waitForReconcile bool) error

ClearBuggifyNoSchedule this will reset the NoSchedule setting for the current FoundationDBCluster.

func (*FdbCluster) ClearProcessGroupsToRemove

func (fdbCluster *FdbCluster) ClearProcessGroupsToRemove() error

ClearProcessGroupsToRemove clears the InstancesToRemove list in the cluster spec.

func (*FdbCluster) Create

func (fdbCluster *FdbCluster) Create() error

Create asynchronously creates this FDB cluster.

func (*FdbCluster) Destroy

func (fdbCluster *FdbCluster) Destroy() error

Destroy will remove the underlying cluster.

func (*FdbCluster) EnsurePodIsDeleted

func (fdbCluster *FdbCluster) EnsurePodIsDeleted(podName string)

EnsurePodIsDeleted validates that a Pod is either not existing or is marked as deleted with a non-zero deletion timestamp.

func (*FdbCluster) EnsurePodIsDeletedWithCustomTimeout added in v1.18.0

func (fdbCluster *FdbCluster) EnsurePodIsDeletedWithCustomTimeout(podName string, timeoutMinutes int)

EnsurePodIsDeletedWithCustomTimeout validates that a Pod is either not existing or is marked as deleted with a non-zero deletion timestamp. It times out after timeoutMinutes.

func (*FdbCluster) EnsureTeamTrackersAreHealthy added in v1.27.0

func (fdbCluster *FdbCluster) EnsureTeamTrackersAreHealthy()

EnsureTeamTrackersAreHealthy will check if the machine-readable status suggest that the team trackers are healthy and all data is present.

func (*FdbCluster) EnsureTeamTrackersHaveMinReplicas added in v1.27.0

func (fdbCluster *FdbCluster) EnsureTeamTrackersHaveMinReplicas()

EnsureTeamTrackersHaveMinReplicas will check if the machine-readable status suggest that the team trackers min_replicas match the expected replicas.

func (*FdbCluster) ExecuteCmdOnPod

func (fdbCluster *FdbCluster) ExecuteCmdOnPod(
	pod corev1.Pod,
	container string,
	command string,
	printOutput bool,
) (string, string, error)

ExecuteCmdOnPod will run the provided command in a Shell.

func (*FdbCluster) ForceReconcile added in v1.18.0

func (fdbCluster *FdbCluster) ForceReconcile()

ForceReconcile will add an annotation with the current timestamp on the FoundationDBCluster resource to make sure the operator reconciliation loop is triggered. This is used to speed up some test cases.

func (*FdbCluster) GetAllPods

func (fdbCluster *FdbCluster) GetAllPods() *corev1.PodList

GetAllPods returns all pods, even if not running.

func (*FdbCluster) GetAutomationOptions added in v1.18.0

func (fdbCluster *FdbCluster) GetAutomationOptions() fdbv1beta2.FoundationDBClusterAutomationOptions

GetAutomationOptions return the fdbCluster's AutomationOptions

func (*FdbCluster) GetCachedCluster

func (fdbCluster *FdbCluster) GetCachedCluster() *fdbv1beta2.FoundationDBCluster

GetCachedCluster returns the current cluster definition stored in the fdbCluster struct. This could be outdated and if you need the most recent version of the definition you should use `GetCluster`. This method is useful if you want to inspect fields that are not changing.

func (*FdbCluster) GetCluster

func (fdbCluster *FdbCluster) GetCluster() *fdbv1beta2.FoundationDBCluster

GetCluster returns the FoundationDBCluster of the cluster. This will fetch the latest value from the Kubernetes API.

func (*FdbCluster) GetClusterSpec

func (fdbCluster *FdbCluster) GetClusterSpec() fdbv1beta2.FoundationDBClusterSpec

GetClusterSpec returns the current cluster spec.

func (FdbCluster) GetCommandlineForProcessesPerClass

func (fdbCluster FdbCluster) GetCommandlineForProcessesPerClass() map[fdbv1beta2.ProcessClass][]string

GetCommandlineForProcessesPerClass fetches the commandline args for all processes except of the specified class.

func (*FdbCluster) GetCoordinators

func (fdbCluster *FdbCluster) GetCoordinators() []corev1.Pod

GetCoordinators returns the Pods of the FoundationDBCluster that are having the coordinator role.

func (*FdbCluster) GetCustomParameters

func (fdbCluster *FdbCluster) GetCustomParameters(
	processClass fdbv1beta2.ProcessClass,
) fdbv1beta2.FoundationDBCustomParameters

GetCustomParameters returns the current custom parameters for the specified process class.

func (*FdbCluster) GetFDBImage

func (fdbCluster *FdbCluster) GetFDBImage() string

GetFDBImage return the FDB image used for the current version, defined in the FoundationDBClusterSpec.

func (*FdbCluster) GetListOfUIDsFromVolumeClaims added in v1.35.0

func (fdbCluster *FdbCluster) GetListOfUIDsFromVolumeClaims(processClass fdbv1beta2.ProcessClass) []types.UID

GetListOfUIDsFromVolumeClaims will return of list of UIDs for the current volume claims for the provided processes class.

func (*FdbCluster) GetLogPods

func (fdbCluster *FdbCluster) GetLogPods() *corev1.PodList

GetLogPods returns all Pods of this cluster that have the process class log.

func (*FdbCluster) GetLogServersPerPod added in v1.21.0

func (fdbCluster *FdbCluster) GetLogServersPerPod() int

GetLogServersPerPod returns the current expected Log server per pod.

func (*FdbCluster) GetNode added in v1.18.0

func (fdbCluster *FdbCluster) GetNode(name string) *corev1.Node

GetNode return Node with the given name

func (*FdbCluster) GetPod

func (fdbCluster *FdbCluster) GetPod(name string) *corev1.Pod

GetPod returns the Pod with the given name that runs in the same namespace as the FoundationDBCluster.

func (*FdbCluster) GetPodIDs

func (fdbCluster *FdbCluster) GetPodIDs(processClass fdbv1beta2.ProcessClass) map[fdbv1beta2.ProcessGroupID]fdbv1beta2.None

GetPodIDs returns all the process group IDs for all Pods of this cluster that have the matching process class.

func (*FdbCluster) GetPodRoleMap

func (fdbCluster *FdbCluster) GetPodRoleMap() map[fdbv1beta2.ProcessGroupID][]RoleInfo

GetPodRoleMap returns a map with the process group ID as key and all associated roles.

func (*FdbCluster) GetPods

func (fdbCluster *FdbCluster) GetPods() *corev1.PodList

GetPods returns only running Pods.

func (*FdbCluster) GetPodsNames

func (fdbCluster *FdbCluster) GetPodsNames() []string

GetPodsNames GetS all Running Pods and return their names.

func (*FdbCluster) GetPodsWithRole

func (fdbCluster *FdbCluster) GetPodsWithRole(role fdbv1beta2.ProcessRole) []corev1.Pod

GetPodsWithRole returns all Pods that have the provided role.

func (*FdbCluster) GetProcessCount

func (fdbCluster *FdbCluster) GetProcessCount(targetRole fdbv1beta2.ProcessRole) int

GetProcessCount returns the number of processes having the specified role

func (*FdbCluster) GetProcessCountByProcessClass added in v1.21.0

func (fdbCluster *FdbCluster) GetProcessCountByProcessClass(pClass fdbv1beta2.ProcessClass) int

GetProcessCountByProcessClass returns the number of processes based on process class

func (*FdbCluster) GetProcessCounts

func (fdbCluster *FdbCluster) GetProcessCounts() (fdbv1beta2.ProcessCounts, error)

GetProcessCounts returns the process counts of the current FoundationDBCluster.

func (*FdbCluster) GetResourceLabels

func (fdbCluster *FdbCluster) GetResourceLabels() map[string]string

GetResourceLabels returns the resource labels for all created resources of the current FoundationDBCluster.

func (*FdbCluster) GetServices

func (fdbCluster *FdbCluster) GetServices() *corev1.ServiceList

GetServices returns the services associated with the current FoundationDBCluster.

func (*FdbCluster) GetSidecarImageForVersion

func (fdbCluster *FdbCluster) GetSidecarImageForVersion(version string) string

GetSidecarImageForVersion return the sidecar image used for the specified version.

func (*FdbCluster) GetStatelessPods

func (fdbCluster *FdbCluster) GetStatelessPods() *corev1.PodList

GetStatelessPods returns all Pods of this cluster that have the process class stateless.

func (FdbCluster) GetStatus

func (fdbCluster FdbCluster) GetStatus() *fdbv1beta2.FoundationDBStatus

GetStatus returns fdb status queried from a random operator Pod in this clusters namespace.

func (*FdbCluster) GetStoragePods

func (fdbCluster *FdbCluster) GetStoragePods() *corev1.PodList

GetStoragePods returns all Pods of this cluster that have the process class storage.

func (*FdbCluster) GetStorageServerPerPod

func (fdbCluster *FdbCluster) GetStorageServerPerPod() int

GetStorageServerPerPod returns the current expected storage server per pod.

func (*FdbCluster) GetTransactionPods added in v1.21.0

func (fdbCluster *FdbCluster) GetTransactionPods() *corev1.PodList

GetTransactionPods returns all Pods of this cluster that have the process class transaction.

func (*FdbCluster) GetVolumeClaimsForProcesses

func (fdbCluster *FdbCluster) GetVolumeClaimsForProcesses(
	processClass fdbv1beta2.ProcessClass,
) *corev1.PersistentVolumeClaimList

GetVolumeClaimsForProcesses returns a list of volume claims belonging to this cluster and the specific process class.

func (*FdbCluster) GetVolumeSize

func (fdbCluster *FdbCluster) GetVolumeSize(
	processClass fdbv1beta2.ProcessClass,
) (resource.Quantity, error)

GetVolumeSize returns the volume size for the specified process class.

func (*FdbCluster) HasHeadlessService

func (fdbCluster *FdbCluster) HasHeadlessService() bool

HasHeadlessService returns true if the cluster has a headless service.

func (*FdbCluster) HasTLSEnabled

func (fdbCluster *FdbCluster) HasTLSEnabled() bool

HasTLSEnabled returns true if the cluster is running with TLS enabled.

func (FdbCluster) InvariantClusterStatusAvailable

func (fdbCluster FdbCluster) InvariantClusterStatusAvailable() error

InvariantClusterStatusAvailable checks if the cluster is available the whole test.

func (FdbCluster) InvariantClusterStatusAvailableWithThreshold

func (fdbCluster FdbCluster) InvariantClusterStatusAvailableWithThreshold(
	availabilityThreshold time.Duration,
) error

InvariantClusterStatusAvailableWithThreshold checks if the database is at a maximum unavailable for the provided threshold.

func (*FdbCluster) IsAvailable

func (fdbCluster *FdbCluster) IsAvailable() bool

IsAvailable returns true if the database is available.

func (*FdbCluster) Name

func (fdbCluster *FdbCluster) Name() string

Name returns the name for the FoundationDBCluster.

func (*FdbCluster) Namespace

func (fdbCluster *FdbCluster) Namespace() string

Namespace returns the namespace for the FoundationDBCluster.

func (*FdbCluster) ReplacePod

func (fdbCluster *FdbCluster) ReplacePod(pod corev1.Pod, waitForReconcile bool)

ReplacePod replaces the provided Pod if it's part of the FoundationDBCluster.

func (*FdbCluster) ReplacePods

func (fdbCluster *FdbCluster) ReplacePods(pods []corev1.Pod, waitForReconcile bool)

ReplacePods replaces the provided Pods in the current FoundationDBCluster.

func (*FdbCluster) RunFdbCliCommandInOperator

func (fdbCluster *FdbCluster) RunFdbCliCommandInOperator(
	command string,
	printOutput bool,
	timeout int,
) (string, string)

RunFdbCliCommandInOperator allows to run a command with fdbcli in the operator Pod.

func (*FdbCluster) RunFdbCliCommandInOperatorWithoutRetry

func (fdbCluster *FdbCluster) RunFdbCliCommandInOperatorWithoutRetry(
	command string,
	printOutput bool,
	timeout int,
) (string, string, error)

RunFdbCliCommandInOperatorWithoutRetry allows to run a command with fdbcli in the operator Pod without doing any retries.

func (*FdbCluster) SetAutoReplacements

func (fdbCluster *FdbCluster) SetAutoReplacements(enabled bool, detectionTime time.Duration) error

SetAutoReplacements will enabled or disable the auto replacement feature and allows to specify the detection time for a replacement.

func (*FdbCluster) SetAutoReplacementsWithWait

func (fdbCluster *FdbCluster) SetAutoReplacementsWithWait(
	enabled bool,
	detectionTime time.Duration,
	wait bool,
) error

SetAutoReplacementsWithWait set the auto replacement setting on the operator and only waits for the cluster to reconcile if wait is set to true.

func (*FdbCluster) SetBuggifyBlockRemoval

func (fdbCluster *FdbCluster) SetBuggifyBlockRemoval(blockRemovals []fdbv1beta2.ProcessGroupID)

SetBuggifyBlockRemoval will set the provided list of process group IDs to be blocked for removal.

func (*FdbCluster) SetClusterTaintConfig added in v1.18.0

func (fdbCluster *FdbCluster) SetClusterTaintConfig(taintOption []fdbv1beta2.TaintReplacementOption, taintReplacementTimeSeconds *int)

SetClusterTaintConfig set fdbCluster's TaintReplacementOptions

func (*FdbCluster) SetCrashLoopContainers

func (fdbCluster *FdbCluster) SetCrashLoopContainers(
	crashLoopContainers []fdbv1beta2.CrashLoopContainerObject,
	waitForReconcile bool,
)

SetCrashLoopContainers sets the crashLoopContainers of the FoundationDBCluster spec.

func (*FdbCluster) SetCustomParameters

func (fdbCluster *FdbCluster) SetCustomParameters(
	processClass fdbv1beta2.ProcessClass,
	customParameters fdbv1beta2.FoundationDBCustomParameters,
	waitForReconcile bool,
) error

SetCustomParameters allows to set the custom parameters of the provided process class.

func (*FdbCluster) SetDatabaseConfiguration

func (fdbCluster *FdbCluster) SetDatabaseConfiguration(
	config fdbv1beta2.DatabaseConfiguration,
	waitForReconcile bool,
) error

SetDatabaseConfiguration sets the provided DatabaseConfiguration for the FoundationDBCluster.

func (*FdbCluster) SetEmptyMonitorConf

func (fdbCluster *FdbCluster) SetEmptyMonitorConf(enable bool) error

SetEmptyMonitorConf sets the buggify option EmptyMonitorConf for the current FoundationDBCluster.

func (*FdbCluster) SetFinalizerForPvc

func (fdbCluster *FdbCluster) SetFinalizerForPvc(
	finalizers []string,
	pvc corev1.PersistentVolumeClaim,
) error

SetFinalizerForPvc allows to set the finalizers for the provided PVC.

func (*FdbCluster) SetIgnoreDuringRestart

func (fdbCluster *FdbCluster) SetIgnoreDuringRestart(processes []fdbv1beta2.ProcessGroupID)

SetIgnoreDuringRestart sets the buggify option for the operator.

func (*FdbCluster) SetIgnoreMissingProcessesSeconds

func (fdbCluster *FdbCluster) SetIgnoreMissingProcessesSeconds(duration time.Duration) error

SetIgnoreMissingProcessesSeconds sets the IgnoreMissingProcessesSeconds setting.

func (*FdbCluster) SetKillProcesses

func (fdbCluster *FdbCluster) SetKillProcesses(allowKill bool)

SetKillProcesses sets the automation option to allow the operator to restart processes or not.

func (*FdbCluster) SetLogServersPerPod added in v1.21.0

func (fdbCluster *FdbCluster) SetLogServersPerPod(
	serverPerPod int,
	waitForReconcile bool,
) error

SetLogServersPerPod set the LogServersPerPod field in the cluster spec.

func (*FdbCluster) SetPodAsUnschedulable

func (fdbCluster *FdbCluster) SetPodAsUnschedulable(pod corev1.Pod) error

SetPodAsUnschedulable sets the provided Pod on the NoSchedule list of the current FoundationDBCluster. This will make sure that the Pod is stuck in Pending.

func (*FdbCluster) SetProcessGroupPrefix

func (fdbCluster *FdbCluster) SetProcessGroupPrefix(prefix string) error

SetProcessGroupPrefix will set the process group prefix setting.

func (*FdbCluster) SetProcessGroupsAsUnschedulable added in v1.19.0

func (fdbCluster *FdbCluster) SetProcessGroupsAsUnschedulable(processGroups []fdbv1beta2.ProcessGroupID)

SetProcessGroupsAsUnschedulable sets the provided process groups on the NoSchedule list of the current FoundationDBCluster. This will make sure that the Pod is stuck in Pending.

func (*FdbCluster) SetPublicIPSource

func (fdbCluster *FdbCluster) SetPublicIPSource(publicIPSource fdbv1beta2.PublicIPSource) error

SetPublicIPSource will set the public IP source of the current FoundationDBCluster to the provided IP source.

func (*FdbCluster) SetSkipReconciliation

func (fdbCluster *FdbCluster) SetSkipReconciliation(skip bool) error

SetSkipReconciliation will set the skip setting for the current FoundationDBCluster. This setting will make sure that the operator is not taking any actions on this cluster.

func (*FdbCluster) SetStorageServerPerPod

func (fdbCluster *FdbCluster) SetStorageServerPerPod(serverPerPod int) error

SetStorageServerPerPod set the SetStorageServerPerPod field in the cluster spec.

func (*FdbCluster) SetTLS

func (fdbCluster *FdbCluster) SetTLS(
	enableMainContainerTLS bool,
	enableSidecarContainerTLS bool,
) error

SetTLS will enabled or disable the TLS setting in the current FoundationDBCluster.

func (*FdbCluster) SetTransactionServerPerPod added in v1.21.0

func (fdbCluster *FdbCluster) SetTransactionServerPerPod(
	serverPerPod int,
	processCount int,
	waitForReconcile bool,
) error

SetTransactionServerPerPod set the LogServersPerPod field in the cluster spec and changes log Pods to transaction Pods.

func (*FdbCluster) SetUseDNSInClusterFile

func (fdbCluster *FdbCluster) SetUseDNSInClusterFile(useDNSInClusterFile bool) error

SetUseDNSInClusterFile enables DNS in the cluster file. Enable this setting to use DNS instead of IP addresses in the connection string.

func (*FdbCluster) SetVolumeSize

func (fdbCluster *FdbCluster) SetVolumeSize(
	processClass fdbv1beta2.ProcessClass,
	size resource.Quantity,
) error

SetVolumeSize updates the volume size for the specified process class.

func (FdbCluster) StatusInvariantChecker

func (fdbCluster FdbCluster) StatusInvariantChecker(
	name string,
	threshold time.Duration,
	f func(status *fdbv1beta2.FoundationDBStatus) error,
) error

StatusInvariantChecker provides a way to check an invariant for the cluster status. nolint:nilerr

func (*FdbCluster) Update

func (fdbCluster *FdbCluster) Update() error

Update asynchronously updates this FDB cluster definition.

func (*FdbCluster) UpdateAnnotationsAndLabels added in v1.24.0

func (fdbCluster *FdbCluster) UpdateAnnotationsAndLabels(annotations map[string]string, labels map[string]string)

UpdateAnnotationsAndLabels will update the annotations and labels to the provided values. Example usage:

annotations := fdbCluster.GetCachedCluster().GetAnnotations()
if annotations == nil {
   annotations = map[string]string{}
}

annotations["foundationdb.org/testing"] = "awesome"
labels := fdbCluster.GetCachedCluster().GetLabels()
fdbCluster.UpdateAnnotationsAndLabels(annotations, labels)

func (*FdbCluster) UpdateClusterSpec

func (fdbCluster *FdbCluster) UpdateClusterSpec()

UpdateClusterSpec ensures that the FoundationDBCluster will be updated in Kubernetes. This method has a retry mechanism implemented and ensures that the provided (local) Spec matches the Spec in Kubernetes.

func (*FdbCluster) UpdateClusterSpecWithSpec

func (fdbCluster *FdbCluster) UpdateClusterSpecWithSpec(desiredSpec *fdbv1beta2.FoundationDBClusterSpec)

UpdateClusterSpecWithSpec ensures that the FoundationDBCluster will be updated in Kubernetes. This method as a retry mechanism implemented and ensures that the provided (local) Spec matches the Spec in Kubernetes. You must make sure that you call fdbCluster.GetCluster() before updating the spec, to make sure you are not overwriting the current state with an outdated state. An example on how to update a field with this method:

spec := fdbCluster.GetCluster().Spec.DeepCopy() // Fetch the current Spec.
spec.Version = "7.1.27" // Make your changes.

fdbCluster.UpdateClusterSpecWithSpec(spec) // Update the spec.

func (*FdbCluster) UpdateContainerImage

func (fdbCluster *FdbCluster) UpdateContainerImage(pod *corev1.Pod, containerName string, image string)

UpdateContainerImage sets the image for the provided Pod for the porvided container.

func (*FdbCluster) UpdateCoordinatorSelection

func (fdbCluster *FdbCluster) UpdateCoordinatorSelection(
	setting []fdbv1beta2.CoordinatorSelectionSetting,
) error

UpdateCoordinatorSelection allows to update the coordinator selection for the current FoundationDBCluster.

func (*FdbCluster) UpdateLogProcessCount

func (fdbCluster *FdbCluster) UpdateLogProcessCount(newLogProcessCount int) error

UpdateLogProcessCount updates the log process count in the cluster spec.

func (*FdbCluster) UpdateNode added in v1.18.0

func (fdbCluster *FdbCluster) UpdateNode(node *corev1.Node)

UpdateNode update node definition

func (*FdbCluster) UpdateStorageClass

func (fdbCluster *FdbCluster) UpdateStorageClass(
	storageClass string,
	processClass fdbv1beta2.ProcessClass,
) error

UpdateStorageClass this will set the StorageClass for the provided process class of the current FoundationDBCluster.

func (*FdbCluster) UpgradeAndVerify added in v1.25.0

func (fdbCluster *FdbCluster) UpgradeAndVerify(version string)

UpgradeAndVerify will upgrade the cluster to the new version and perform a check at the end that the running version matched the new version.

func (*FdbCluster) UpgradeCluster

func (fdbCluster *FdbCluster) UpgradeCluster(version string, waitForReconciliation bool) error

UpgradeCluster will upgrade the cluster to the specified version. If waitForReconciliation is set to true this method will block until the cluster is fully upgraded and all Pods are running the new image version.

func (*FdbCluster) ValidateProcessesCount added in v1.23.0

func (fdbCluster *FdbCluster) ValidateProcessesCount(
	processClass fdbv1beta2.ProcessClass,
	countProcessGroups int,
	countServer int,
)

ValidateProcessesCount will make sure that the cluster has the expected count of ProcessGroups and processes running with the provided ProcessClass.

func (*FdbCluster) VerifyVersion added in v1.25.0

func (fdbCluster *FdbCluster) VerifyVersion(version string)

VerifyVersion Checks if cluster is running at the expectedVersion. This is done by checking the status of the FoundationDBCluster status. Before that we checked the cluster status json by checking the reported version of all processes. This approach only worked for version compatible upgrades, since incompatible processes won't be part of the cluster anyway. To simplify the check we verify the reported running version from the operator.

func (*FdbCluster) WaitForPodRemoval

func (fdbCluster *FdbCluster) WaitForPodRemoval(pod *corev1.Pod) error

WaitForPodRemoval will wait until the specified Pod is deleted.

func (*FdbCluster) WaitForReconciliation

func (fdbCluster *FdbCluster) WaitForReconciliation(options ...func(*ReconciliationOptions)) error

WaitForReconciliation waits for the cluster to be reconciled based on the provided options.

func (*FdbCluster) WaitUntilAvailable

func (fdbCluster *FdbCluster) WaitUntilAvailable() error

WaitUntilAvailable waits until the cluster is available.

func (*FdbCluster) WaitUntilExists

func (fdbCluster *FdbCluster) WaitUntilExists()

WaitUntilExists synchronously waits until the cluster exists. Usually called after Create().

func (*FdbCluster) WaitUntilWithForceReconcile added in v1.18.0

func (fdbCluster *FdbCluster) WaitUntilWithForceReconcile(pollTimeInSeconds int, timeOutInSeconds int, checkMethod func(cluster *fdbv1beta2.FoundationDBCluster) bool) error

WaitUntilWithForceReconcile will wait either until the checkMethod returns true or until the timeout is hit.

type HaFdbCluster

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

HaFdbCluster is a struct around handling HA FoundationDBClusters.

func (*HaFdbCluster) Delete

func (haFDBCluster *HaFdbCluster) Delete()

Delete removes all Clusters associated FoundationDBClusters.

func (*HaFdbCluster) DumpState

func (haFDBCluster *HaFdbCluster) DumpState()

DumpState logs the current state of all FoundationDBClusters.

func (*HaFdbCluster) GetAllClusters

func (haFDBCluster *HaFdbCluster) GetAllClusters() []*FdbCluster

GetAllClusters Returns all FoundationDBClusters that span this HA cluster.

func (*HaFdbCluster) GetCluster

func (haFDBCluster *HaFdbCluster) GetCluster(suffix string) *FdbCluster

GetCluster returns the FoundationDBCluster with the provided suffix.

func (*HaFdbCluster) GetNamespaceSelector

func (haFDBCluster *HaFdbCluster) GetNamespaceSelector() v1alpha1.PodSelectorSpec

GetNamespaceSelector returns the chaos mesh selector for this FDB HA cluster and all associated Pods.

func (*HaFdbCluster) GetNamespaces

func (haFDBCluster *HaFdbCluster) GetNamespaces() []string

GetNamespaces returns the namespaces where all FoundationDBClusters are running in.

func (*HaFdbCluster) GetPrimary

func (haFDBCluster *HaFdbCluster) GetPrimary() *FdbCluster

GetPrimary returns the FoundationDBCluster matching the suffix from PrimaryID.

func (*HaFdbCluster) GetPrimarySatellite

func (haFDBCluster *HaFdbCluster) GetPrimarySatellite() *FdbCluster

GetPrimarySatellite returns the FoundationDBCluster matching the suffix from PrimarySatelliteID. This function is only valid for HA clusters using 2 satellites.

func (*HaFdbCluster) GetRemote

func (haFDBCluster *HaFdbCluster) GetRemote() *FdbCluster

GetRemote returns the FoundationDBCluster matching the suffix from RemoteID.

func (*HaFdbCluster) GetRemoteSatellite

func (haFDBCluster *HaFdbCluster) GetRemoteSatellite() *FdbCluster

GetRemoteSatellite returns the FoundationDBCluster matching the suffix from RemoteSatelliteID. This function is only valid for HA clusters using 2 satellites.

func (*HaFdbCluster) GetSatellite

func (haFDBCluster *HaFdbCluster) GetSatellite() *FdbCluster

GetSatellite this is only for threeZoneDoubleSat config, where `satellite` is primary satellite for both regions.

func (*HaFdbCluster) SetCustomParameters

func (haFDBCluster *HaFdbCluster) SetCustomParameters(processClass fdbv1beta2.ProcessClass,
	customParameters fdbv1beta2.FoundationDBCustomParameters,
	waitForReconcile bool) error

SetCustomParameters sets the custom parameters for the provided process class.

func (*HaFdbCluster) SetDatabaseConfiguration

func (haFDBCluster *HaFdbCluster) SetDatabaseConfiguration(
	config fdbv1beta2.DatabaseConfiguration,
)

SetDatabaseConfiguration sets the new DatabaseConfiguration, without waiting for reconciliation.

func (*HaFdbCluster) UpgradeCluster

func (haFDBCluster *HaFdbCluster) UpgradeCluster(version string, waitForReconciliation bool) error

UpgradeCluster upgrades the HA FoundationDBCluster to the specified version.

func (*HaFdbCluster) UpgradeClusterWithTimeout

func (haFDBCluster *HaFdbCluster) UpgradeClusterWithTimeout(
	version string,
	waitForReconciliation bool,
	timeout int,
) error

UpgradeClusterWithTimeout upgrades the HA FoundationDBCluster to the specified version with the provided timeout.

func (*HaFdbCluster) VerifyVersion added in v1.26.0

func (haFDBCluster *HaFdbCluster) VerifyVersion(version string)

VerifyVersion Checks if cluster is running at the expectedVersion. This is done by checking the status of the FoundationDBCluster status. Before that we checked the cluster status json by checking the reported version of all processes. This approach only worked for version compatible upgrades, since incompatible processes won't be part of the cluster anyway. To simplify the check we verify the reported running version from the operator.

func (*HaFdbCluster) WaitForReconciliation

func (haFDBCluster *HaFdbCluster) WaitForReconciliation(
	options ...func(*ReconciliationOptions),
) error

WaitForReconciliation waits for all associated FoundationDBClusters to be reconciled

type HaMode

type HaMode int

HaMode represents the targeted HA mode for the created cluster.

const (
	// HaModeNone refers to a single namespace without HA.
	HaModeNone HaMode = iota
	// HaFourZoneSingleSat refers to a cluster running in 4 namespaces and the DB config has only one satellite.
	HaFourZoneSingleSat
	// HaFourZoneDoubleSat refers to a cluster running in 4 namespaces and the DB config has two satellites.
	HaFourZoneDoubleSat
	// HaThreeZoneDoubleSat refers to a cluster running in 3 namespaces and the DB config has two satellites (triplet configuration).
	HaThreeZoneDoubleSat
	// HaFourZoneDoubleSatRF4 same as HaFourZoneDoubleSat but with the RedundancyModeDouble.
	HaFourZoneDoubleSatRF4
)

type ReconciliationOption

type ReconciliationOption func(*ReconciliationOptions)

ReconciliationOption defines the reconciliation option.

func CreationTrackerLoggerOption

func CreationTrackerLoggerOption(creationTrackerLogger CreationTrackerLogger) ReconciliationOption

CreationTrackerLoggerOption sets the creation tracker that will printout the time for the different creation stages.

func MinimumGenerationOption

func MinimumGenerationOption(minimumGeneration int64) ReconciliationOption

MinimumGenerationOption specifies the minimum generation to be reconciled too.

func PollTimeInSecondsOption

func PollTimeInSecondsOption(pollTimeInSeconds int) ReconciliationOption

PollTimeInSecondsOption defines the polling time for the reconciliation. If not set the default is 10 seconds

func SoftReconcileOption

func SoftReconcileOption(enable bool) ReconciliationOption

SoftReconcileOption specifies that the reconciliation is completed as soon as the Status.Generations.Reconciled reaches the expected generation. Independent of other possible Generations, e.g. it could be still the case that the operator has to delete additional Process Groups.

func TimeOutInSecondsOption

func TimeOutInSecondsOption(timeOutInSeconds int) ReconciliationOption

TimeOutInSecondsOption defines the timeout for the reconciliation. If not set the default is 4800 seconds

type ReconciliationOptions

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

ReconciliationOptions defines the different reconciliation options.

func MakeReconciliationOptionsStruct

func MakeReconciliationOptionsStruct(
	options ...func(*ReconciliationOptions),
) *ReconciliationOptions

MakeReconciliationOptionsStruct applies the provided options to the ReconciliationOptions.

type RoleInfo

type RoleInfo struct {
	Role string
	ID   string
}

RoleInfo stores information for one particular worker role.

type ShutdownHooks

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

ShutdownHooks allows fixtures to register a handler to be run at exit. Handlers run regardless of any preceding errors, and run in reverse order of registration.

func (*ShutdownHooks) Defer

func (shutdown *ShutdownHooks) Defer(f func() error)

Defer execution of func until after the test completes.

func (*ShutdownHooks) InvokeShutdownHandlers

func (shutdown *ShutdownHooks) InvokeShutdownHandlers()

InvokeShutdownHandlers in reverse order of registration.

type SidecarConfig

type SidecarConfig struct {
	// BaseImage the image reference without a tag.
	BaseImage string
	// SidecarTag represents the image tag for this configuration.
	SidecarTag string
	// FDBVersion represents the FoundationDB version for this config.
	FDBVersion fdbv1beta2.Version
	// ImagePullPolicy represents the pull policy for the sidecar.
	ImagePullPolicy corev1.PullPolicy
}

SidecarConfig represents the configuration for a sidecar. This can be used for templating.

type UpgradeTestConfiguration

type UpgradeTestConfiguration struct {
	// InitialVersion represents the version before the upgrade.
	InitialVersion fdbv1beta2.Version
	// TargetVersion represents the version to upgrade to.
	TargetVersion fdbv1beta2.Version
}

UpgradeTestConfiguration represents the configuration for an upgrade test. This includes the initial FoundationDB version and the target FoundationDB version to upgrade or downgrade the cluster to.

Jump to

Keyboard shortcuts

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