Documentation
¶
Index ¶
- Constants
- func NewReplicationSetDocker(t *testing.T, opts *DockerClusterOptions) (*testcluster.ReplicationSet, error)
- type CertificateGetter
- type DockerCluster
- func (dc *DockerCluster) AddNode(ctx context.Context, opts *DockerClusterOptions) error
- func (dc *DockerCluster) Cleanup()
- func (dc *DockerCluster) ClusterID() string
- func (dc *DockerCluster) GetActiveClusterNode() *DockerClusterNode
- func (dc *DockerCluster) GetBarrierKeys() [][]byte
- func (dc *DockerCluster) GetBarrierOrRecoveryKeys() [][]byte
- func (dc *DockerCluster) GetCACertPEMFile() string
- func (dc *DockerCluster) GetRecoveryKeys() [][]byte
- func (dc *DockerCluster) GetRootToken() string
- func (dc *DockerCluster) NamedLogger(s string) log.Logger
- func (dc *DockerCluster) Nodes() []testcluster.VaultClusterNode
- func (dc *DockerCluster) SetBarrierKeys(keys [][]byte)
- func (dc *DockerCluster) SetRecoveryKeys(keys [][]byte)
- func (dc *DockerCluster) SetRootToken(s string)
- type DockerClusterNode
- func (n *DockerClusterNode) APIClient() *api.Client
- func (n *DockerClusterNode) APIClientN(listenerNumber int) (*api.Client, error)
- func (n *DockerClusterNode) AddNetworkDelay(ctx context.Context, delay time.Duration, targetIP string) error
- func (n *DockerClusterNode) Cleanup()
- func (n *DockerClusterNode) Name() string
- func (n *DockerClusterNode) PartitionFromCluster(ctx context.Context) error
- func (n *DockerClusterNode) Pause(ctx context.Context) error
- func (n *DockerClusterNode) Restart(ctx context.Context) error
- func (n *DockerClusterNode) Start(ctx context.Context, opts *DockerClusterOptions) error
- func (n *DockerClusterNode) Stop()
- func (n *DockerClusterNode) TLSConfig() *tls.Config
- func (n *DockerClusterNode) UnpartitionFromCluster(ctx context.Context) error
- type DockerClusterOptions
- type LogConsumerWriter
- type ReloadFunc
Constants ¶
const DefaultNumCores = 3
const MaxClusterNameLength = 52
Variables ¶
This section is empty.
Functions ¶
func NewReplicationSetDocker ¶
func NewReplicationSetDocker(t *testing.T, opts *DockerClusterOptions) (*testcluster.ReplicationSet, error)
Types ¶
type CertificateGetter ¶
CertificateGetter satisfies ReloadFunc and its GetCertificate method satisfies the tls.GetCertificate function signature. Currently it does not allow changing paths after the fact.
func NewCertificateGetter ¶
func NewCertificateGetter(certFile, keyFile, passphrase string) *CertificateGetter
func (*CertificateGetter) GetCertificate ¶
func (cg *CertificateGetter) GetCertificate(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error)
func (*CertificateGetter) Reload ¶
func (cg *CertificateGetter) Reload() error
type DockerCluster ¶
type DockerCluster struct {
ClusterName string
ClusterNodes []*DockerClusterNode
// Certificate fields
*testcluster.CA
RootCAs *x509.CertPool
DockerAPI *docker.Client
ID string
Logger log.Logger
// contains filtered or unexported fields
}
DockerCluster is used to managing the lifecycle of the test Vault cluster
func NewDockerCluster ¶
func NewDockerCluster(ctx context.Context, opts *DockerClusterOptions) (*DockerCluster, error)
func NewTestDockerCluster ¶
func NewTestDockerCluster(t *testing.T, opts *DockerClusterOptions) *DockerCluster
func (*DockerCluster) AddNode ¶
func (dc *DockerCluster) AddNode(ctx context.Context, opts *DockerClusterOptions) error
func (*DockerCluster) Cleanup ¶
func (dc *DockerCluster) Cleanup()
func (*DockerCluster) ClusterID ¶
func (dc *DockerCluster) ClusterID() string
func (*DockerCluster) GetActiveClusterNode ¶ added in v0.11.0
func (dc *DockerCluster) GetActiveClusterNode() *DockerClusterNode
func (*DockerCluster) GetBarrierKeys ¶
func (dc *DockerCluster) GetBarrierKeys() [][]byte
func (*DockerCluster) GetBarrierOrRecoveryKeys ¶
func (dc *DockerCluster) GetBarrierOrRecoveryKeys() [][]byte
func (*DockerCluster) GetCACertPEMFile ¶
func (dc *DockerCluster) GetCACertPEMFile() string
func (*DockerCluster) GetRecoveryKeys ¶
func (dc *DockerCluster) GetRecoveryKeys() [][]byte
func (*DockerCluster) GetRootToken ¶
func (dc *DockerCluster) GetRootToken() string
GetRootToken returns the root token of the cluster, if set
func (*DockerCluster) NamedLogger ¶
func (dc *DockerCluster) NamedLogger(s string) log.Logger
func (*DockerCluster) Nodes ¶
func (dc *DockerCluster) Nodes() []testcluster.VaultClusterNode
func (*DockerCluster) SetBarrierKeys ¶
func (dc *DockerCluster) SetBarrierKeys(keys [][]byte)
func (*DockerCluster) SetRecoveryKeys ¶
func (dc *DockerCluster) SetRecoveryKeys(keys [][]byte)
func (*DockerCluster) SetRootToken ¶
func (dc *DockerCluster) SetRootToken(s string)
type DockerClusterNode ¶
type DockerClusterNode struct {
NodeID string
HostPort string
ServerCert *x509.Certificate
ServerCertBytes []byte
ServerCertPEM []byte
ServerCertPEMFile string
ServerKey *ecdsa.PrivateKey
ServerKeyPEM []byte
ServerKeyPEMFile string
WorkDir string
Cluster *DockerCluster
Container *types.ContainerJSON
DockerAPI *docker.Client
Logger log.Logger
RealAPIAddr string
ContainerNetworkName string
ContainerIPAddress string
ImageRepo string
ImageTag string
DataVolumeName string
AllClients []*api.Client
// contains filtered or unexported fields
}
DockerClusterNode represents a single instance of Vault in a cluster
func (*DockerClusterNode) APIClient ¶
func (n *DockerClusterNode) APIClient() *api.Client
func (*DockerClusterNode) APIClientN ¶ added in v0.10.0
func (n *DockerClusterNode) APIClientN(listenerNumber int) (*api.Client, error)
func (*DockerClusterNode) AddNetworkDelay ¶
func (*DockerClusterNode) Cleanup ¶
func (n *DockerClusterNode) Cleanup()
Cleanup kills the container of the node and deletes its data volume
func (*DockerClusterNode) Name ¶
func (n *DockerClusterNode) Name() string
func (*DockerClusterNode) PartitionFromCluster ¶ added in v0.10.1
func (n *DockerClusterNode) PartitionFromCluster(ctx context.Context) error
PartitionFromCluster will cause the node to be disconnected at the network level from the rest of the docker cluster. It does so in a way that the node will not see TCP RSTs and all packets it sends will be "black holed". It attempts to keep packets to and from the host intact which allows docker daemon to continue streaming logs and any test code to continue making requests from the host to the partitioned node.
func (*DockerClusterNode) Restart ¶ added in v0.11.0
func (n *DockerClusterNode) Restart(ctx context.Context) error
func (*DockerClusterNode) Start ¶
func (n *DockerClusterNode) Start(ctx context.Context, opts *DockerClusterOptions) error
func (*DockerClusterNode) Stop ¶
func (n *DockerClusterNode) Stop()
Stop kills the container of the node
func (*DockerClusterNode) TLSConfig ¶
func (n *DockerClusterNode) TLSConfig() *tls.Config
func (*DockerClusterNode) UnpartitionFromCluster ¶ added in v0.10.1
func (n *DockerClusterNode) UnpartitionFromCluster(ctx context.Context) error
UnpartitionFromCluster reverses a previous call to PartitionFromCluster and restores full connectivity. Currently assumes the default "bridge" network.
type DockerClusterOptions ¶
type DockerClusterOptions struct {
testcluster.ClusterOptions
CAKey *ecdsa.PrivateKey
NetworkName string
ImageRepo string
ImageTag string
CA *testcluster.CA
VaultBinary string
Args []string
Envs []string
StartProbe func(*api.Client) error
Storage testcluster.ClusterStorage
DisableTLS bool
DisableMlock bool
}
DockerClusterOptions has options for setting up the docker cluster
func DefaultOptions ¶
func DefaultOptions(t *testing.T) *DockerClusterOptions
type LogConsumerWriter ¶
type LogConsumerWriter struct {
// contains filtered or unexported fields
}
type ReloadFunc ¶
type ReloadFunc func() error
ReloadFunc are functions that are called when a reload is requested