caasfirewaller

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(cfg ManifoldConfig) dependency.Manifold

Manifold returns a Manifold that encapsulates the firewaller worker.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

NewWorker starts and returns a new CAAS unit firewaller worker.

Types

type ApplicationService

type ApplicationService interface {
	// GetApplicationIDByName returns a application ID by application name. It
	// returns an error if the application can not be found by the name.
	GetApplicationIDByName(ctx context.Context, name string) (application.ID, error)
}

ApplicationService provides access to the application service.

type CAASBroker

type CAASBroker interface {
	Application(string, caas.DeploymentType) caas.Application
}

CAASBroker exposes CAAS broker functionality to a worker.

type CAASFirewallerAPI

type CAASFirewallerAPI interface {
	WatchApplications(context.Context) (watcher.StringsWatcher, error)
	WatchApplication(context.Context, string) (watcher.NotifyWatcher, error)

	IsExposed(context.Context, string) (bool, error)
	ApplicationConfig(context.Context, string) (config.ConfigAttributes, error)

	ApplicationCharmInfo(ctx context.Context, appName string) (*charmscommon.CharmInfo, error)
}

CAASFirewallerAPI provides an interface for watching for the lifecycle state changes (including addition) of applications in the model, and fetching their details.

type Client

type Client interface {
	CAASFirewallerAPI
	LifeGetter
}

Client provides an interface for interacting with the CAASFirewallerAPI. Subsets of this should be passed to the CAASFirewaller worker.

type Config

type Config struct {
	ControllerUUID     string
	ModelUUID          string
	FirewallerAPI      CAASFirewallerAPI
	LifeGetter         LifeGetter
	PortService        PortService
	ApplicationService ApplicationService
	Broker             CAASBroker
	Logger             logger.Logger
}

Config holds configuration for the CAAS unit firewaller worker.

func (Config) Validate

func (config Config) Validate() error

Validate validates the worker configuration.

type LifeGetter

type LifeGetter interface {
	Life(context.Context, string) (life.Value, error)
}

LifeGetter provides an interface for getting the lifecycle state value for an application.

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName      string
	BrokerName         string
	DomainServicesName string

	ControllerUUID string
	ModelUUID      string

	NewClient func(base.APICaller) Client
	NewWorker func(Config) (worker.Worker, error)
	Logger    logger.Logger
}

ManifoldConfig describes the resources used by the firewaller worker.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate is called by start to check for bad configuration.

type PortMutator

type PortMutator interface {
	UpdatePorts(ports []caas.ServicePort, updateContainerPorts bool) error
}

PortMutator exposes CAAS application functionality to a worker.

type PortService

type PortService interface {
	// WatchOpenedPortsForApplication returns a notify watcher for opened ports. This
	// watcher emits events for changes to the opened ports table that are associated
	// with the given application
	WatchOpenedPortsForApplication(context.Context, application.ID) (watcher.NotifyWatcher, error)

	// GetApplicationOpenedPortsByEndpoint returns all the opened ports for the given
	// application, across all units, grouped by endpoint.
	//
	// NOTE: The returned port ranges are atomised, meaning we guarantee that each
	// port range is of unit length.
	GetApplicationOpenedPortsByEndpoint(context.Context, application.ID) (network.GroupedPortRanges, error)
}

PortService provides access to the port service.

type ServiceUpdater

type ServiceUpdater interface {
	UpdateService(caas.ServiceParam) error
}

ServiceUpdater exposes CAAS application functionality to a worker.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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