package etcd
import "k8s.io/kubernetes/cmd/kubeadm/app/util/etcd"
Index ¶
- func CheckConfigurationIsHA(cfg *kubeadmapi.Etcd) bool
- func GetClientURL(localEndpoint *kubeadmapi.APIEndpoint) string
- func GetClientURLByIP(ip string) string
- func GetPeerURL(localEndpoint *kubeadmapi.APIEndpoint) string
- func IsEtcdListeningOnLocalHostOnly() bool
- type Client
- func New(endpoints []string, ca, cert, key string) (*Client, error)
- func NewFromCluster(client clientset.Interface, certificatesDir string) (*Client, error)
- func (c *Client) AddMember(name string, peerAddrs string) ([]Member, error)
- func (c *Client) ClusterAvailable() (bool, error)
- func (c *Client) GetClusterStatus() (map[string]*clientv3.StatusResponse, error)
- func (c *Client) GetClusterVersions() (map[string]string, error)
- func (c *Client) GetMemberID(peerURL string) (uint64, error)
- func (c *Client) GetVersion() (string, error)
- func (c *Client) RemoveMember(id uint64) ([]Member, error)
- func (c *Client) Sync() error
- func (c *Client) WaitForClusterAvailable(retries int, retryInterval time.Duration) (bool, error)
- type ClusterInterrogator
- type Member
Functions ¶
func CheckConfigurationIsHA ¶
func CheckConfigurationIsHA(cfg *kubeadmapi.Etcd) bool
CheckConfigurationIsHA returns true if the given InitConfiguration etcd block appears to be an HA configuration.
func GetClientURL ¶
func GetClientURL(localEndpoint *kubeadmapi.APIEndpoint) string
GetClientURL creates an HTTPS URL that uses the configured advertise address and client port for the API controller
func GetClientURLByIP ¶
GetClientURLByIP creates an HTTPS URL based on an IP address and the client listening port.
func GetPeerURL ¶
func GetPeerURL(localEndpoint *kubeadmapi.APIEndpoint) string
GetPeerURL creates an HTTPS URL that uses the configured advertise address and peer port for the API controller
func IsEtcdListeningOnLocalHostOnly ¶
func IsEtcdListeningOnLocalHostOnly() bool
IsEtcdListeningOnLocalHostOnly return true if the etcd manifest have etcd listening on localhost only. Listening on local host only was the default in kubeadm <= v1.12, while starting from v1.13 etcd is listening on localhost and API server advertise address (thus allowing add new member when doing join --control-plane). N.B. this code is necessary only in v1.14; starting from v1.15 all the etcd manifest should have 2 endpoints
Types ¶
type Client ¶
Client provides connection parameters for an etcd cluster
func New ¶
New creates a new EtcdCluster client
func NewFromCluster ¶
NewFromCluster creates an etcd client for the etcd endpoints defined in the ClusterStatus value stored in the kubeadm-config ConfigMap in kube-system namespace. Once created, the client synchronizes client's endpoints with the known endpoints from the etcd membership API (reality check).
func (*Client) AddMember ¶
AddMember notifies an existing etcd cluster that a new member is joining
func (*Client) ClusterAvailable ¶
ClusterAvailable returns true if the cluster status indicates the cluster is available.
func (*Client) GetClusterStatus ¶
func (c *Client) GetClusterStatus() (map[string]*clientv3.StatusResponse, error)
GetClusterStatus returns nil for status Up or error for status Down
func (*Client) GetClusterVersions ¶
GetClusterVersions returns a map of the endpoints and their associated versions
func (*Client) GetMemberID ¶
GetMemberID returns the member ID of the given peer URL
func (*Client) GetVersion ¶
GetVersion returns the etcd version of the cluster. An error is returned if the version of all endpoints do not match
func (*Client) RemoveMember ¶
RemoveMember notifies an etcd cluster to remove an existing member
func (*Client) Sync ¶
Sync synchronizes client's endpoints with the known endpoints from the etcd membership.
func (*Client) WaitForClusterAvailable ¶
WaitForClusterAvailable returns true if all endpoints in the cluster are available after retry attempts, an error is returned otherwise
type ClusterInterrogator ¶
type ClusterInterrogator interface { ClusterAvailable() (bool, error) GetClusterStatus() (map[string]*clientv3.StatusResponse, error) GetClusterVersions() (map[string]string, error) GetVersion() (string, error) WaitForClusterAvailable(retries int, retryInterval time.Duration) (bool, error) Sync() error AddMember(name string, peerAddrs string) ([]Member, error) GetMemberID(peerURL string) (uint64, error) RemoveMember(id uint64) ([]Member, error) }
ClusterInterrogator is an interface to get etcd cluster related information
type Member ¶
Member struct defines an etcd member; it is used for avoiding to spread github.com/coreos/etcd dependency across kubeadm codebase
Source Files ¶
etcd.go
- Version
- v1.14.5
- Published
- Aug 1, 2019
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 1 hour ago –
Tools for package owners.