Documentation ¶
Index ¶
- Constants
- func CheckIfLearnerPresent(ctx context.Context, cli etcdClient.ClusterCloser) (bool, error)
- func ContainsBackup(store brtypes.SnapStore, logger *logrus.Logger) bool
- func CreateBackoff(retryPeriod time.Duration, steps int) wait.Backoff
- func DoPromoteMember(ctx context.Context, member *etcdserverpb.Member, cli etcdClient.ClusterCloser, ...) error
- func GetAllEtcdEndpoints(ctx context.Context, client etcdClient.ClusterCloser, ...) ([]string, error)
- func GetBackupLeaderEndPoint(endPoints []string, port uint) (string, error)
- func GetClusterSize(cluster string) (int, error)
- func GetConfigFilePath() string
- func GetEnvVarOrError(varName string) (string, error)
- func GetFakeKubernetesClientSet() client.Client
- func GetFilteredBackups(store brtypes.SnapStore, maxBackups int, ...) (brtypes.SnapList, error)
- func GetInitialClusterStateIfScaleup(ctx context.Context, logger logrus.Entry, clientSet client.Client, ...) (*string, error)
- func GetKubernetesClientSetOrError() (client.Client, error)
- func GetLatestFullSnapshotAndDeltaSnapList(store brtypes.SnapStore) (*brtypes.Snapshot, brtypes.SnapList, error)
- func GetLeader(ctx context.Context, clientMaintenance etcdClient.MaintenanceCloser, ...) (uint64, []string, error)
- func GetMemberPeerURL(configFile string, podName string) (string, error)
- func GetPrevScheduledSnapTime(nextSnapSchedule time.Time, timeWindow float64) time.Time
- func GetStatefulSet(ctx context.Context, clientSet client.Client, podNamespace string, ...) (*appsv1.StatefulSet, error)
- func IsAnnotationPresent(sts *appsv1.StatefulSet, annotation string) bool
- func IsBackupBucketEmpty(snapStoreConfig *brtypes.SnapstoreConfig, logger *logrus.Logger) bool
- func IsEtcdClusterHealthy(ctx context.Context, client etcdClient.MaintenanceCloser, ...) (bool, error)
- func IsMultiNode(logger *logrus.Entry) bool
- func IsPeerURLTLSEnabled() (bool, error)
- func ParsePeerURL(initialAdvertisePeerURLs, podName string) (string, error)
- func ProbeEtcd(ctx context.Context, clientFactory etcdClient.Factory, logger *logrus.Entry) error
- func ReadConfigFileAsMap(path string) (map[string]interface{}, error)
- func RemoveDir(dir string) error
- func RemoveMemberFromCluster(ctx context.Context, cli etcdClient.ClusterCloser, memberID uint64, ...) error
- func RestartEtcdWrapper(ctx context.Context, tlsEnabled bool, ...) error
- func SleepWithContext(ctx context.Context, sleepFor time.Duration) error
- func StartEmbeddedEtcd(logger *logrus.Entry, ro *brtypes.RestoreOptions) (*embed.Etcd, error)
Constants ¶
const ( // NoLeaderState defines the state when etcd returns LeaderID as 0. NoLeaderState uint64 = 0 // EtcdConfigFilePath is the file path where the etcd config map is mounted. EtcdConfigFilePath string = "/var/etcd/config/etcd.conf.yaml" // ClusterStateNew defines the "new" state of etcd cluster. ClusterStateNew = "new" // ClusterStateExisting defines the "existing" state of etcd cluster. ClusterStateExisting = "existing" // ScaledToMultiNodeAnnotationKey defines annotation key for scale-up to multi-node cluster. ScaledToMultiNodeAnnotationKey = "gardener.cloud/scaled-to-multi-node" )
Variables ¶
This section is empty.
Functions ¶
func CheckIfLearnerPresent ¶ added in v0.29.0
func CheckIfLearnerPresent(ctx context.Context, cli etcdClient.ClusterCloser) (bool, error)
CheckIfLearnerPresent checks whether a learner(non-voting) member present or not.
func ContainsBackup ¶ added in v0.29.0
ContainsBackup checks whether the backup is present in given SnapStore or not.
func CreateBackoff ¶ added in v0.29.0
CreateBackoff returns the backoff with Factor=2 with upper limit of 120sec.
func DoPromoteMember ¶ added in v0.29.0
func DoPromoteMember(ctx context.Context, member *etcdserverpb.Member, cli etcdClient.ClusterCloser, logger *logrus.Entry) error
DoPromoteMember promotes a given learner to a voting member.
func GetAllEtcdEndpoints ¶ added in v0.29.0
func GetAllEtcdEndpoints(ctx context.Context, client etcdClient.ClusterCloser, etcdConnectionConfig *brtypes.EtcdConnectionConfig, logger *logrus.Entry) ([]string, error)
GetAllEtcdEndpoints returns the endPoints of all etcd-member.
func GetBackupLeaderEndPoint ¶ added in v0.29.0
GetBackupLeaderEndPoint takes etcd leader endpoint and portNo. of backup-restore and returns the backupLeader endpoint.
func GetClusterSize ¶ added in v0.29.0
GetClusterSize returns the size of a cluster passed as a string
func GetConfigFilePath ¶ added in v0.29.0
func GetConfigFilePath() string
GetConfigFilePath returns the path of the etcd configuration file
func GetEnvVarOrError ¶ added in v0.29.0
GetEnvVarOrError returns the value of specified environment variable or error if it's not defined.
func GetFakeKubernetesClientSet ¶ added in v0.29.0
GetFakeKubernetesClientSet creates a fake client set. To be used for unit tests
func GetFilteredBackups ¶ added in v0.29.0
func GetFilteredBackups(store brtypes.SnapStore, maxBackups int, filter func(snaps brtypes.Snapshot) bool) (brtypes.SnapList, error)
GetFilteredBackups returns sorted by date (new -> old) SnapList. It will also filter the snapshots that should be included or not using the filter function. If the filter is nil it will return all snapshots. Also, maxBackups can be used to target only the last N snapshots (-1 = all).
func GetInitialClusterStateIfScaleup ¶ added in v0.29.0
func GetInitialClusterStateIfScaleup(ctx context.Context, logger logrus.Entry, clientSet client.Client, podName string, podNS string) (*string, error)
GetInitialClusterStateIfScaleup checks if it is the Scale-up scenario and returns the cluster state either `new` or `existing`.
func GetKubernetesClientSetOrError ¶ added in v0.29.0
GetKubernetesClientSetOrError creates and returns a kubernetes clientset or an error if creation fails
func GetLatestFullSnapshotAndDeltaSnapList ¶
func GetLatestFullSnapshotAndDeltaSnapList(store brtypes.SnapStore) (*brtypes.Snapshot, brtypes.SnapList, error)
GetLatestFullSnapshotAndDeltaSnapList returns the latest snapshot
func GetLeader ¶ added in v0.29.0
func GetLeader(ctx context.Context, clientMaintenance etcdClient.MaintenanceCloser, client etcdClient.ClusterCloser, endpoint string) (uint64, []string, error)
GetLeader will return the LeaderID as well as url of etcd leader.
func GetMemberPeerURL ¶ added in v0.30.2
GetMemberPeerURL returns the peerURL from fiven configuration file provided to etcd member.
func GetPrevScheduledSnapTime ¶ added in v0.29.0
GetPrevScheduledSnapTime returns the previous schedule snapshot time. TODO: Previous full snapshot time should be calculated on basis of previous cron schedule of full snapshot.
func GetStatefulSet ¶ added in v0.29.0
func GetStatefulSet(ctx context.Context, clientSet client.Client, podNamespace string, podName string) (*appsv1.StatefulSet, error)
GetStatefulSet gets the StatefulSet with the name podName in podNamespace namespace. It will return if there is any error or the StatefulSet is not found.
func IsAnnotationPresent ¶ added in v0.29.0
func IsAnnotationPresent(sts *appsv1.StatefulSet, annotation string) bool
IsAnnotationPresent checks the presence of given annotation in a given statefulset.
func IsBackupBucketEmpty ¶ added in v0.29.0
func IsBackupBucketEmpty(snapStoreConfig *brtypes.SnapstoreConfig, logger *logrus.Logger) bool
IsBackupBucketEmpty checks whether the backup bucket is empty or not.
func IsEtcdClusterHealthy ¶ added in v0.29.0
func IsEtcdClusterHealthy(ctx context.Context, client etcdClient.MaintenanceCloser, etcdConnectionConfig *brtypes.EtcdConnectionConfig, etcdEndpoints []string, logger *logrus.Entry) (bool, error)
IsEtcdClusterHealthy checks whether all members of etcd cluster are in healthy state or not.
func IsMultiNode ¶ added in v0.29.0
IsMultiNode determines whether a pod is part of a multi node setup or not This is determined by checking the `initial-cluster` of the etcd configmap to check the number of members expected
func IsPeerURLTLSEnabled ¶ added in v0.29.0
IsPeerURLTLSEnabled checks whether the peer address is TLS enabled or not.
func ParsePeerURL ¶ added in v0.29.0
ParsePeerURL forms a PeerURL, given podName by parsing the initial-advertise-peer-urls
func ProbeEtcd ¶ added in v0.29.0
ProbeEtcd probes the etcd endpoint to check if an etcd is available
func ReadConfigFileAsMap ¶ added in v0.29.0
ReadConfigFileAsMap reads the config file given a path and converts it into a map[string]interface{}
func RemoveDir ¶ added in v0.29.0
RemoveDir removes the directory(if exist) and do nothing if directory doesn't exist.
func RemoveMemberFromCluster ¶ added in v0.29.0
func RemoveMemberFromCluster(ctx context.Context, cli etcdClient.ClusterCloser, memberID uint64, logger *logrus.Entry) error
RemoveMemberFromCluster removes member of given ID from etcd cluster.
func RestartEtcdWrapper ¶ added in v0.30.2
func RestartEtcdWrapper(ctx context.Context, tlsEnabled bool, etcdConnectionConfig *brtypes.EtcdConnectionConfig) error
RestartEtcdWrapper is to call the "/stop" endpoint of etcd-wrapper to restart the etcd-wrapper container.
func SleepWithContext ¶ added in v0.29.0
SleepWithContext sleeps for a determined period while respecting a context
func StartEmbeddedEtcd ¶ added in v0.29.0
StartEmbeddedEtcd starts the embedded etcd server.
Types ¶
This section is empty.