testcluster

package
v2.0.0-...-e8682ef Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCAFile is the path to the CA file. This is a docker-specific
	// constant. TODO: needs to be moved to a more relevant place
	DefaultCAFile = "/vault/config/ca.pem"
)

Variables

This section is empty.

Functions

func GenerateRoot

func GenerateRoot(cluster VaultCluster, kind GenerateRootKind) (string, error)

func JSONLogNoTimestamp

func JSONLogNoTimestamp(outlog hclog.Logger, text string)

func LeaderNode

func LeaderNode(ctx context.Context, cluster VaultCluster) (int, error)

func NodeHealthy

func NodeHealthy(ctx context.Context, cluster VaultCluster, nodeIdx int) error

func NodeSealed

func NodeSealed(ctx context.Context, cluster VaultCluster, nodeIdx int) error

func SealAllNodes

func SealAllNodes(ctx context.Context, cluster VaultCluster) error

func SealNode

func SealNode(ctx context.Context, cluster VaultCluster, nodeIdx int) error

Note that OSS standbys will not accept seal requests. And ent perf standbys may fail it as well if they haven't yet been able to get "elected" as perf standbys.

func UnsealAllNodes

func UnsealAllNodes(ctx context.Context, cluster VaultCluster) error

func UnsealNode

func UnsealNode(ctx context.Context, cluster VaultCluster, nodeIdx int) error

func WaitForActiveNode

func WaitForActiveNode(ctx context.Context, cluster VaultCluster) (int, error)

func WaitForNCoresSealed

func WaitForNCoresSealed(ctx context.Context, cluster VaultCluster, n int) error

Types

type CA

type CA struct {
	CACert        *x509.Certificate
	CACertBytes   []byte
	CACertPEM     []byte
	CACertPEMFile string
	CAKey         *ecdsa.PrivateKey
	CAKeyPEM      []byte
}

type ClusterJson

type ClusterJson struct {
	Nodes      []ClusterNode `json:"nodes"`
	CACertPath string        `json:"ca_cert_path"`
	RootToken  string        `json:"root_token"`
}

type ClusterNode

type ClusterNode struct {
	APIAddress string `json:"api_address"`
}

type ClusterOptions

type ClusterOptions struct {
	ClusterName                 string
	KeepStandbysSealed          bool
	SkipInit                    bool
	CACert                      []byte
	NumCores                    int
	TmpDir                      string
	Logger                      hclog.Logger
	VaultNodeConfig             *VaultNodeConfig
	AdministrativeNamespacePath string
}

type ClusterStorage

type ClusterStorage interface {
	Start(context.Context, *ClusterOptions) error
	Cleanup() error
	Opts() map[string]interface{}
	Type() string
}

type ExecDevCluster

type ExecDevCluster struct {
	ID            string
	ClusterName   string
	ClusterNodes  []*execDevClusterNode
	CACertPEMFile string

	Logger log.Logger
	// contains filtered or unexported fields
}

func NewExecDevCluster

func NewExecDevCluster(ctx context.Context, opts *ExecDevClusterOptions) (*ExecDevCluster, error)

func NewTestExecDevCluster

func NewTestExecDevCluster(t *testing.T, opts *ExecDevClusterOptions) *ExecDevCluster

func (*ExecDevCluster) Cleanup

func (dc *ExecDevCluster) Cleanup()

func (*ExecDevCluster) ClusterID

func (dc *ExecDevCluster) ClusterID() string

func (*ExecDevCluster) GetBarrierKeys

func (dc *ExecDevCluster) GetBarrierKeys() [][]byte

func (*ExecDevCluster) GetBarrierOrRecoveryKeys

func (dc *ExecDevCluster) GetBarrierOrRecoveryKeys() [][]byte

func (*ExecDevCluster) GetCACertPEMFile

func (dc *ExecDevCluster) GetCACertPEMFile() string

func (*ExecDevCluster) GetRecoveryKeys

func (dc *ExecDevCluster) GetRecoveryKeys() [][]byte

func (*ExecDevCluster) GetRootToken

func (dc *ExecDevCluster) GetRootToken() string

GetRootToken returns the root token of the cluster, if set

func (*ExecDevCluster) NamedLogger

func (dc *ExecDevCluster) NamedLogger(s string) log.Logger

func (*ExecDevCluster) Nodes

func (dc *ExecDevCluster) Nodes() []VaultClusterNode

func (*ExecDevCluster) SetBarrierKeys

func (dc *ExecDevCluster) SetBarrierKeys(keys [][]byte)

func (*ExecDevCluster) SetRecoveryKeys

func (dc *ExecDevCluster) SetRecoveryKeys(keys [][]byte)

func (*ExecDevCluster) SetRootToken

func (dc *ExecDevCluster) SetRootToken(token string)

type ExecDevClusterOptions

type ExecDevClusterOptions struct {
	ClusterOptions
	BinaryPath string
	// this is -dev-listen-address, defaults to "127.0.0.1:8200"
	BaseListenAddress string
}

type GenerateRootKind

type GenerateRootKind int
const (
	GenerateRootRegular GenerateRootKind = iota
	GenerateRecovery    GenerateRootKind = iota + 1
)

type VaultCluster

type VaultCluster interface {
	Nodes() []VaultClusterNode
	GetBarrierKeys() [][]byte
	GetRecoveryKeys() [][]byte
	GetBarrierOrRecoveryKeys() [][]byte
	SetBarrierKeys([][]byte)
	SetRecoveryKeys([][]byte)
	GetCACertPEMFile() string
	Cleanup()
	ClusterID() string
	NamedLogger(string) hclog.Logger
	SetRootToken(token string)
	GetRootToken() string
}

type VaultClusterNode

type VaultClusterNode interface {
	APIClient() *api.Client
	TLSConfig() *tls.Config
}

type VaultNodeConfig

type VaultNodeConfig struct {
	StorageOptions map[string]string

	DefaultMaxRequestDuration      time.Duration `json:"default_max_request_duration"`
	LogFormat                      string        `json:"log_format"`
	LogLevel                       string        `json:"log_level"`
	CacheSize                      int           `json:"cache_size"`
	DisableCache                   bool          `json:"disable_cache"`
	DisablePrintableCheck          bool          `json:"disable_printable_check"`
	EnableUI                       bool          `json:"ui"`
	MaxLeaseTTL                    time.Duration `json:"max_lease_ttl"`
	DefaultLeaseTTL                time.Duration `json:"default_lease_ttl"`
	ClusterCipherSuites            string        `json:"cluster_cipher_suites"`
	PluginFileUid                  int           `json:"plugin_file_uid"`
	PluginFilePermissions          int           `json:"plugin_file_permissions"`
	EnableRawEndpoint              bool          `json:"raw_storage_endpoint"`
	DisableClustering              bool          `json:"disable_clustering"`
	DisablePerformanceStandby      bool          `json:"disable_performance_standby"`
	DisableSealWrap                bool          `json:"disable_sealwrap"`
	DisableIndexing                bool          `json:"disable_indexing"`
	DisableSentinelTrace           bool          `json:"disable_sentinel"`
	EnableResponseHeaderHostname   bool          `json:"enable_response_header_hostname"`
	LogRequestsLevel               string        `json:"log_requests_level"`
	EnableResponseHeaderRaftNodeID bool          `json:"enable_response_header_raft_node_id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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