Documentation ¶
Index ¶
- Constants
- func DeepCopyURL(in *url.URL) *url.URL
- func DeepCopyURLs(in types.URLs) types.URLs
- type ApplierInfo
- type CompactOptions
- type CompactorConfig
- type Config
- type EtcdConnectionConfig
- type EtcdMemberStatusCallbackFunc
- type Event
- type ExponentialBackoffConfig
- type FetcherInfo
- type HealthConfig
- type InitIndex
- type LeaderCallbacks
- type MemberLeaseCallbacks
- type NewClientFactoryFunc
- type PromoteLearnerCallback
- type RestorationConfig
- type RestoreOptions
- type SnapList
- type SnapStore
- type Snapshot
- type SnapshotterConfig
- type SnapshotterState
- type SnapstoreConfig
Constants ¶
const ( // DefaultEtcdConnectionTimeout defines default timeout duration for etcd client connection. DefaultEtcdConnectionTimeout time.Duration = 30 * time.Second // DefaultDefragConnectionTimeout defines default timeout duration for ETCD defrag call. DefaultDefragConnectionTimeout time.Duration = 8 * time.Minute // DefaultSnapshotTimeout defines default timeout duration for taking FullSnapshot. DefaultSnapshotTimeout time.Duration = 15 * time.Minute // DefragRetryPeriod is used as the duration after which a defragmentation is retried. DefragRetryPeriod time.Duration = 1 * time.Minute )
const ( // DefaultSnapshotLeaseRenewalEnabled is a default value for enabling the snapshot lease renewal feature DefaultSnapshotLeaseRenewalEnabled = false // FullSnapshotLeaseUpdateInterval is the interval for updating full snapshot lease FullSnapshotLeaseUpdateInterval = 1 * time.Minute // DefaultMemberLeaseRenewalEnabled is a default value for enabling the member lease renewal feature DefaultMemberLeaseRenewalEnabled = false // DefaultEtcdMemberGCEnabled is a default value for enabling the etcd member garbage collection feature DefaultEtcdMemberGCEnabled = false // DefaultFullSnapshotLeaseName is the name for the full snapshot lease. DefaultFullSnapshotLeaseName = "full-snapshot-revisions" // DefaultDeltaSnapshotLeaseName is the name for the delta snapshot lease. DefaultDeltaSnapshotLeaseName = "delta-snapshot-revisions" // DefaultHeartbeatDuration is the default heartbeat duration or lease renewal deletion. DefaultHeartbeatDuration = 30 * time.Second // LeaseUpdateTimeoutDuration is the timeout duration for updating snapshot leases LeaseUpdateTimeoutDuration = 60 * time.Second // DefaultMemberGarbageCollectionPeriod is the default etcd member garbage collection period. DefaultMemberGarbageCollectionPeriod = 60 * time.Second )
const ( // DefaultReelectionPeriod defines default time period for Reelection. DefaultReelectionPeriod = 5 * time.Second // DefaultEtcdStatusConnecTimeout defines default ConnectionTimeout for etcd client to get Etcd endpoint status. DefaultEtcdStatusConnecTimeout = 5 * time.Second )
const ( // GarbageCollectionPolicyExponential defines the exponential policy for garbage collecting old backups GarbageCollectionPolicyExponential = "Exponential" // GarbageCollectionPolicyLimitBased defines the limit based policy for garbage collecting old backups GarbageCollectionPolicyLimitBased = "LimitBased" // DefaultMaxBackups is default number of maximum backups for limit based garbage collection policy. DefaultMaxBackups = 7 // SnapshotterInactive is set when the snapshotter has not started taking snapshots. SnapshotterInactive SnapshotterState = 0 // SnapshotterActive is set when the snapshotter has started taking snapshots. SnapshotterActive SnapshotterState = 1 // DefaultDeltaSnapMemoryLimit is default memory limit for delta snapshots. DefaultDeltaSnapMemoryLimit = 10 * 1024 * 1024 //10Mib // DefaultDeltaSnapshotInterval is the default interval for delta snapshots. DefaultDeltaSnapshotInterval = 20 * time.Second // DefaultFullSnapshotSchedule is the default schedule DefaultFullSnapshotSchedule = "0 */1 * * *" // DefaultGarbageCollectionPeriod is the default interval for garbage collection DefaultGarbageCollectionPeriod = time.Minute // DeltaSnapshotIntervalThreshold is interval between delta snapshot DeltaSnapshotIntervalThreshold = time.Second )
const ( // SnapstoreProviderLocal is constant for local disk storage provider. SnapstoreProviderLocal = "Local" // SnapstoreProviderS3 is constant for aws S3 storage provider. SnapstoreProviderS3 = "S3" // SnapstoreProviderABS is constant for azure blob storage provider. SnapstoreProviderABS = "ABS" // SnapstoreProviderGCS is constant for GCS object storage provider. SnapstoreProviderGCS = "GCS" // SnapstoreProviderSwift is constant for Swift object storage. SnapstoreProviderSwift = "Swift" // SnapstoreProviderOSS is constant for Alicloud OSS storage provider. SnapstoreProviderOSS = "OSS" // SnapstoreProviderECS is constant for Dell EMC ECS S3 storage provider. SnapstoreProviderECS = "ECS" // SnapstoreProviderOCS is constant for OpenShift Container Storage S3 storage provider. SnapstoreProviderOCS = "OCS" // SnapstoreProviderFakeFailed is constant for fake failed storage provider. SnapstoreProviderFakeFailed = "FAILED" // SnapshotKindFull is constant for full snapshot kind. SnapshotKindFull = "Full" // SnapshotKindDelta is constant for delta snapshot kind. SnapshotKindDelta = "Incr" // SnapshotKindChunk is constant for chunk snapshot kind. SnapshotKindChunk = "Chunk" // AzureBlobStorageGlobalDomain is the default domain for azure blob storage service. AzureBlobStorageGlobalDomain = "blob.core.windows.net" // FinalSuffix is the suffix appended to the names of final snapshots. FinalSuffix = ".final" // ChunkDirSuffix is the suffix appended to the name of chunk snapshot folder when using fakegcs emulator for testing. // Refer to this github issue for more details: https://github.com/fsouza/fake-gcs-server/issues/1434 ChunkDirSuffix = ".chunk" // MinChunkSize is set to 5Mib since it is lower chunk size limit for AWS. MinChunkSize int64 = 5 * (1 << 20) //5 MiB // ExcludeSnapshotMetadataKey is the tag that is to be added on snapshots in the object store if they are not to be included in SnapStore's List output. ExcludeSnapshotMetadataKey = "x-etcd-snapshot-exclude" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApplierInfo ¶
ApplierInfo stores the info about applier
type CompactOptions ¶
type CompactOptions struct { *RestoreOptions *CompactorConfig }
CompactOptions holds all configurable options of compact.
type CompactorConfig ¶
type CompactorConfig struct { NeedDefragmentation bool `json:"needDefrag,omitempty"` SnapshotTimeout wrappers.Duration `json:"snapshotTimeout,omitempty"` DefragTimeout wrappers.Duration `json:"defragTimeout,omitempty"` FullSnapshotLeaseName string `json:"fullSnapshotLeaseName,omitempty"` DeltaSnapshotLeaseName string `json:"deltaSnapshotLeaseName,omitempty"` EnabledLeaseRenewal bool `json:"enabledLeaseRenewal"` // see https://github.com/gardener/etcd-druid/issues/648 MetricsScrapeWaitDuration wrappers.Duration `json:"metricsScrapeWaitDuration,omitempty"` }
CompactorConfig holds all configuration options related to `compact` subcommand.
func NewCompactorConfig ¶
func NewCompactorConfig() *CompactorConfig
NewCompactorConfig returns the CompactorConfig.
func (*CompactorConfig) AddFlags ¶
func (c *CompactorConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*CompactorConfig) Validate ¶
func (c *CompactorConfig) Validate() error
Validate validates the config.
type Config ¶
type Config struct { // ReelectionPeriod defines the Period after which leadership status is checked. ReelectionPeriod wrappers.Duration `json:"reelectionPeriod,omitempty"` // EtcdConnectionTimeout defines the timeout duration for etcd client connection during leader election. EtcdConnectionTimeout wrappers.Duration `json:"etcdConnectionTimeout,omitempty"` }
Config holds the LeaderElection config.
func NewLeaderElectionConfig ¶
func NewLeaderElectionConfig() *Config
NewLeaderElectionConfig returns the Config.
type EtcdConnectionConfig ¶
type EtcdConnectionConfig struct { // Endpoints are the endpoints from which the backup will be take or defragmentation will be called. // This need not be necessary match the entire etcd cluster. Endpoints []string `json:"endpoints"` ServiceEndpoints []string `json:"serviceEndpoints,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` ConnectionTimeout wrappers.Duration `json:"connectionTimeout,omitempty"` SnapshotTimeout wrappers.Duration `json:"snapshotTimeout,omitempty"` DefragTimeout wrappers.Duration `json:"defragTimeout,omitempty"` InsecureTransport bool `json:"insecureTransport,omitempty"` InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` CertFile string `json:"certFile,omitempty"` KeyFile string `json:"keyFile,omitempty"` CaFile string `json:"caFile,omitempty"` MaxCallSendMsgSize int `json:"maxCallSendMsgSize,omitempty"` }
EtcdConnectionConfig holds the etcd connection config.
func NewEtcdConnectionConfig ¶
func NewEtcdConnectionConfig() *EtcdConnectionConfig
NewEtcdConnectionConfig returns etcd connection config.
func (*EtcdConnectionConfig) AddFlags ¶
func (c *EtcdConnectionConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*EtcdConnectionConfig) Validate ¶
func (c *EtcdConnectionConfig) Validate() error
Validate validates the config.
type EtcdMemberStatusCallbackFunc ¶
type EtcdMemberStatusCallbackFunc func(context.Context, *EtcdConnectionConfig, time.Duration, *logrus.Entry) (bool, bool, error)
EtcdMemberStatusCallbackFunc is type declaration for callback function to Check Etcd member Status.
type ExponentialBackoffConfig ¶
type ExponentialBackoffConfig struct { // Multiplier defines multiplicative factor for Exponential-Backoff mechanism. Multiplier uint `json:"multiplier,omitempty"` // AttemptLimit defines the threshold no. of attempts to retry before a ThresholdTime is achieved. AttemptLimit uint `json:"attemptLimit,omitempty"` // ThresholdTime defines the upper bound time of Exponential-Backoff mechanism for retry operation. ThresholdTime wrappers.Duration `json:"thresholdTime,omitempty"` }
ExponentialBackoffConfig holds the configuration of the Exponential-Backoff mechanism.
func NewExponentialBackOffConfig ¶
func NewExponentialBackOffConfig() *ExponentialBackoffConfig
NewExponentialBackOffConfig returns new ExponentialBackoff.
func (*ExponentialBackoffConfig) AddFlags ¶
func (e *ExponentialBackoffConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*ExponentialBackoffConfig) Validate ¶
func (e *ExponentialBackoffConfig) Validate() error
Validate validates the ExponentialBackoffConfig.
type FetcherInfo ¶
FetcherInfo stores the information about fetcher
type HealthConfig ¶
type HealthConfig struct { SnapshotLeaseRenewalEnabled bool `json:"snapshotLeaseRenewalEnabled,omitempty"` MemberLeaseRenewalEnabled bool `json:"memberLeaseRenewalEnabled,omitempty"` EtcdMemberGCEnabled bool `json:"etcdMemberGCEnabled,omitempty"` HeartbeatDuration wrappers.Duration `json:"heartbeatDuration,omitempty"` MemberGCDuration wrappers.Duration `json:"memberGCDuration,omitempty"` FullSnapshotLeaseName string `json:"fullSnapshotLeaseName,omitempty"` DeltaSnapshotLeaseName string `json:"deltaSnapshotLeaseName,omitempty"` }
HealthConfig holds the health configuration.
func NewHealthConfig ¶
func NewHealthConfig() *HealthConfig
NewHealthConfig returns the health config.
func (*HealthConfig) AddFlags ¶
func (c *HealthConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*HealthConfig) Validate ¶
func (c *HealthConfig) Validate() error
Validate validates the health Config.
type InitIndex ¶
type InitIndex int
InitIndex stores the index
func (*InitIndex) ConsistentIndex ¶
ConsistentIndex gets the index
type LeaderCallbacks ¶
type LeaderCallbacks struct { // OnStartedLeading is called when a LeaderElector client starts leading. OnStartedLeading func(context.Context) // OnStoppedLeading is called when a LeaderElector client stops leading. OnStoppedLeading func() }
LeaderCallbacks are callbacks that are triggered to start/stop the snapshottter when leader's currentState changes.
type MemberLeaseCallbacks ¶
type MemberLeaseCallbacks struct { // StartLeaseRenewal is called when etcd member moved from StateUnknown to either StateLeader or StateFollower. StartLeaseRenewal func() // OnStoppedLeading is called when etcd member moved to StateUnknown from any other State. StopLeaseRenewal func() }
MemberLeaseCallbacks are callbacks that are triggered to start/stop periodic member lease renewel.
type NewClientFactoryFunc ¶
type NewClientFactoryFunc func(cfg EtcdConnectionConfig, opts ...client.Option) client.Factory
NewClientFactoryFunc allows to define how to create a client.Factory
func DeepCopyNewClientFactory ¶
func DeepCopyNewClientFactory(in NewClientFactoryFunc) NewClientFactoryFunc
DeepCopyNewClientFactory returns a deep copy
type PromoteLearnerCallback ¶
PromoteLearnerCallback is callback which is triggered when backup-restore wants to promote etcd learner to a voting member.
type RestorationConfig ¶
type RestorationConfig struct { InitialCluster string `json:"initialCluster"` InitialClusterToken string `json:"initialClusterToken,omitempty"` DataDir string `json:"dataDir,omitempty"` TempSnapshotsDir string `json:"tempDir,omitempty"` InitialAdvertisePeerURLs []string `json:"initialAdvertisePeerURLs"` Name string `json:"name"` SkipHashCheck bool `json:"skipHashCheck,omitempty"` MaxFetchers uint `json:"maxFetchers,omitempty"` MaxRequestBytes uint `json:"MaxRequestBytes,omitempty"` MaxTxnOps uint `json:"MaxTxnOps,omitempty"` MaxCallSendMsgSize int `json:"maxCallSendMsgSize,omitempty"` EmbeddedEtcdQuotaBytes int64 `json:"embeddedEtcdQuotaBytes,omitempty"` AutoCompactionMode string `json:"autoCompactionMode,omitempty"` AutoCompactionRetention string `json:"autoCompactionRetention,omitempty"` }
RestorationConfig holds the restoration configuration. Note: Please ensure DeepCopy and DeepCopyInto are properly implemented.
func NewRestorationConfig ¶
func NewRestorationConfig() *RestorationConfig
NewRestorationConfig returns the restoration config.
func (*RestorationConfig) AddFlags ¶
func (c *RestorationConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*RestorationConfig) DeepCopy ¶
func (c *RestorationConfig) DeepCopy() *RestorationConfig
DeepCopy returns a deeply copied structure.
func (*RestorationConfig) DeepCopyInto ¶
func (c *RestorationConfig) DeepCopyInto(out *RestorationConfig)
DeepCopyInto copies the structure deeply from in to out.
func (*RestorationConfig) Validate ¶
func (c *RestorationConfig) Validate() error
Validate validates the config.
type RestoreOptions ¶
type RestoreOptions struct { Config *RestorationConfig ClusterURLs types.URLsMap // OriginalClusterSize indicates the actual cluster size from the ETCD config OriginalClusterSize int PeerURLs types.URLs // Base full snapshot + delta snapshots to restore from BaseSnapshot *Snapshot DeltaSnapList SnapList NewClientFactory NewClientFactoryFunc }
RestoreOptions hold all snapshot restore related fields Note: Please ensure DeepCopy and DeepCopyInto are properly implemented.
func (*RestoreOptions) DeepCopy ¶
func (in *RestoreOptions) DeepCopy() *RestoreOptions
DeepCopy returns a deeply copied structure.
func (*RestoreOptions) DeepCopyInto ¶
func (in *RestoreOptions) DeepCopyInto(out *RestoreOptions)
DeepCopyInto copies the structure deeply from in to out.
type SnapList ¶
type SnapList []*Snapshot
SnapList is list of snapshots.
func DeepCopySnapList ¶
DeepCopySnapList returns a deep copy
type SnapStore ¶
type SnapStore interface { // Fetch should open reader for the snapshot file from store. Fetch(Snapshot) (io.ReadCloser, error) // List returns a sorted list (based on the last revision, ascending) of all snapshots in the store. // includeAll specifies whether to include all snapshots while listing, including those with exclude tags. // Snapshots with exclude tags are not listed unless includeAll is set to true. List(includeAll bool) (SnapList, error) // Save will write the snapshot to store. Save(Snapshot, io.ReadCloser) error // Delete should delete the snapshot file from store. Delete(Snapshot) error }
SnapStore is the interface to be implemented for different storage backend like local file system, S3, ABS, GCS, Swift, OSS, ECS etc. Only purpose of these implementation to provide CPI layer to access files.
type Snapshot ¶
type Snapshot struct { Kind string `json:"kind"` // incr:incremental, full:full StartRevision int64 `json:"startRevision"` LastRevision int64 `json:"lastRevision"` // latest revision on snapshot CreatedOn time.Time `json:"createdOn"` SnapDir string `json:"snapDir"` SnapName string `json:"snapName"` IsChunk bool `json:"isChunk"` Prefix string `json:"prefix"` // Points to correct prefix of a snapshot in snapstore (Required for Backward Compatibility) CompressionSuffix string `json:"compressionSuffix"` // CompressionSuffix depends on compression policy IsFinal bool `json:"isFinal"` ImmutabilityExpiryTime time.Time `json:"immutabilityExpriyTime"` }
Snapshot structure represents the metadata of snapshot.
func (*Snapshot) GenerateSnapshotDirectory ¶
func (s *Snapshot) GenerateSnapshotDirectory()
GenerateSnapshotDirectory prepares the snapshot directory name from metadata
func (*Snapshot) GenerateSnapshotName ¶
func (s *Snapshot) GenerateSnapshotName()
GenerateSnapshotName prepares the snapshot name from metadata
func (*Snapshot) GetSnapshotDirectoryCreationTimeInUnix ¶
GetSnapshotDirectoryCreationTimeInUnix returns the creation time for snapshot directory.
func (*Snapshot) IsDeletable ¶ added in v0.31.0
IsDeletable determines if the snapshot can be deleted. It checks if the immutability expiry time is set and whether the current time is after the immutability expiry time.
type SnapshotterConfig ¶
type SnapshotterConfig struct { FullSnapshotSchedule string `json:"schedule,omitempty"` DeltaSnapshotPeriod wrappers.Duration `json:"deltaSnapshotPeriod,omitempty"` DeltaSnapshotMemoryLimit uint `json:"deltaSnapshotMemoryLimit,omitempty"` GarbageCollectionPeriod wrappers.Duration `json:"garbageCollectionPeriod,omitempty"` GarbageCollectionPolicy string `json:"garbageCollectionPolicy,omitempty"` MaxBackups uint `json:"maxBackups,omitempty"` DeltaSnapshotRetentionPeriod wrappers.Duration `json:"deltaSnapshotRetentionPeriod,omitempty"` }
SnapshotterConfig holds the snapshotter config.
func (*SnapshotterConfig) AddFlags ¶
func (c *SnapshotterConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*SnapshotterConfig) Validate ¶
func (c *SnapshotterConfig) Validate() error
Validate validates the config.
type SnapshotterState ¶
type SnapshotterState int
SnapshotterState denotes the state the snapshotter would be in.
type SnapstoreConfig ¶
type SnapstoreConfig struct { // Provider indicated the cloud provider. Provider string `json:"provider,omitempty"` // Container holds the name of bucket or container to which snapshot will be stored. Container string `json:"container"` // Prefix holds the prefix or directory under StorageContainer under which snapshot will be stored. Prefix string `json:"prefix,omitempty"` // MaxParallelChunkUploads holds the maximum number of parallel chunk uploads allowed. MaxParallelChunkUploads uint `json:"maxParallelChunkUploads,omitempty"` // MinChunkSize holds the minimum size for a multi-part chunk upload. MinChunkSize int64 `json:"minChunkSize,omitempty"` // Temporary Directory TempDir string `json:"tempDir,omitempty"` // IsSource determines if this SnapStore is the source for a copy operation IsSource bool `json:"isSource,omitempty"` }
SnapstoreConfig defines the configuration to create snapshot store.
func (*SnapstoreConfig) AddFlags ¶
func (c *SnapstoreConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*SnapstoreConfig) AddSourceFlags ¶
func (c *SnapstoreConfig) AddSourceFlags(fs *flag.FlagSet)
AddSourceFlags adds the flags to flagset using `source-` prefix for all parameters.
func (*SnapstoreConfig) Complete ¶
func (c *SnapstoreConfig) Complete()
Complete completes the config.
func (*SnapstoreConfig) MergeWith ¶
func (c *SnapstoreConfig) MergeWith(other *SnapstoreConfig)
MergeWith completes the config based on other config
func (*SnapstoreConfig) Validate ¶
func (c *SnapstoreConfig) Validate() error
Validate validates the config.