cluster

package
v0.0.0-...-b274fa0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConsulNomadClusterAndClient

func NewConsulNomadClusterAndClient(name string, e runenv.Env, ca *pki.CertificateAuthority) (*ConsulNomadCluster, *NomadClient, error)

Types

type ConsulCertificateMaker

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

func (ConsulCertificateMaker) MakeCertificate

func (c ConsulCertificateMaker) MakeCertificate(ctx context.Context, hostname, ip string) (*pki.TLSConfigPEM, error)

type ConsulCluster

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

func NewConsulCluster

func NewConsulCluster(ctx context.Context, e runenv.Env, ca *pki.CertificateAuthority, name string, nodeCount int) (*ConsulCluster, error)

NewConsulCluster creates a Consul cluster in the given env. If ca is given, it will be used to create certificates; otherwise, the cluster won't use TLS.

func NewConsulClusterAndClient

func NewConsulClusterAndClient(name string, e runenv.Env, ca *pki.CertificateAuthority) (*ConsulCluster, runner.Harness, error)

func (*ConsulCluster) Addrs

func (c *ConsulCluster) Addrs() ([]string, error)

func (*ConsulCluster) ClientAPIs

func (c *ConsulCluster) ClientAPIs() ([]*consulapi.Client, error)

func (*ConsulCluster) ClientAgent

func (c *ConsulCluster) ClientAgent(ctx context.Context, e runenv.Env, ca *pki.CertificateAuthority, name string) (runner.Harness, error)

func (*ConsulCluster) Kill

func (c *ConsulCluster) Kill()

func (*ConsulCluster) PeerAddrs

func (c *ConsulCluster) PeerAddrs() []string

func (*ConsulCluster) Stop

func (c *ConsulCluster) Stop()

func (*ConsulCluster) Wait

func (c *ConsulCluster) Wait() error

type ConsulNomadCluster

type ConsulNomadCluster struct {
	Name   string
	Consul *ConsulCluster
	Nomad  *NomadCluster
}

func NewConsulNomadCluster

func NewConsulNomadCluster(ctx context.Context, e runenv.Env, ca *pki.CertificateAuthority, name string, nodeCount int) (*ConsulNomadCluster, error)

func (*ConsulNomadCluster) Kill

func (c *ConsulNomadCluster) Kill()

func (*ConsulNomadCluster) NomadClient

func (*ConsulNomadCluster) Stop

func (c *ConsulNomadCluster) Stop()

func (*ConsulNomadCluster) Wait

func (c *ConsulNomadCluster) Wait() error

type ConsulVaultCluster

type ConsulVaultCluster struct {
	Name   string
	Consul *ConsulCluster
	Vault  *VaultCluster
	// contains filtered or unexported fields
}

func NewConsulVaultCluster

func NewConsulVaultCluster(ctx context.Context, e runenv.Env, ca *pki.CertificateAuthority, name string, nodeCount int,
	seal *vault.Seal) (*ConsulVaultCluster, error)

func (*ConsulVaultCluster) Stop

func (c *ConsulVaultCluster) Stop()

func (*ConsulVaultCluster) Wait

func (c *ConsulVaultCluster) Wait() error

type NomadClient

type NomadClient struct {
	ConsulHarness runner.Harness
	NomadHarness  runner.Harness
}

func (*NomadClient) Kill

func (c *NomadClient) Kill()

func (*NomadClient) Stop

func (c *NomadClient) Stop()

func (*NomadClient) Wait

func (c *NomadClient) Wait() error

type NomadCluster

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

func NewNomadCluster

func NewNomadCluster(ctx context.Context, e runenv.Env, ca *pki.CertificateAuthority, name string, nodeCount int, consulCluster *ConsulCluster) (*NomadCluster, error)

func (*NomadCluster) ClientAPIs

func (c *NomadCluster) ClientAPIs() ([]*nomadapi.Client, error)

func (*NomadCluster) ClientAgent

func (c *NomadCluster) ClientAgent(ctx context.Context, e runenv.Env, ca *pki.CertificateAuthority, name, consulAddr string) (runner.Harness, error)

func (*NomadCluster) Kill

func (c *NomadCluster) Kill()

func (*NomadCluster) Stop

func (c *NomadCluster) Stop()

func (*NomadCluster) Wait

func (c *NomadCluster) Wait() error

type VaultCluster

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

func NewVaultCluster

func NewVaultCluster(ctx context.Context, e runenv.Env, ca *pki.CertificateAuthority,
	name string, nodeCount int, consulAddrs []string, seal *vault.Seal, raftPerfMultiplier int) (ret *VaultCluster, err error)

NewVaultCluster launches a vault cluster, possibly restoring a previous state for the given cluster name, depending on how e creates nodes. If consulAddrs are given they will be used for be running. Otherwise, Integrated Storage (raft) will be used.

func (*VaultCluster) Clients

func (c *VaultCluster) Clients() ([]*vaultapi.Client, error)

func (*VaultCluster) Go

func (c *VaultCluster) Go(name string, f func() error)

func (*VaultCluster) Kill

func (c *VaultCluster) Kill()

func (*VaultCluster) ReplaceAllActiveLast

func (c *VaultCluster) ReplaceAllActiveLast(e runenv.Env, migrateSeal bool) error

ReplaceAllActiveLast restarts all nodes in the cluster, active node last. If raft is used, wait for healthy autopilot state between each restart. The active node is sent a step-down before it is restarted; this is not strictly necessary but may speed things up. After being restarted, nodes are unsealed with -migrate=migrateSeal. The caller is responsible for setting up c.seal/c.oldSeal.

func (*VaultCluster) ReplaceNode

func (c *VaultCluster) ReplaceNode(ctx context.Context, e runenv.Env, idx int, ca *pki.CertificateAuthority, migrate bool) error

func (*VaultCluster) Stop

func (c *VaultCluster) Stop()

func (*VaultCluster) Wait

func (c *VaultCluster) Wait() error

type YurtRunCluster

type YurtRunCluster struct {
	YurtRunClusterOptions
	// contains filtered or unexported fields
}

YurtRunCluster is used for testing yurt-run.

func NewYurtRunCluster

func NewYurtRunCluster(options YurtRunClusterOptions, cli *dockerapi.Client) (*YurtRunCluster, error)

func (*YurtRunCluster) Start

func (y *YurtRunCluster) Start(ctx context.Context) error

Start launches the cluster server nodes.

func (*YurtRunCluster) Stop

func (y *YurtRunCluster) Stop(ctx context.Context) error

type YurtRunClusterOptions

type YurtRunClusterOptions struct {
	// Network is the network the docker containers will run in, which the caller
	// must ensure exists.
	Network yurt.NetworkConfig
	// ConsulServerIPs are the IPs to use for the server nodes.  For consistency
	// with other cluster styles in this project, it is named "Consul"ServerIPs,
	// but the Nomad servers run on these IPs as well.
	ConsulServerIPs []string
	// BaseImage is the docker image to use as a starting point.  No binaries
	// from the image will be run, but we do need glibc for Nomad.
	BaseImage string
	// WorkDir is where all files are created, excluding binaries.
	WorkDir string
}

Jump to

Keyboard shortcuts

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