Documentation ¶
Overview ¶
Package cache is responsible for keeping an in memory representation of the controller's models.
The Controller is kept up to date with the database though a changes channel.
Instances in the cache package also provide watchers. These watchers are checking for changes in the in-memory representation and can be used to avoid excess database reads.
Index ¶
- Constants
- Variables
- type Application
- func (a *Application) CharmURL() string
- func (a *Application) Config() map[string]interface{}
- func (a *Application) DisplayStatus() status.StatusInfo
- func (a *Application) ExpectsWorkload() bool
- func (a *Application) Status() status.StatusInfo
- func (a *Application) Units() []Unit
- func (a *Application) WatchConfig(keys ...string) *ConfigWatcher
- type ApplicationChange
- type Branch
- func (b *Branch) AppConfig(appName string) settings.ItemChanges
- func (b *Branch) AssignedUnits() map[string][]string
- func (b *Branch) Completed() int64
- func (b *Branch) CompletedBy() string
- func (b *Branch) Config() map[string]settings.ItemChanges
- func (b *Branch) Created() int64
- func (b *Branch) CreatedBy() string
- func (b *Branch) Name() string
- type BranchChange
- type Charm
- type CharmChange
- type CharmConfigWatcher
- type Clock
- type Collector
- type ConfigWatcher
- type Controller
- func (c *Controller) Kill()
- func (c *Controller) Mark()
- func (c *Controller) Model(uuid string) (*Model, error)
- func (c *Controller) ModelUUIDs() []string
- func (c *Controller) Name() string
- func (c *Controller) Report() map[string]interface{}
- func (c *Controller) Sweep()
- func (c *Controller) Wait() error
- func (c *Controller) WaitForModel(uuid string, clock Clock) (*Model, error)
- func (c *Controller) WatchAllModels() ModelSummaryWatcher
- func (c *Controller) WatchModelsAsUser(username string) ModelSummaryWatcher
- type ControllerConfig
- type ControllerConfigChange
- type ControllerGauges
- type Endpoint
- type Machine
- func (m *Machine) CharmProfiles() []string
- func (m *Machine) Config() map[string]interface{}
- func (m *Machine) ContainerType() instance.ContainerType
- func (m *Machine) Id() string
- func (m *Machine) InstanceId() (instance.Id, error)
- func (m *Machine) IsManual() bool
- func (m *Machine) Units() ([]Unit, error)
- func (m *Machine) WatchContainers() (*PredicateStringsWatcher, error)
- func (m *Machine) WatchLXDProfileVerificationNeeded() (*MachineLXDProfileWatcher, error)
- type MachineAppModeler
- type MachineChange
- type MachineLXDProfileWatcher
- type MachineLXDProfileWatcherConfig
- type Model
- func (m *Model) Application(appName string) (Application, error)
- func (m *Model) Applications() map[string]Application
- func (m *Model) Branch(name string) (Branch, error)
- func (m *Model) Branches() []Branch
- func (m *Model) Charm(charmURL string) (Charm, error)
- func (m *Model) Config() map[string]interface{}
- func (m *Model) Machine(machineID string) (Machine, error)
- func (m *Model) Machines() map[string]Machine
- func (m *Model) Metrics() *ControllerGauges
- func (m *Model) Name() string
- func (m *Model) Relation(key string) (Relation, error)
- func (m *Model) Relations() map[string]Relation
- func (m *Model) Report() map[string]interface{}
- func (m *Model) Summary() (ModelSummary, string)
- func (m *Model) Type() model.ModelType
- func (m *Model) UUID() string
- func (m *Model) Unit(unitName string) (Unit, error)
- func (m *Model) Units() map[string]Unit
- func (m *Model) WaitForUnit(name string, predicate func(*Unit) bool, cancel <-chan struct{}) <-chan struct{}
- func (m *Model) WatchConfig(keys ...string) *ConfigWatcher
- func (m *Model) WatchMachines() (*PredicateStringsWatcher, error)
- type ModelChange
- type ModelSummary
- type ModelSummaryMessage
- type ModelSummaryWatcher
- type ModelWatcher
- type NotifyWatcher
- type PodSpec
- type PredicateStringsWatcher
- type Relation
- type RelationChange
- type RemoveApplication
- type RemoveBranch
- type RemoveCharm
- type RemoveMachine
- type RemoveModel
- type RemoveRelation
- type RemoveUnit
- type Resident
- type StringsWatcher
- type Unit
- func (u *Unit) AgentStatus() status.StatusInfo
- func (u *Unit) Application() string
- func (u *Unit) CharmURL() string
- func (u *Unit) ConfigSettings() (charm.Settings, error)
- func (u *Unit) DisplayWorkloadStatus() status.StatusInfo
- func (u *Unit) Life() life.Value
- func (u *Unit) MachineId() string
- func (u *Unit) Name() string
- func (u *Unit) OpenPortRangesByEndpoint() network.GroupedPortRanges
- func (u *Unit) Principal() string
- func (u *Unit) Subordinate() bool
- func (u *Unit) WatchConfigSettings() (*CharmConfigWatcher, error)
- func (u *Unit) WorkloadStatus() status.StatusInfo
- type UnitChange
- type Watcher
Constants ¶
const ( StatusRed = "red" StatusYellow = "yellow" // amber? StatusGreen = "green" )
Status values show a high level indicator of model health.
Variables ¶
var ( // IdleFunc allows tests to be able to get callbacks when the controller // hasn't been given any changes for a specified time. IdleFunc func() // IdleTime relates to how long the controller needs to wait with no changes // to be considered idle. IdleTime = 200 * time.Millisecond )
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { // Resident identifies the application as a type-agnostic cached entity // and tracks resources that it is responsible for cleaning up. *Resident // contains filtered or unexported fields }
Application represents an application in a model.
func (*Application) CharmURL ¶
func (a *Application) CharmURL() string
CharmURL returns the charm url string for this application.
func (*Application) Config ¶
func (a *Application) Config() map[string]interface{}
Config returns a copy of the current application config.
func (*Application) DisplayStatus ¶
func (a *Application) DisplayStatus() status.StatusInfo
DisplayStatus is used from the status code in the apiserver, and is what we show to the user. For CAAS models, this is a synthetic status based on the application status and the operator status.
func (*Application) ExpectsWorkload ¶
func (a *Application) ExpectsWorkload() bool
ExpectsWorkload only makes sense for CAAS applications. If a workload is expected, the charm would have set a podspec. Pod specs are never set for IAAS models.
func (*Application) Status ¶
func (a *Application) Status() status.StatusInfo
Status returns the application status if it is set, and if not it uses the derived status from the units.
func (*Application) Units ¶
func (a *Application) Units() []Unit
Units returns all the units for this application.
func (*Application) WatchConfig ¶
func (a *Application) WatchConfig(keys ...string) *ConfigWatcher
WatchConfig creates a watcher for the application config. Do not use this to watch config on behalf of a unit. It is not aware of branch-based config deltas and only deals with master settings.
type ApplicationChange ¶
type ApplicationChange struct { ModelUUID string Name string Exposed bool CharmURL string Life life.Value MinUnits int Constraints constraints.Value Annotations map[string]string Config map[string]interface{} Subordinate bool Status status.StatusInfo OperatorStatus status.StatusInfo // For CAAS applications. WorkloadVersion string PodSpec *PodSpec // For CAAS applications. }
ApplicationChange represents either a new application, or a change to an existing application in a model.
type Branch ¶
type Branch struct { // Resident identifies the branch as a type-agnostic cached entity // and tracks resources that it is responsible for cleaning up. *Resident // contains filtered or unexported fields }
Branch represents an active branch in a cached model.
func (*Branch) AppConfig ¶
func (b *Branch) AppConfig(appName string) settings.ItemChanges
AppConfig returns the configuration changes that apply to the branch for a specific application.
func (*Branch) AssignedUnits ¶
AssignedUnits returns a map of the names of units tracking this branch, keyed by application names with changes made under the branch.
func (*Branch) Completed ¶
Completed returns a Unix timestamp indicating when this generation was committed.
func (*Branch) CompletedBy ¶
CreatedBy returns user who committed the branch.
func (*Branch) Config ¶
func (b *Branch) Config() map[string]settings.ItemChanges
Config returns the configuration changes that apply to the branch.
func (*Branch) Created ¶
Created returns a Unix timestamp indicating when this generation was created.
type BranchChange ¶
type BranchChange struct { ModelUUID string Id string Name string AssignedUnits map[string][]string Config map[string]settings.ItemChanges Created int64 CreatedBy string Completed int64 CompletedBy string GenerationId int }
BranchChange represents a change to an active model branch. Note that this corresponds to a multi-watcher BranchInfo payload, and that the cache behaviour differs from other entities; when a generation is completed (aborted or committed), it is no longer an active branch and will be removed from the cache.
type Charm ¶
type Charm struct { // Resident identifies the charm as a type-agnostic cached entity // and tracks resources that it is responsible for cleaning up. *Resident // contains filtered or unexported fields }
Charm represents an charm in a model.
func (*Charm) DefaultConfig ¶
DefaultConfig returns the default configuration settings for the charm.
func (*Charm) LXDProfile ¶
func (c *Charm) LXDProfile() lxdprofile.Profile
LXDProfile returns the lxd profile of this charm.
type CharmChange ¶
type CharmChange struct { ModelUUID string CharmURL string CharmVersion string LXDProfile lxdprofile.Profile DefaultConfig map[string]interface{} }
CharmChange represents either a new charm, or a change to an existing charm in a model.
type CharmConfigWatcher ¶
type CharmConfigWatcher struct { CharmConfigHashCacheHitInc func() CharmConfigHashCacheMissInc func() // contains filtered or unexported fields }
CharmConfigWatcher watches application charm config on behalf of a unit. The watcher will notify if either of the following events cause a change to the unit's effective configuration: - Changes to the charm config settings for the unit's application. - Changes to a model branch being tracked by the unit.
func (CharmConfigWatcher) Changes ¶
func (w CharmConfigWatcher) Changes() <-chan []string
Changes is part of the core watcher definition. The changes channel is never closed.
func (CharmConfigWatcher) Err ¶
func (w CharmConfigWatcher) Err() error
Err returns the inner tomb's error.
func (CharmConfigWatcher) Kill ¶
func (w CharmConfigWatcher) Kill()
Kill is part of the worker.Worker interface.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector is a prometheus.Collector that collects metrics about the Juju global state.
func NewMetricsCollector ¶
func NewMetricsCollector(controller *Controller) *Collector
NewMetricsCollector returns a new Collector.
func (*Collector) Collect ¶
func (c *Collector) Collect(ch chan<- prometheus.Metric)
Collect is part of the prometheus.Collector interface.
func (*Collector) Describe ¶
func (c *Collector) Describe(ch chan<- *prometheus.Desc)
Describe is part of the prometheus.Collector interface.
type ConfigWatcher ¶
type ConfigWatcher struct {
// contains filtered or unexported fields
}
ConfigWatcher watches a single entity's configuration. If keys are specified the watcher only signals a change when at least one of those keys changes value. If no keys are specified, any change in the config will trigger the watcher to notify.
func (ConfigWatcher) Changes ¶
func (w ConfigWatcher) Changes() <-chan struct{}
Changes is part of the core watcher definition.
func (ConfigWatcher) Kill ¶
func (w ConfigWatcher) Kill()
Kill is part of the worker.Worker interface.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the primary cached object.
func NewController ¶
func NewController(config ControllerConfig) (*Controller, error)
NewController creates a new cached controller instance. The changes channel is what is used to supply the cache with the changes in order for the cache to be kept up to date.
func (*Controller) Mark ¶
func (c *Controller) Mark()
Mark updates all cached entities to indicate they are stale.
func (*Controller) Model ¶
func (c *Controller) Model(uuid string) (*Model, error)
Model returns the model for the specified UUID. If the model isn't found, a NotFoundError is returned.
func (*Controller) ModelUUIDs ¶
func (c *Controller) ModelUUIDs() []string
ModelUUIDs returns the UUIDs of the models in the cache.
func (*Controller) Name ¶
func (c *Controller) Name() string
Name returns the controller-name from the controller config.
func (*Controller) Report ¶
func (c *Controller) Report() map[string]interface{}
Report returns information that is used in the dependency engine report.
func (*Controller) Sweep ¶
func (c *Controller) Sweep()
Sweep evicts any stale entities from the cache, cleaning up resources that they are responsible for.
func (*Controller) Wait ¶
func (c *Controller) Wait() error
Wait is part of the worker.Worker interface.
func (*Controller) WaitForModel ¶
func (c *Controller) WaitForModel(uuid string, clock Clock) (*Model, error)
WaitForModel waits for a time for the specified model to appear in the cache.
func (*Controller) WatchAllModels ¶
func (c *Controller) WatchAllModels() ModelSummaryWatcher
WatchAllModels returns a watcher that will signal whenever there are changes in the summary for that model.
func (*Controller) WatchModelsAsUser ¶
func (c *Controller) WatchModelsAsUser(username string) ModelSummaryWatcher
WatchModelsAsUser returns a watcher that will signal whenever there are changes in the summary for that model. Only models the user can see are included in the results.
type ControllerConfig ¶
type ControllerConfig struct { // Changes from the event source come over this channel. // The changes channel must be non-nil. Changes chan interface{} // Notify is a callback function used primarily for testing, and is // called by the controller main processing loop after processing a change. // The change processed is passed in as the arg to notify. Notify func(interface{}) }
ControllerConfig is a simple config value struct for the controller.
func (*ControllerConfig) Validate ¶
func (c *ControllerConfig) Validate() error
Validate ensures the controller has the right values to be created.
type ControllerConfigChange ¶
type ControllerConfigChange struct {
Config map[string]interface{}
}
ControllerConfigChange represents the initial controller config, or a change initiated by an admin updating the controller config.
type ControllerGauges ¶
type ControllerGauges struct { ModelConfigReads prometheus.Gauge ModelHashCacheHit prometheus.Gauge ModelHashCacheMiss prometheus.Gauge ApplicationConfigReads prometheus.Gauge ApplicationHashCacheHit prometheus.Gauge ApplicationHashCacheMiss prometheus.Gauge CharmConfigHashCacheHit prometheus.Gauge CharmConfigHashCacheMiss prometheus.Gauge LXDProfileChangeError prometheus.Gauge LXDProfileChangeNotification prometheus.Gauge LXDProfileNoChange prometheus.Gauge }
ControllerGauges holds the prometheus gauges for ever increasing values used by the controller.
func (*ControllerGauges) Collect ¶
func (c *ControllerGauges) Collect(ch chan<- prometheus.Metric)
Collect is part of the prometheus.Collector interface.
func (*ControllerGauges) Describe ¶
func (c *ControllerGauges) Describe(ch chan<- *prometheus.Desc)
Describe is part of the prometheus.Collector interface.
type Endpoint ¶
type Endpoint struct { Application string Name string Role string Interface string Optional bool Limit int Scope string }
Endpoint holds all relevant information about a relation endpoint.
type Machine ¶
type Machine struct { // Resident identifies the machine as a type-agnostic cached entity // and tracks resources that it is responsible for cleaning up. *Resident // contains filtered or unexported fields }
Machine represents a machine in a model.
func (*Machine) CharmProfiles ¶
CharmProfiles returns the cached list of charm profiles for the machine.
func (*Machine) ContainerType ¶
func (m *Machine) ContainerType() instance.ContainerType
ContainerType returns the cached container type hosting this machine.
func (*Machine) InstanceId ¶
InstanceId returns the provider specific instance id for this machine and returns not provisioned if instance ID is empty.
func (*Machine) Units ¶
Units returns all the units that have been assigned to the machine including subordinates.
func (*Machine) WatchContainers ¶
func (m *Machine) WatchContainers() (*PredicateStringsWatcher, error)
WatchContainers creates a PredicateStringsWatcher (strings watcher) to notify about added and removed containers on this machine. The initial event contains a slice of the current container machine ids.
func (*Machine) WatchLXDProfileVerificationNeeded ¶
func (m *Machine) WatchLXDProfileVerificationNeeded() (*MachineLXDProfileWatcher, error)
WatchLXDProfileVerificationNeeded notifies if any of the following happen relative to this machine:
- A new unit whose charm has an LXD profile is added.
- A unit being removed has a profile and other units exist on the machine.
- The LXD profile of an application with a unit on this machine is added, removed, or exists.
- The machine's instanceId is changed, indicating it has been provisioned.
type MachineAppModeler ¶
type MachineAppModeler interface { Application(string) (Application, error) Charm(string) (Charm, error) Unit(string) (Unit, error) }
MachineAppModeler is a point of use model for MachineLXDProfileWatcher to get Applications, Charms and Units.
type MachineChange ¶
type MachineChange struct { ModelUUID string Id string InstanceId string AgentStatus status.StatusInfo InstanceStatus status.StatusInfo Life life.Value Annotations map[string]string Config map[string]interface{} Series string ContainerType string IsManual bool SupportedContainers []instance.ContainerType SupportedContainersKnown bool HardwareCharacteristics *instance.HardwareCharacteristics CharmProfiles []string Addresses []network.ProviderAddress HasVote bool WantsVote bool }
MachineChange represents either a new machine, or a change to an existing machine in a model.
type MachineLXDProfileWatcher ¶
type MachineLXDProfileWatcher struct {
// contains filtered or unexported fields
}
func (MachineLXDProfileWatcher) Changes ¶
func (w MachineLXDProfileWatcher) Changes() <-chan struct{}
Changes is part of the core watcher definition.
func (MachineLXDProfileWatcher) Kill ¶
func (w MachineLXDProfileWatcher) Kill()
Kill is part of the worker.Worker interface.
type MachineLXDProfileWatcherConfig ¶
type MachineLXDProfileWatcherConfig struct {
// contains filtered or unexported fields
}
type Model ¶
type Model struct { // Resident identifies the model as a type-agnostic cached entity // and tracks resources that it is responsible for cleaning up. *Resident // contains filtered or unexported fields }
Model is a cached model in the controller. The model is kept up to date with changes flowing into the cached controller.
func (*Model) Application ¶
func (m *Model) Application(appName string) (Application, error)
Application returns the application for the input name. If the application is not found, a NotFoundError is returned.
func (*Model) Applications ¶
func (m *Model) Applications() map[string]Application
Applications makes a copy of the model's application collection and returns it.
func (*Model) Branch ¶
Branch returns the branch with the input name. If the branch is not found, a NotFoundError is returned. All API-level logic identifies active branches by their name whereas they are managed in the cache by ID - we iterate over the map to locate them. We do not expect many active branches to exist at once, so the performance should be acceptable.
func (*Model) Charm ¶
Charm returns the charm for the input charmURL. If the charm is not found, a NotFoundError is returned.
func (*Model) Machine ¶
Machine returns the machine with the input id. If the machine is not found, a NotFoundError is returned.
func (*Model) Metrics ¶
func (m *Model) Metrics() *ControllerGauges
Metrics returns the metrics of the model
func (*Model) Relation ¶
Relation returns the relation with the specified key. If the relation is not found, a NotFoundError is returned.
func (*Model) Summary ¶
func (m *Model) Summary() (ModelSummary, string)
Summary returns a copy of the current summary, and its hash.
func (*Model) Unit ¶
Unit returns the unit with the input name. If the unit is not found, a NotFoundError is returned.
func (*Model) WaitForUnit ¶
func (m *Model) WaitForUnit(name string, predicate func(*Unit) bool, cancel <-chan struct{}) <-chan struct{}
WaitForUnit is the second attempt at providing a genericish way to wait for the cache to be updated. The method subscribes to the hub with the topic "unit-change.<source>". The expected payload is a *Unit. The method effectively runs another goroutine that will close the result channel when the field is updated to the expected value, or the cancel channel is signalled. This method is not responsible for checking the current value, it only deals with changes.
func (*Model) WatchConfig ¶
func (m *Model) WatchConfig(keys ...string) *ConfigWatcher
WatchConfig creates a watcher for the model config.
func (*Model) WatchMachines ¶
func (m *Model) WatchMachines() (*PredicateStringsWatcher, error)
WatchMachines returns a PredicateStringsWatcher to notify about added and removed machines in the model. The initial event contains a slice of the current machine ids. Containers are excluded.
type ModelChange ¶
type ModelChange struct { ModelUUID string Name string Type model.ModelType Life life.Value Owner string // tag maybe? IsController bool Cloud string CloudRegion string CloudCredential string Annotations map[string]string Config map[string]interface{} Status status.StatusInfo UserPermissions map[string]permission.Access }
ModelChange represents either a new model, or a change to an existing model.
type ModelSummary ¶
type ModelSummary struct { UUID string // Removed indicates that the user can no longer see this model, because it has // either been removed, or there access revoked. Removed bool Controller string Namespace string Name string Admins []string Status string Annotations map[string]string // Messages contain status message for any unit status in error. Messages []ModelSummaryMessage Cloud string Region string Credential string LastModified time.Time // Currently missing in cache and underlying db model. // MachineCount is just top level machines. MachineCount int ContainerCount int ApplicationCount int UnitCount int RelationCount int }
ModelSummary represents a high level view of a model. Primary use case is to drive a dashboard with model level overview.
type ModelSummaryMessage ¶
ModelSummaryMessage holds information about an error message from an agent, and when that message was set.
type ModelSummaryWatcher ¶
type ModelSummaryWatcher interface { Watcher Changes() <-chan []ModelSummary }
ModelSummaryWatcher will return a slice for all existing models
type ModelWatcher ¶
ModelWatcher will pass back models added to the cache.
type NotifyWatcher ¶
type NotifyWatcher interface { Watcher Changes() <-chan struct{} }
NotifyWatcher will only say something changed.
type PodSpec ¶
PodSpec is used to determine whether or not a CAAS application has called the command to set the pod spec.
type PredicateStringsWatcher ¶
type PredicateStringsWatcher struct {
// contains filtered or unexported fields
}
PredicateStringsWatcher notifies that something changed, with a slice of strings. The predicateFunc will test the values before notification. An initial event is sent with the input given at creation.
func (PredicateStringsWatcher) Changes ¶
func (w PredicateStringsWatcher) Changes() <-chan []string
Changes is part of the core watcher definition. The changes channel is never closed.
func (PredicateStringsWatcher) Err ¶
func (w PredicateStringsWatcher) Err() error
Err returns the inner tomb's error.
func (PredicateStringsWatcher) Kill ¶
func (w PredicateStringsWatcher) Kill()
Kill is part of the worker.Worker interface.
type Relation ¶
type Relation struct { // Resident identifies the relation as a type-agnostic cached entity // and tracks resources that it is responsible for cleaning up. *Resident // contains filtered or unexported fields }
Relation represents a relation in a cached model.
type RelationChange ¶
RelationChange represents either a new relation, or a change to an existing relation in a model.
type RemoveApplication ¶
RemoveApplication represents the situation when an application is removed from a model in the database.
type RemoveBranch ¶
RemoveBranch represents the situation when a branch is to be removed from the cache. This will rarely be a result of deletion from the database. It will usually be the result of the branch no longer being considered "in-flight" due to being committed or aborted.
type RemoveCharm ¶
RemoveCharm represents the situation when an charm is removed from a model in the database.
type RemoveMachine ¶
RemoveMachine represents the situation when a machine is removed from a model in the database.
type RemoveModel ¶
type RemoveModel struct {
ModelUUID string
}
RemoveModel represents the situation when a model is removed from the database.
type RemoveRelation ¶
RemoveRelation represents the situation when a relation is removed from a model in the database.
type RemoveUnit ¶
RemoveUnit represents the situation when a unit is removed from a model in the database.
type Resident ¶
type Resident struct {
// contains filtered or unexported fields
}
Resident is the base class for entities managed in the cache.
type StringsWatcher ¶
StringsWatcher will return what has changed.
type Unit ¶
type Unit struct { // Resident identifies the unit as a type-agnostic cached entity // and tracks resources that it is responsible for cleaning up. *Resident // contains filtered or unexported fields }
Unit represents a unit in a cached model.
func (*Unit) AgentStatus ¶
func (u *Unit) AgentStatus() status.StatusInfo
AgentStatus returns the agent status of the unit.
func (*Unit) Application ¶
Application returns the application name of this unit.
func (*Unit) ConfigSettings ¶
ConfigSettings returns the effective charm configuration for this unit taking into account whether it is tracking a model branch.
func (*Unit) DisplayWorkloadStatus ¶
func (u *Unit) DisplayWorkloadStatus() status.StatusInfo
DisplayWorkloadStatus returns the workload status of the unit. For CAAS models, the cloud container status is used over the unit if the cloud container status in certain circumstances.
func (*Unit) OpenPortRangesByEndpoint ¶
func (u *Unit) OpenPortRangesByEndpoint() network.GroupedPortRanges
OpenbPortRangesByEndpoint returns a map where keys are endpoint names and values are the port ranges opened by the unit for each endpoint.
func (*Unit) Subordinate ¶
Subordinate returns a bool indicating whether this unit is a subordinate.
func (*Unit) WatchConfigSettings ¶
func (u *Unit) WatchConfigSettings() (*CharmConfigWatcher, error)
WatchConfigSettings returns a new watcher that will notify when the effective application charm config for this unit changes.
func (*Unit) WorkloadStatus ¶
func (u *Unit) WorkloadStatus() status.StatusInfo
WorkloadStatus returns the workload status of the unit.
type UnitChange ¶
type UnitChange struct { ModelUUID string Name string Application string Series string Annotations map[string]string CharmURL string Life life.Value PublicAddress string PrivateAddress string MachineId string OpenPortRangesByEndpoint network.GroupedPortRanges Principal string Subordinate bool WorkloadStatus status.StatusInfo AgentStatus status.StatusInfo ContainerStatus status.StatusInfo // For CAAS models. }
UnitChange represents either a new unit, or a change to an existing unit in a model.