Documentation ¶
Index ¶
- func ClearMockAdminClients()
- func ClearMockLockClients()
- func NewMockAdminClient(cluster *fdbv1beta2.FoundationDBCluster, kubeClient client.Client) (fdbadminclient.AdminClient, error)
- func NewMockLockClient(cluster *fdbv1beta2.FoundationDBCluster) (fdbadminclient.LockClient, error)
- type AdminClient
- func (client *AdminClient) CanSafelyRemove(addresses []fdbv1beta2.ProcessAddress) ([]fdbv1beta2.ProcessAddress, error)
- func (client *AdminClient) ChangeCoordinators(addresses []fdbv1beta2.ProcessAddress) (string, error)
- func (client *AdminClient) Close() error
- func (client *AdminClient) ConfigureDatabase(configuration fdbv1beta2.DatabaseConfiguration, _ bool, version string) error
- func (client *AdminClient) ExcludeProcesses(addresses []fdbv1beta2.ProcessAddress) error
- func (client *AdminClient) FreezeStatus() error
- func (client *AdminClient) GetBackupStatus() (*fdbv1beta2.FoundationDBLiveBackupStatus, error)
- func (client *AdminClient) GetConnectionString() (string, error)
- func (client *AdminClient) GetCoordinatorSet() (map[string]fdbv1beta2.None, error)
- func (client *AdminClient) GetExclusions() ([]fdbv1beta2.ProcessAddress, error)
- func (client *AdminClient) GetLimitingDurabilityLag() (fdbv1beta2.FoundationDBStatusLagInfo, bool)
- func (client *AdminClient) GetMaintenanceZone() (string, error)
- func (client *AdminClient) GetProcessesUnderMaintenance() (map[fdbv1beta2.ProcessGroupID]int64, error)
- func (client *AdminClient) GetProtocolVersion(version string) (string, error)
- func (client *AdminClient) GetRestoreStatus() (string, error)
- func (client *AdminClient) GetStatus() (*fdbv1beta2.FoundationDBStatus, error)
- func (client *AdminClient) GetWorstDataLag() (fdbv1beta2.FoundationDBStatusLagInfo, bool)
- func (client *AdminClient) GetWorstDurabilityLag() (fdbv1beta2.FoundationDBStatusLagInfo, bool)
- func (client *AdminClient) IncludeProcesses(addresses []fdbv1beta2.ProcessAddress) error
- func (client *AdminClient) KillProcesses(addresses []fdbv1beta2.ProcessAddress) error
- func (client *AdminClient) MockAdditionalProcesses(processes []fdbv1beta2.ProcessGroupStatus)
- func (client *AdminClient) MockClientVersion(version string, clients []string)
- func (client *AdminClient) MockError(err error)
- func (client *AdminClient) MockIncorrectCommandLine(processGroupID fdbv1beta2.ProcessGroupID, incorrect bool)
- func (client *AdminClient) MockLocalityInfo(processGroupID fdbv1beta2.ProcessGroupID, locality map[string]string)
- func (client *AdminClient) MockMissingLocalities(processGroupID fdbv1beta2.ProcessGroupID, missingLocalities bool)
- func (client *AdminClient) MockMissingProcessGroup(processGroupID fdbv1beta2.ProcessGroupID, missing bool)
- func (client *AdminClient) MockUptimeSecondsForMaintenanceZone(seconds float64)
- func (client *AdminClient) ModifyBackup(snapshotPeriodSeconds int) error
- func (client *AdminClient) PauseBackups() error
- func (client *AdminClient) RemoveProcessesUnderMaintenance(ids []fdbv1beta2.ProcessGroupID) error
- func (client *AdminClient) ResetMaintenanceMode() error
- func (client *AdminClient) ResumeBackups() error
- func (client *AdminClient) SetKnobs(knobs []string)
- func (client *AdminClient) SetLimitingDurabilityLag(lagInfo *fdbv1beta2.FoundationDBStatusLagInfo)
- func (client *AdminClient) SetMaintenanceZone(zone string, _ int) error
- func (client *AdminClient) SetProcessesUnderMaintenance(ids []fdbv1beta2.ProcessGroupID, timestamp int64) error
- func (client *AdminClient) SetTimeout(_ time.Duration)
- func (client *AdminClient) SetWorstDataLag(lagInfo *fdbv1beta2.FoundationDBStatusLagInfo)
- func (client *AdminClient) SetWorstDurabilityLag(lagInfo *fdbv1beta2.FoundationDBStatusLagInfo)
- func (client *AdminClient) StartBackup(url string, snapshotPeriodSeconds int) error
- func (client *AdminClient) StartRestore(url string, _ []fdbv1beta2.FoundationDBKeyRange) error
- func (client *AdminClient) StopBackup(url string) error
- func (client *AdminClient) UnfreezeStatus()
- func (client *AdminClient) VersionSupported(versionString string) (bool, error)
- func (client *AdminClient) WithValues(_ ...interface{})
- type DatabaseClientProvider
- type LockClient
- func (client *LockClient) AddPendingUpgrades(version fdbv1beta2.Version, processGroupIDs []fdbv1beta2.ProcessGroupID) error
- func (client *LockClient) ClearPendingUpgrades() error
- func (client *LockClient) Disabled() bool
- func (client *LockClient) GetDenyList() ([]string, error)
- func (client *LockClient) GetPendingUpgrades(version fdbv1beta2.Version) (map[fdbv1beta2.ProcessGroupID]bool, error)
- func (client *LockClient) ReleaseLock() error
- func (client *LockClient) TakeLock() (bool, error)
- func (client *LockClient) UpdateDenyList(locks []fdbv1beta2.LockDenyListEntry) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearMockAdminClients ¶
func ClearMockAdminClients()
ClearMockAdminClients clears the cache of mock Admin clients
func ClearMockLockClients ¶
func ClearMockLockClients()
ClearMockLockClients clears the cache of mock lock clients
func NewMockAdminClient ¶
func NewMockAdminClient(cluster *fdbv1beta2.FoundationDBCluster, kubeClient client.Client) (fdbadminclient.AdminClient, error)
NewMockAdminClient creates an admin client for a cluster.
func NewMockLockClient ¶
func NewMockLockClient(cluster *fdbv1beta2.FoundationDBCluster) (fdbadminclient.LockClient, error)
NewMockLockClient creates a mock lock client.
Types ¶
type AdminClient ¶
type AdminClient struct { Cluster *fdbv1beta2.FoundationDBCluster KubeClient client.Client DatabaseConfiguration *fdbv1beta2.DatabaseConfiguration ExcludedAddresses map[string]fdbv1beta2.None KilledAddresses map[string]fdbv1beta2.None Knobs map[string]fdbv1beta2.None FrozenStatus *fdbv1beta2.FoundationDBStatus Backups map[string]fdbv1beta2.FoundationDBBackupStatusBackupDetails VersionProcessGroups map[fdbv1beta2.ProcessGroupID]string ReincludedAddresses map[string]bool MaxZoneFailuresWithoutLosingData *int MaxZoneFailuresWithoutLosingAvailability *int MaintenanceZone fdbv1beta2.FaultDomain TeamTracker []fdbv1beta2.FoundationDBStatusTeamTracker Logs []fdbv1beta2.FoundationDBStatusLogInfo LagInfo map[string]fdbv1beta2.FoundationDBStatusLagInfo // contains filtered or unexported fields }
AdminClient provides a mock implementation of the cluster admin interface
func NewMockAdminClientUncast ¶
func NewMockAdminClientUncast(cluster *fdbv1beta2.FoundationDBCluster, kubeClient client.Client) (*AdminClient, error)
NewMockAdminClientUncast creates a mock admin client for a cluster. nolint:unparam is required because we always return a nil error
func (*AdminClient) CanSafelyRemove ¶
func (client *AdminClient) CanSafelyRemove(addresses []fdbv1beta2.ProcessAddress) ([]fdbv1beta2.ProcessAddress, error)
CanSafelyRemove checks whether it is safe to remove the process group from the cluster
The list returned by this method will be the addresses that are *not* safe to remove.
func (*AdminClient) ChangeCoordinators ¶
func (client *AdminClient) ChangeCoordinators(addresses []fdbv1beta2.ProcessAddress) (string, error)
ChangeCoordinators changes the coordinator set
func (*AdminClient) Close ¶
func (client *AdminClient) Close() error
Close shuts down any resources for the client once it is no longer needed.
func (*AdminClient) ConfigureDatabase ¶
func (client *AdminClient) ConfigureDatabase(configuration fdbv1beta2.DatabaseConfiguration, _ bool, version string) error
ConfigureDatabase changes the database configuration
func (*AdminClient) ExcludeProcesses ¶
func (client *AdminClient) ExcludeProcesses(addresses []fdbv1beta2.ProcessAddress) error
ExcludeProcesses starts evacuating processes so that they can be removed from the database.
func (*AdminClient) FreezeStatus ¶
func (client *AdminClient) FreezeStatus() error
FreezeStatus causes the GetStatus method to return its current value until UnfreezeStatus is called, or another method is called which would invalidate the status.
func (*AdminClient) GetBackupStatus ¶
func (client *AdminClient) GetBackupStatus() (*fdbv1beta2.FoundationDBLiveBackupStatus, error)
GetBackupStatus gets the status of the current backup.
func (*AdminClient) GetConnectionString ¶
func (client *AdminClient) GetConnectionString() (string, error)
GetConnectionString fetches the latest connection string.
func (*AdminClient) GetCoordinatorSet ¶
func (client *AdminClient) GetCoordinatorSet() (map[string]fdbv1beta2.None, error)
GetCoordinatorSet gets the current coordinators from the status
func (*AdminClient) GetExclusions ¶
func (client *AdminClient) GetExclusions() ([]fdbv1beta2.ProcessAddress, error)
GetExclusions gets a list of the addresses currently excluded from the database.
func (*AdminClient) GetLimitingDurabilityLag ¶ added in v1.20.0
func (client *AdminClient) GetLimitingDurabilityLag() (fdbv1beta2.FoundationDBStatusLagInfo, bool)
GetLimitingDurabilityLag returns the limiting durability lag of any storage server in the cluster.
func (*AdminClient) GetMaintenanceZone ¶
func (client *AdminClient) GetMaintenanceZone() (string, error)
GetMaintenanceZone gets current maintenance zone, if any
func (*AdminClient) GetProcessesUnderMaintenance ¶ added in v1.35.0
func (client *AdminClient) GetProcessesUnderMaintenance() (map[fdbv1beta2.ProcessGroupID]int64, error)
GetProcessesUnderMaintenance will return all process groups that are currently stored to be under maintenance. The result is a map with the process group ID as key and the start of the maintenance as value.
func (*AdminClient) GetProtocolVersion ¶
func (client *AdminClient) GetProtocolVersion(version string) (string, error)
GetProtocolVersion determines the protocol version that is used by a version of FDB.
func (*AdminClient) GetRestoreStatus ¶
func (client *AdminClient) GetRestoreStatus() (string, error)
GetRestoreStatus gets the status of the current restore.
func (*AdminClient) GetStatus ¶
func (client *AdminClient) GetStatus() (*fdbv1beta2.FoundationDBStatus, error)
GetStatus gets the database's status
func (*AdminClient) GetWorstDataLag ¶ added in v1.20.0
func (client *AdminClient) GetWorstDataLag() (fdbv1beta2.FoundationDBStatusLagInfo, bool)
GetWorstDataLag returns the (mocked) worst data lag of any storage server in the cluster.
func (*AdminClient) GetWorstDurabilityLag ¶ added in v1.20.0
func (client *AdminClient) GetWorstDurabilityLag() (fdbv1beta2.FoundationDBStatusLagInfo, bool)
GetWorstDurabilityLag returns the (mocked) worst durability lag of any storage server in the cluster.
func (*AdminClient) IncludeProcesses ¶
func (client *AdminClient) IncludeProcesses(addresses []fdbv1beta2.ProcessAddress) error
IncludeProcesses removes processes from the exclusion list and allows them to take on roles again.
func (*AdminClient) KillProcesses ¶
func (client *AdminClient) KillProcesses(addresses []fdbv1beta2.ProcessAddress) error
KillProcesses restarts processes
func (*AdminClient) MockAdditionalProcesses ¶
func (client *AdminClient) MockAdditionalProcesses(processes []fdbv1beta2.ProcessGroupStatus)
MockAdditionalProcesses adds additional processes to the cluster status.
func (*AdminClient) MockClientVersion ¶
func (client *AdminClient) MockClientVersion(version string, clients []string)
MockClientVersion returns a mocked client version
func (*AdminClient) MockError ¶ added in v1.20.0
func (client *AdminClient) MockError(err error)
MockError mocks an error that will be returned when making any calls to the mock client. This can be reset by passing a nil value to this method.
func (*AdminClient) MockIncorrectCommandLine ¶
func (client *AdminClient) MockIncorrectCommandLine(processGroupID fdbv1beta2.ProcessGroupID, incorrect bool)
MockIncorrectCommandLine updates the mock for whether a process group should be have an incorrect command-line.
func (*AdminClient) MockLocalityInfo ¶
func (client *AdminClient) MockLocalityInfo(processGroupID fdbv1beta2.ProcessGroupID, locality map[string]string)
MockLocalityInfo sets mock locality information for a process.
func (*AdminClient) MockMissingLocalities ¶ added in v1.16.0
func (client *AdminClient) MockMissingLocalities(processGroupID fdbv1beta2.ProcessGroupID, missingLocalities bool)
MockMissingLocalities updates the mock to remove the localities for the provided process group.
func (*AdminClient) MockMissingProcessGroup ¶
func (client *AdminClient) MockMissingProcessGroup(processGroupID fdbv1beta2.ProcessGroupID, missing bool)
MockMissingProcessGroup updates the mock for whether a process group should be missing from the cluster status.
func (*AdminClient) MockUptimeSecondsForMaintenanceZone ¶
func (client *AdminClient) MockUptimeSecondsForMaintenanceZone(seconds float64)
MockUptimeSecondsForMaintenanceZone mocks the uptime for maintenance zone
func (*AdminClient) ModifyBackup ¶
func (client *AdminClient) ModifyBackup(snapshotPeriodSeconds int) error
ModifyBackup reconfigures the backup.
func (*AdminClient) PauseBackups ¶
func (client *AdminClient) PauseBackups() error
PauseBackups pauses backups.
func (*AdminClient) RemoveProcessesUnderMaintenance ¶ added in v1.35.0
func (client *AdminClient) RemoveProcessesUnderMaintenance(ids []fdbv1beta2.ProcessGroupID) error
RemoveProcessesUnderMaintenance will remove the provided process groups from the list of processes that are planned to be taken down for maintenance.
func (*AdminClient) ResetMaintenanceMode ¶
func (client *AdminClient) ResetMaintenanceMode() error
ResetMaintenanceMode resets the maintenance zone
func (*AdminClient) ResumeBackups ¶
func (client *AdminClient) ResumeBackups() error
ResumeBackups resumes backups.
func (*AdminClient) SetKnobs ¶
func (client *AdminClient) SetKnobs(knobs []string)
SetKnobs sets the knobs that should be used for the commandline call.
func (*AdminClient) SetLimitingDurabilityLag ¶ added in v1.20.0
func (client *AdminClient) SetLimitingDurabilityLag(lagInfo *fdbv1beta2.FoundationDBStatusLagInfo)
SetLimitingDurabilityLag sets/mocks the limiting durability lag of any storage server in the cluster.
func (*AdminClient) SetMaintenanceZone ¶
func (client *AdminClient) SetMaintenanceZone(zone string, _ int) error
SetMaintenanceZone places zone into maintenance mode
func (*AdminClient) SetProcessesUnderMaintenance ¶ added in v1.35.0
func (client *AdminClient) SetProcessesUnderMaintenance(ids []fdbv1beta2.ProcessGroupID, timestamp int64) error
SetProcessesUnderMaintenance will add the provided process groups to the list of processes that will be taken down for maintenance. The value will be the provided time stamp.
func (*AdminClient) SetTimeout ¶ added in v1.28.1
func (client *AdminClient) SetTimeout(_ time.Duration)
SetTimeout will overwrite the default timeout for interacting the FDB cluster.
func (*AdminClient) SetWorstDataLag ¶ added in v1.20.0
func (client *AdminClient) SetWorstDataLag(lagInfo *fdbv1beta2.FoundationDBStatusLagInfo)
SetWorstDataLag sets/mocks the worst data lag of any storage server in the cluster.
func (*AdminClient) SetWorstDurabilityLag ¶ added in v1.20.0
func (client *AdminClient) SetWorstDurabilityLag(lagInfo *fdbv1beta2.FoundationDBStatusLagInfo)
SetWorstDurabilityLag sets/mocks the worst durability lag of any storage server in the cluster.
func (*AdminClient) StartBackup ¶
func (client *AdminClient) StartBackup(url string, snapshotPeriodSeconds int) error
StartBackup starts a new backup.
func (*AdminClient) StartRestore ¶
func (client *AdminClient) StartRestore(url string, _ []fdbv1beta2.FoundationDBKeyRange) error
StartRestore starts a new restore.
func (*AdminClient) StopBackup ¶
func (client *AdminClient) StopBackup(url string) error
StopBackup stops a backup.
func (*AdminClient) UnfreezeStatus ¶
func (client *AdminClient) UnfreezeStatus()
UnfreezeStatus causes the admin client to start recalculating the status on every call to GetStatus
func (*AdminClient) VersionSupported ¶
func (client *AdminClient) VersionSupported(versionString string) (bool, error)
VersionSupported reports whether we can support a cluster with a given version.
func (*AdminClient) WithValues ¶ added in v1.20.1
func (client *AdminClient) WithValues(_ ...interface{})
WithValues will update the logger used by the current AdminClient to contain the provided key value pairs. The provided arguments must be even.
type DatabaseClientProvider ¶
type DatabaseClientProvider struct{}
DatabaseClientProvider is a DatabaseClientProvider thar provides mocked clients for testing.
func (DatabaseClientProvider) GetAdminClient ¶
func (p DatabaseClientProvider) GetAdminClient(cluster *fdbv1beta2.FoundationDBCluster, kubernetesClient client.Client) (fdbadminclient.AdminClient, error)
GetAdminClient generates a client for performing administrative actions against the database.
func (DatabaseClientProvider) GetLockClient ¶
func (p DatabaseClientProvider) GetLockClient(cluster *fdbv1beta2.FoundationDBCluster) (fdbadminclient.LockClient, error)
GetLockClient generates a client for working with locks through the database.
type LockClient ¶
type LockClient struct {
// contains filtered or unexported fields
}
LockClient provides a mock client for managing operation locks.
func NewMockLockClientUncast ¶
func NewMockLockClientUncast(cluster *fdbv1beta2.FoundationDBCluster) *LockClient
NewMockLockClientUncast creates a mock lock client.
func (*LockClient) AddPendingUpgrades ¶
func (client *LockClient) AddPendingUpgrades(version fdbv1beta2.Version, processGroupIDs []fdbv1beta2.ProcessGroupID) error
AddPendingUpgrades registers information about which process groups are pending an upgrade to a new version.
func (*LockClient) ClearPendingUpgrades ¶
func (client *LockClient) ClearPendingUpgrades() error
ClearPendingUpgrades clears any stored information about pending upgrades.
func (*LockClient) Disabled ¶
func (client *LockClient) Disabled() bool
Disabled determines if the client should automatically grant locks.
func (*LockClient) GetDenyList ¶
func (client *LockClient) GetDenyList() ([]string, error)
GetDenyList retrieves the current deny list from the database.
func (*LockClient) GetPendingUpgrades ¶
func (client *LockClient) GetPendingUpgrades(version fdbv1beta2.Version) (map[fdbv1beta2.ProcessGroupID]bool, error)
GetPendingUpgrades returns the stored information about which process groups are pending an upgrade to a new version.
func (*LockClient) ReleaseLock ¶ added in v1.25.0
func (client *LockClient) ReleaseLock() error
ReleaseLock will release the current lock. The method will only release the lock if the current operator is the lock holder.
func (*LockClient) TakeLock ¶
func (client *LockClient) TakeLock() (bool, error)
TakeLock attempts to acquire a lock.
func (*LockClient) UpdateDenyList ¶
func (client *LockClient) UpdateDenyList(locks []fdbv1beta2.LockDenyListEntry) error
UpdateDenyList updates the deny list to match a list of entries. This will return the complete deny list after these changes are made.