Documentation

Index

Constants

View Source
const (
	ControllerIPLeafGroup = "controllerip"
)

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that will run a pki Authority.

func NewCertificateUpdater

func NewCertificateUpdater(config Config) worker.Worker

NewCertificateUpdater returns a worker.Worker that watches for changes to machine addresses and then generates a new controller certificate with those addresses in the certificate's SAN value.

Types

type APIHostPortsGetter

type APIHostPortsGetter interface {
	APIHostPortsForClients() ([]network.SpaceHostPorts, error)
}

APIHostPortsGetter is an interface that is provided to NewCertificateUpdater. It returns all known API addresses.

type AddressWatcher

type AddressWatcher interface {
	WatchAddresses() state.NotifyWatcher
	Addresses() (addresses network.SpaceAddresses)
}

AddressWatcher is an interface that is provided to NewCertificateUpdater which can be used to watch for machine address changes.

func NewMachineAddressWatcher

func NewMachineAddressWatcher(st *state.State, machineId string) (AddressWatcher, error)

NewMachineAddressWatcher is the function that non-test code should pass into ManifoldConfig.NewMachineAddressWatcher.

type CertificateUpdater

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

CertificateUpdater is responsible for generating controller certificates.

In practice, CertificateUpdater is used by a controller's machine agent to watch that server's machines addresses in state, and write a new certificate to the agent's config file.

func (*CertificateUpdater) Handle

func (c *CertificateUpdater) Handle(done <-chan struct{}) error

Handle is defined on the NotifyWatchHandler interface.

func (*CertificateUpdater) SetUp

SetUp is defined on the NotifyWatchHandler interface.

func (*CertificateUpdater) TearDown

func (c *CertificateUpdater) TearDown() error

TearDown is defined on the NotifyWatchHandler interface.

type Config

type Config struct {
	AddressWatcher     AddressWatcher
	Authority          pki.Authority
	APIHostPortsGetter APIHostPortsGetter
}

Config holds the configuration for the certificate updater worker.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName                string
	AuthorityName            string
	StateName                string
	NewWorker                func(Config) worker.Worker
	NewMachineAddressWatcher func(st *state.State, machineId string) (AddressWatcher, error)
}

ManifoldConfig holds the information necessary to run a certupdater in a dependency.Engine.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type StateServingInfoGetter

type StateServingInfoGetter interface {
	StateServingInfo() (controller.StateServingInfo, bool)
}

StateServingInfoGetter is an interface that is provided to NewCertificateUpdater whose StateServingInfo method will be invoked to get state serving info.