Documentation
¶
Index ¶
- Constants
- Variables
- func DBDir(config *config.Control) string
- func GetAPIServerURLFromETCD(ctx context.Context, cfg *config.Control) (string, error)
- func GetAdvertiseAddress(advertiseIP string) (string, error)
- func GetClient(ctx context.Context, runtime *config.ControlRuntime, endpoints ...string) (*etcd.Client, error)
- func RegisterMemberHandlers(ctx context.Context, etcd *ETCD, nodes controllerv1.NodeController)
- func RegisterMetadataHandlers(ctx context.Context, etcd *ETCD, nodes controllerv1.NodeController)
- func ResetFile(config *config.Control) string
- type ETCD
- func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error
- func (e *ETCD) EndpointName() string
- func (e *ETCD) GetMembersClientURLs(ctx context.Context) ([]string, error)
- func (e *ETCD) GetMembersNames(ctx context.Context) ([]string, error)
- func (e *ETCD) IsInitialized(ctx context.Context, config *config.Control) (bool, error)
- func (e *ETCD) ListSnapshots(ctx context.Context) (map[string]snapshotFile, error)
- func (e *ETCD) PruneSnapshots(ctx context.Context) error
- func (e *ETCD) ReconcileSnapshotData(ctx context.Context) error
- func (e *ETCD) Register(ctx context.Context, config *config.Control, 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) Restore(ctx context.Context) error
- func (e *ETCD) SetControlConfig(config *config.Control)
- func (e *ETCD) Snapshot(ctx context.Context, config *config.Control) error
- func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) error
- func (e *ETCD) Test(ctx context.Context) error
- type Members
- type NodeControllerGetter
- type Proxy
- type S3
Constants ¶
const ( MasterLabel = "node-role.kubernetes.io/master" ControlPlaneLabel = "node-role.kubernetes.io/control-plane" EtcdRoleLabel = "node-role.kubernetes.io/etcd" )
Variables ¶
Functions ¶
func GetAPIServerURLFromETCD ¶
GetAPIServerURLFromETCD will try to fetch the version.Program/apiaddresses key from etcd when it succeed it will parse the first address in the list and return back an address
func GetAdvertiseAddress ¶
getAdvertiseAddress returns the IP address best suited for advertising to clients
func GetClient ¶
func GetClient(ctx context.Context, runtime *config.ControlRuntime, endpoints ...string) (*etcd.Client, error)
getClient returns an etcd client connected to the specified endpoints
func RegisterMemberHandlers ¶
func RegisterMemberHandlers(ctx context.Context, etcd *ETCD, nodes controllerv1.NodeController)
func RegisterMetadataHandlers ¶
func RegisterMetadataHandlers(ctx context.Context, etcd *ETCD, nodes controllerv1.NodeController)
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 an initialized cron value.
func (*ETCD) DeleteSnapshots ¶
deleteSnapshots removes the given snapshots from either local storage or S3.
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) GetMembersNames ¶
GetMembersNames will list through the member lists in etcd and return back a combined list of member names
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) ListSnapshots ¶
ListSnapshots is an exported wrapper method that wraps an unexported method of the same name.
func (*ETCD) PruneSnapshots ¶
PruneSnapshots performs a retention run with the given retention duration and removes expired snapshots.
func (*ETCD) ReconcileSnapshotData ¶
ReconcileSnapshotData reconciles snapshot data in the snapshot ConfigMap. 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. Notably,
func (*ETCD) Register ¶
func (e *ETCD) Register(ctx context.Context, config *config.Control, handler http.Handler) (http.Handler, error)
Register configures a new etcd client and adds db info routes for the http request handler.
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
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 sets the given config on the etcd struct.
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. This method is used in the internal cron snapshot system as well as used to do on-demand snapshots.
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
type NodeControllerGetter ¶
type NodeControllerGetter func() controllerv1.NodeController