consul

package
v0.0.0-...-534e0d3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(config *capi.Config, consulAPITimeout time.Duration) (*capi.Client, error)

NewClient returns a V1 Consul API client. It adds a required User-Agent header that describes the version of consul-k8s making the call.

func NewClientFromConnMgr

func NewClientFromConnMgr(config *Config, watcher ServerConnectionManager) (*capi.Client, error)

NewClientFromConnMgr creates a new V1 API client by first getting the state of the passed watcher.

func NewClientFromConnMgrState

func NewClientFromConnMgrState(config *Config, state discovery.State) (*capi.Client, error)

todo (ishustava): replace all usages of this one. NewClientFromConnMgrState creates a new V1 API client with an IP address from the state of the consul-server-connection-manager.

func NewDataplaneServiceClient

func NewDataplaneServiceClient(watcher ServerConnectionManager) (pbdataplane.DataplaneServiceClient, error)

NewDataplaneServiceClient creates a pbdataplane.DataplaneServiceClient for gathering proxy bootstrap config. It is initialized with a consul-server-connection-manager Watcher to continuously find Consul server addresses.

func NewResourceServiceClient

func NewResourceServiceClient(watcher ServerConnectionManager) (pbresource.ResourceServiceClient, error)

NewResourceServiceClient creates a pbresource.ResourceServiceClient for creating V2 Consul resources. It is initialized with a consul-server-connection-manager Watcher to continuously find Consul server addresses.

Types

type Config

type Config struct {
	APIClientConfig *capi.Config
	HTTPPort        int
	GRPCPort        int
	APITimeout      time.Duration
}

type DynamicClient

type DynamicClient struct {
	ConsulClient *capi.Client
	Config       *Config
	// contains filtered or unexported fields
}

func NewDynamicClient

func NewDynamicClient(config *capi.Config) (*DynamicClient, error)

func NewDynamicClientFromConnMgr

func NewDynamicClientFromConnMgr(config *Config, watcher ServerConnectionManager) (*DynamicClient, error)

func NewDynamicClientWithTimeout

func NewDynamicClientWithTimeout(config *capi.Config, consulAPITimeout time.Duration) (*DynamicClient, error)

func (*DynamicClient) RefreshClient

func (d *DynamicClient) RefreshClient() error

type MockServerConnectionManager

type MockServerConnectionManager struct {
	mock.Mock
}

MockServerConnectionManager is an autogenerated mock type for the ServerConnectionManager type

func NewMockServerConnectionManager

func NewMockServerConnectionManager(t mockConstructorTestingTNewMockServerConnectionManager) *MockServerConnectionManager

NewMockServerConnectionManager creates a new instance of MockServerConnectionManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockServerConnectionManager) Run

func (_m *MockServerConnectionManager) Run()

Run provides a mock function with given fields:

func (*MockServerConnectionManager) State

State provides a mock function with given fields:

func (*MockServerConnectionManager) Stop

func (_m *MockServerConnectionManager) Stop()

Stop provides a mock function with given fields:

type ServerConnectionManager

type ServerConnectionManager interface {
	State() (discovery.State, error)
	Run()
	Stop()
}

Jump to

Keyboard shortcuts

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