Documentation
¶
Index ¶
- Variables
- func GetAPIServerURLsFromETCD(ctx context.Context, cfg *config.Control) ([]string, error)
- type ETCD
- func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) (*managed.SnapshotResult, error)
- func (e *ETCD) EndpointName() string
- func (e *ETCD) GetMembersClientURLs(ctx context.Context) ([]string, error)
- func (e *ETCD) IsInitialized() (bool, error)
- func (e *ETCD) IsReset() (bool, error)
- func (e *ETCD) ListSnapshots(ctx context.Context) (*k8e.ETCDSnapshotFileList, error)
- func (e *ETCD) PruneSnapshots(ctx context.Context) (*managed.SnapshotResult, error)
- func (e *ETCD) ReconcileSnapshotData(ctx context.Context) error
- func (e *ETCD) Register(handler http.Handler) (http.Handler, error)
- func (e *ETCD) RemovePeer(ctx context.Context, name, address string, allowSelfRemoval bool) error
- func (e *ETCD) RemoveSelf(ctx context.Context) error
- func (e *ETCD) Reset(ctx context.Context, rebootstrap func() error) error
- func (e *ETCD) ResetFile() string
- func (e *ETCD) Restore(ctx context.Context) error
- func (e *ETCD) SetControlConfig(config *config.Control) error
- func (e *ETCD) Snapshot(ctx context.Context) (*managed.SnapshotResult, error)
- func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) error
- func (e *ETCD) StartEmbeddedTemporary(ctx context.Context) error
- func (e *ETCD) Test(ctx context.Context) error
- type EtcdSimpleResolver
- type MemberStatus
- type Members
- type NodeControllerGetter
- type Proxy
- type SnapshotOperation
- type SnapshotRequest
Constants ¶
This section is empty.
Variables ¶
var ( // AddressKey will contain the value of api addresses list AddressKey = version.Program + "/apiaddresses" NodeNameAnnotation = "etcd." + version.Program + ".cattle.io/node-name" NodeAddressAnnotation = "etcd." + version.Program + ".cattle.io/node-address" ErrAddressNotSet = errors.New("apiserver addresses not yet set") ErrNotMember = errNotMember() ErrMemberListFailed = errMemberListFailed() )
Functions ¶
Types ¶
type ETCD ¶
type ETCD struct {
// contains filtered or unexported fields
}
func NewETCD ¶
func NewETCD() *ETCD
NewETCD creates a new value of type ETCD with initialized cron and snapshot mutex values.
func (*ETCD) DeleteSnapshots ¶
func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) (*managed.SnapshotResult, error)
DeleteSnapshots removes the given snapshots from local storage and S3. Returns a list of deleted snapshots. Note that snapshots may be deleted with a non-nil error return.
func (*ETCD) EndpointName ¶
EndpointName returns the name of the endpoint.
func (*ETCD) GetMembersClientURLs ¶
GetMembersClientURLs will list through the member lists in etcd and return back a combined list of client urls for each member in the cluster
func (*ETCD) IsInitialized ¶
IsInitialized checks to see if a WAL directory exists. If so, we assume that etcd has already been brought up at least once.
func (*ETCD) IsReset ¶
IsReset checks to see if the reset file exists, indicating that a cluster-reset has been completed successfully.
func (*ETCD) ListSnapshots ¶
ListSnapshots returns a list of snapshots. Local snapshots are always listed, s3 snapshots are listed if s3 is enabled. Snapshots are listed locally, not listed from the apiserver, so results are guaranteed to be in sync with what is on disk.
func (*ETCD) PruneSnapshots ¶
PruneSnapshots deleted old snapshots in excess of the configured retention count. Returns a list of deleted snapshots. Note that snapshots may be deleted with a non-nil error return.
func (*ETCD) ReconcileSnapshotData ¶
ReconcileSnapshotData reconciles snapshot data in the ETCDSnapshotFile resources. It will reconcile snapshot data from disk locally always, and if S3 is enabled, will attempt to list S3 snapshots and reconcile snapshots from S3.
func (*ETCD) Register ¶
Register adds db info routes for the http request handler, and registers cluster controller callbacks
func (*ETCD) RemovePeer ¶
RemovePeer removes a peer from the cluster. The peer name and IP address must both match.
func (*ETCD) RemoveSelf ¶
RemoveSelf will remove the member if it exists in the cluster. This should only be called on a node that may have previously run etcd, but will not currently run etcd, to ensure that it is not a member of the cluster. This is also called by tests to do cleanup between runs.
func (*ETCD) Restore ¶
Restore performs a restore of the ETCD datastore from the given snapshot path. This operation exists upon completion.
func (*ETCD) SetControlConfig ¶
SetControlConfig passes the cluster config into the etcd datastore. This is necessary because the config may not yet be fully built at the time the Driver instance is registered.
func (*ETCD) Snapshot ¶
Snapshot attempts to save a new snapshot to the configured directory, and then clean up any old and failed snapshots in excess of the retention limits. Note that one snapshot request may result in creation and pruning of multiple snapshots, if S3 is enabled. Note that the prune step is generally disabled when snapshotting from the CLI, as there is a separate subcommand for prune that can be run manually if the user wants to remove old snapshots. Returns metadata about the new and pruned snapshots.
func (*ETCD) StartEmbeddedTemporary ¶
func (*ETCD) Test ¶
Test ensures that the local node is a voting member of the target cluster, and that the datastore is defragmented and not in maintenance mode due to alarms. If it is still a learner or not a part of the cluster, an error is raised. If it cannot be defragmented or has any alarms that cannot be disarmed, an error is raised.
type EtcdSimpleResolver ¶
func NewSimpleResolver ¶
func NewSimpleResolver(endpoint string) *EtcdSimpleResolver
Cribbed from https://github.com/etcd-io/etcd/blob/v3.5.16/client/v3/internal/resolver/resolver.go but only supports a single fixed endpoint. We use this instead of the internal etcd client resolver because the agent loadbalancer handles failover and we don't want etcd or grpc's special behavior.
func (*EtcdSimpleResolver) Build ¶
func (r *EtcdSimpleResolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error)
type MemberStatus ¶
type MemberStatus string
const ( StatusUnjoined MemberStatus = "unjoined" StatusUnhealthy MemberStatus = "unhealthy" StatusLearner MemberStatus = "learner" StatusVoter MemberStatus = "voter" )
type Members ¶
type Members struct {
Members []*etcdserverpb.Member `json:"members"`
}
Members contains a slice that holds all members of the cluster.
func ClientURLs ¶
func ClientURLs(ctx context.Context, clientAccessInfo *clientaccess.Info, selfIP string) ([]string, Members, error)
clientURLs returns a list of all non-learner etcd cluster member client access URLs. The list is retrieved from the remote server that is being joined.
type NodeControllerGetter ¶
type NodeControllerGetter func() controllerv1.NodeController
type Proxy ¶
type SnapshotOperation ¶
type SnapshotOperation string
const ( SnapshotOperationSave SnapshotOperation = "save" SnapshotOperationList SnapshotOperation = "list" SnapshotOperationPrune SnapshotOperation = "prune" SnapshotOperationDelete SnapshotOperation = "delete" )
type SnapshotRequest ¶
type SnapshotRequest struct { Operation SnapshotOperation `json:"operation"` Name []string `json:"name,omitempty"` Dir *string `json:"dir,omitempty"` Compress *bool `json:"compress,omitempty"` Retention *int `json:"retention,omitempty"` S3 *config.EtcdS3 `json:"s3,omitempty"` // contains filtered or unexported fields }