const etcdTimeout … var ErrNoMemberIDForPeerURL … type ClusterInterrogator … type etcdClient … type Client … // New creates a new EtcdCluster client func New(endpoints []string, ca, cert, key string) (*Client, error) { … } // NewFromCluster creates an etcd client for the etcd endpoints present in etcd member list. In order to compose this information, // it will first discover at least one etcd endpoint to connect to. Once created, the client synchronizes client's endpoints with // the known endpoints from the etcd membership API, since it is the authoritative source of truth for the list of available members. func NewFromCluster(client clientset.Interface, certificatesDir string) (*Client, error) { … } // getEtcdEndpoints returns the list of etcd endpoints. func getEtcdEndpoints(client clientset.Interface) ([]string, error) { … } func getEtcdEndpointsWithRetry(client clientset.Interface, interval, timeout time.Duration) ([]string, error) { … } // getRawEtcdEndpointsFromPodAnnotation returns the list of endpoints as reported on etcd's pod annotations using the given backoff func getRawEtcdEndpointsFromPodAnnotation(client clientset.Interface, interval, timeout time.Duration) ([]string, error) { … } // getRawEtcdEndpointsFromPodAnnotationWithoutRetry returns the list of etcd endpoints as reported by etcd Pod annotations, // along with the number of global etcd pods. This allows for callers to tell the difference between "no endpoints found", // and "no endpoints found and pods were listed", so they can skip retrying. func getRawEtcdEndpointsFromPodAnnotationWithoutRetry(client clientset.Interface) ([]string, int, error) { … } // Sync synchronizes client's endpoints with the known endpoints from the etcd membership. func (c *Client) Sync() error { … } type Member … func (c *Client) listMembers(timeout time.Duration) (*clientv3.MemberListResponse, error) { … } // GetMemberID returns the member ID of the given peer URL func (c *Client) GetMemberID(peerURL string) (uint64, error) { … } // ListMembers returns the member list. func (c *Client) ListMembers() ([]Member, error) { … } // RemoveMember notifies an etcd cluster to remove an existing member func (c *Client) RemoveMember(id uint64) ([]Member, error) { … } // AddMember adds a new member into the etcd cluster func (c *Client) AddMember(name string, peerAddrs string) ([]Member, error) { … } // AddMemberAsLearner adds a new learner member into the etcd cluster. func (c *Client) AddMemberAsLearner(name string, peerAddrs string) ([]Member, error) { … } // addMember notifies an existing etcd cluster that a new member is joining, and // return the updated list of members. If the member has already been added to the // cluster, this will return the existing list of etcd members. func (c *Client) addMember(name string, peerAddrs string, isLearner bool) ([]Member, error) { … } // isLearner returns true if the given member ID is a learner. func (c *Client) isLearner(memberID uint64) (bool, error) { … } // MemberPromote promotes a member as a voting member. If the given member ID is already a voting member this method // will return early and do nothing. func (c *Client) MemberPromote(learnerID uint64) error { … } // CheckClusterHealth returns nil for status Up or error for status Down func (c *Client) CheckClusterHealth() error { … } // getClusterStatus returns nil for status Up (along with endpoint status response map) or error for status Down func (c *Client) getClusterStatus() (map[string]*clientv3.StatusResponse, error) { … } // WaitForClusterAvailable returns true if all endpoints in the cluster are available after retry attempts, an error is returned otherwise func (c *Client) WaitForClusterAvailable(retries int, retryInterval time.Duration) (bool, error) { … } // GetClientURL creates an HTTPS URL that uses the configured advertise // address and client port for the API controller func GetClientURL(localEndpoint *kubeadmapi.APIEndpoint) string { … } // GetPeerURL creates an HTTPS URL that uses the configured advertise // address and peer port for the API controller func GetPeerURL(localEndpoint *kubeadmapi.APIEndpoint) string { … } // GetClientURLByIP creates an HTTPS URL based on an IP address // and the client listening port. func GetClientURLByIP(ip string) string { … }