etcd

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2021 k0s authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEtcdReady

func CheckEtcdReady(ctx context.Context, certDir string, etcdCertDir string) error

CheckEtcdReady returns true if etcd responds to the metrics endpoint with a status code of 200

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is our internal helper to access some of the etcd APIs

func NewClient

func NewClient(certDir string, etcdCertDir string) (*Client, error)

NewClient creates new Client

func (*Client) AddMember

func (c *Client) AddMember(ctx context.Context, name, peerAddress string) ([]string, error)

AddMember add new member to etcd cluster

func (*Client) Close

func (c *Client) Close()

Close closes the etcd client

func (*Client) DeleteMember

func (c *Client) DeleteMember(ctx context.Context, peerID uint64) error

DeleteMember deletes member by peer name

func (*Client) GetPeerIDByAddress

func (c *Client) GetPeerIDByAddress(ctx context.Context, peerAddress string) (uint64, error)

GetPeerIDByAddress looks up peer id by peer url

func (*Client) Health added in v0.12.0

func (c *Client) Health(ctx context.Context) error

Health return err if the etcd peer is not reported as healthy ref: https://github.com/etcd-io/etcd/blob/3ead91ca3edf66112d56c453169343515bba71c3/etcdctl/ctlv3/command/ep_command.go#L89

func (*Client) ListMembers

func (c *Client) ListMembers(ctx context.Context) (map[string]string, error)

ListMembers gets a list of current etcd members

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL