status

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 3 Imported by: 87

Documentation

Index

Constants

View Source
const (
	MessageWaitForMachine    = "waiting for machine"
	MessageWaitForContainer  = "waiting for container"
	MessageInstallingAgent   = "installing agent"
	MessageInitializingAgent = "agent initialising"
	MessageInstallingCharm   = "installing charm software"
)

Variables

This section is empty.

Functions

func AllHistoryKind

func AllHistoryKind() map[HistoryKind]string

AllHistoryKind will return all valid HistoryKinds.

func ValidModelStatus

func ValidModelStatus(status Status) bool

ValidModelStatus returns true if status has a valid value (that is to say, a value that it's OK to set) for models.

func ValidWorkloadStatus

func ValidWorkloadStatus(status Status) bool

ValidWorkloadStatus returns true if status has a valid value (that is to say, a value that it's OK to set) for units or applications.

Types

type DetailedStatus

type DetailedStatus struct {
	Status Status
	Info   string
	Data   map[string]interface{}
	Since  *time.Time
	Kind   HistoryKind
}

DetailedStatus holds status info about a machine or unit agent.

type History

type History []DetailedStatus

History holds many DetailedStatus,

type HistoryKind

type HistoryKind string

HistoryKind represents the possible types of status history entries.

const (
	// KindModel represents the model itself.
	KindModel HistoryKind = "model"
	// KindApplication represents an entry for an application.
	KindApplication HistoryKind = "application"
	// KindSAAS represents an entry for a saas application.
	KindSAAS HistoryKind = "saas"
	// KindUnit represents agent and workload combined.
	KindUnit HistoryKind = "unit"
	// KindUnitAgent represent a unit agent status history entry.
	KindUnitAgent HistoryKind = "juju-unit"
	// KindWorkload represents a charm workload status history entry.
	KindWorkload HistoryKind = "workload"
	// KindMachineInstance represents an entry for a machine instance.
	KindMachineInstance HistoryKind = "machine"
	// KindMachine represents an entry for a machine agent.
	KindMachine HistoryKind = "juju-machine"
	// KindContainerInstance represents an entry for a container instance.
	KindContainerInstance HistoryKind = "container"
	// KindContainer represents an entry for a container agent.
	KindContainer HistoryKind = "juju-container"
)

IMPORTANT DEV NOTE: when changing this HistoryKind list in any way, these may need to be revised:

* HistoryKind.Valid() * AllHistoryKind() * command help for 'show-status-log' describing these kinds.

func (HistoryKind) String

func (k HistoryKind) String() string

String returns a string representation of the HistoryKind.

func (HistoryKind) Valid

func (k HistoryKind) Valid() bool

Valid will return true if the current kind is a valid one.

type InstanceStatusHistoryGetter

type InstanceStatusHistoryGetter interface {
	InstanceStatusHistory(filter StatusHistoryFilter) ([]StatusInfo, error)
}

InstanceStatusHistoryGetter instances can fetch their instance status history.

type ModificationStatusGetter

type ModificationStatusGetter interface {
	ModificationStatus() (StatusInfo, error)
}

ModificationStatusGetter represents a type whose modification status can be read.

type Status

type Status string

Status used to represent the status of an entity, but has recently become and applies to "workloads" as well, which we don't currently model, for no very clear reason.

Status values currently apply to machine (agents), unit (agents), unit (workloads), application (workloads), volumes, filesystems, and models.

const (

	// Error means the entity requires human intervention
	// in order to operate correctly.
	Error Status = "error"

	// Started is set when:
	// The entity is actively participating in the model.
	// For unit agents, this is a state we preserve for backwards
	// compatibility with scripts during the life of Juju 1.x.
	// In Juju 2.x, the agent-state will remain “active” and scripts
	// will watch the unit-state instead for signals of application readiness.
	Started Status = "started"
)
const (

	// Pending is set when:
	// The machine is not yet participating in the model.
	Pending Status = "pending"

	// Stopped is set when:
	// The machine's agent will perform no further action, other than
	// to set the unit to Dead at a suitable moment.
	Stopped Status = "stopped"

	// Down is set when:
	// The machine ought to be signalling activity, but it cannot be
	// detected.
	Down Status = "down"
)
const (

	// Allocating is set when:
	// The machine on which a unit is to be hosted is still being
	// spun up in the cloud.
	Allocating Status = "allocating"

	// Rebooting is set when:
	// The machine on which this agent is running is being rebooted.
	// The juju-agent should move from rebooting to idle when the reboot is complete.
	Rebooting Status = "rebooting"

	// Executing is set when:
	// The agent is running a hook or action. The human-readable message should reflect
	// which hook or action is being run.
	Executing Status = "executing"

	// Idle is set when:
	// Once the agent is installed and running it will notify the Juju server and its state
	// becomes "idle". It will stay "idle" until some action (e.g. it needs to run a hook) or
	// error (e.g it loses contact with the Juju server) moves it to a different state.
	Idle Status = "idle"

	// Failed is set when:
	// The unit agent has failed in some way,eg the agent ought to be signalling
	// activity, but it cannot be detected. It might also be that the unit agent
	// detected an unrecoverable condition and managed to tell the Juju server about it.
	Failed Status = "failed"

	// Lost is set when:
	// The juju agent has not communicated with the juju server for an unexpectedly long time;
	// the unit agent ought to be signalling activity, but none has been detected.
	Lost Status = "lost"
)
const (

	// Unset is only for applications, and is a placeholder status.
	// The core/cache package deals with aggregating the unit status
	// to the application level.
	Unset Status = "unset"

	// Maintenance is set when:
	// The unit is not yet providing services, but is actively doing stuff
	// in preparation for providing those services.
	// This is a "spinning" state, not an error state.
	// It reflects activity on the unit itself, not on peers or related units.
	Maintenance Status = "maintenance"

	// Terminated is set when:
	// This unit used to exist, we have a record of it (perhaps because of storage
	// allocated for it that was flagged to survive it). Nonetheless, it is now gone.
	Terminated Status = "terminated"

	// Unknown is set when:
	// A unit-agent has finished calling install, config-changed, and start,
	// but the charm has not called status-set yet.
	Unknown Status = "unknown"

	// Waiting is set when:
	// The unit is unable to progress to an active state because an application to
	// which it is related is not running.
	Waiting Status = "waiting"

	// Blocked is set when:
	// The unit needs manual intervention to get back to the Running state.
	Blocked Status = "blocked"

	// Active is set when:
	// The unit believes it is correctly offering all the services it has
	// been asked to offer.
	Active Status = "active"
)
const (

	// Attaching indicates that the storage is being attached
	// to a machine.
	Attaching Status = "attaching"

	// Attached indicates that the storage is attached to a
	// machine.
	Attached Status = "attached"

	// Detaching indicates that the storage is being detached
	// from a machine.
	Detaching Status = "detaching"

	// Detached indicates that the storage is not attached to
	// any machine.
	Detached Status = "detached"
)
const (

	// Available indicates that the model is available for use.
	Available Status = "available"

	// Busy indicates that the model is not available for use because it is
	// running a process that must take the model offline, such as a migration,
	// upgrade, or backup.  This is a spinning state, it is not an error state,
	// and it should be expected that the model will eventually go back to
	// available.
	Busy Status = "busy"
)
const (

	// Joining is used to signify that a relation should become joined soon.
	Joining Status = "joining"

	// Joined is the normal status for a healthy, alive relation.
	Joined Status = "joined"

	// Broken is the status for when a relation life goes to Dead.
	Broken Status = "broken"

	// Suspending is used to signify that a relation will be temporarily broken
	// pending action to resume it.
	Suspending Status = "suspending"

	// Suspended is used to signify that a relation is temporarily broken pending
	// action to resume it.
	Suspended Status = "suspended"
)
const (
	Empty             Status = ""
	Provisioning      Status = "allocating"
	Running           Status = "running"
	ProvisioningError Status = "provisioning error"
)

InstanceStatus

const (
	Applied Status = "applied"
)

ModificationStatus

const (

	// Destroying indicates that the entity is being destroyed.
	//
	// This is valid for volumes, filesystems, and models.
	Destroying Status = "destroying"
)

func (Status) KnownAgentStatus

func (s Status) KnownAgentStatus() bool

KnownAgentStatus returns true if status has a known value for an agent. It includes every status that has ever been valid for a unit or machine agent. This is used by the apiserver client facade to filter out unknown values.

func (Status) KnownInstanceStatus

func (s Status) KnownInstanceStatus() bool

func (Status) KnownModificationStatus

func (s Status) KnownModificationStatus() bool

KnownModificationStatus returns true if the status has a known value for a modification of an instance.

func (Status) KnownWorkloadStatus

func (s Status) KnownWorkloadStatus() bool

KnownWorkloadStatus returns true if status has a known value for a workload. It includes every status that has ever been valid for a unit agent. This is used by the apiserver client facade to filter out unknown values.

func (Status) Matches

func (s Status) Matches(candidate Status) bool

Matches returns true if the candidate matches status, taking into account that the candidate may be a legacy status value which has been deprecated.

func (Status) String

func (s Status) String() string

String returns a string representation of the Status.

func (Status) WorkloadMatches

func (s Status) WorkloadMatches(candidate Status) bool

WorkloadMatches returns true if the candidate matches status, taking into account that the candidate may be a legacy status value which has been deprecated.

type StatusGetter

type StatusGetter interface {
	Status() (StatusInfo, error)
}

StatusGetter represents a type whose status can be read.

type StatusHistoryFilter

type StatusHistoryFilter struct {
	// Size indicates how many results are expected at most.
	Size int
	// FromDate indicates the earliest date from which logs are expected.
	FromDate *time.Time
	// Delta indicates the age of the oldest log expected.
	Delta *time.Duration
	// Exclude indicates the status messages that should be excluded
	// from the returned result.
	Exclude set.Strings
}

StatusHistoryFilter holds arguments that can be use to filter a status history backlog.

func (*StatusHistoryFilter) Validate

func (f *StatusHistoryFilter) Validate() error

Validate checks that the minimum requirements of a StatusHistoryFilter are met.

type StatusHistoryGetter

type StatusHistoryGetter interface {
	StatusHistory(filter StatusHistoryFilter) ([]StatusInfo, error)
}

StatusHistoryGetter instances can fetch their status history.

type StatusInfo

type StatusInfo struct {
	Status  Status
	Message string
	Data    map[string]interface{}
	Since   *time.Time
}

StatusInfo holds a Status and associated information.

func ApplicationDisplayStatus

func ApplicationDisplayStatus(applicationStatus, operatorStatus StatusInfo, expectWorkload bool) StatusInfo

ApplicationDisplayStatus determines which of the two statuses to use when displaying application status in a CAAS model.

func DeriveStatus

func DeriveStatus(statuses []StatusInfo) StatusInfo

DeriveStatus is used to determine the application status from a set of unit status values.

func UnitDisplayStatus

func UnitDisplayStatus(unitStatus, containerStatus StatusInfo, expectWorkload bool) StatusInfo

UnitDisplayStatus is used for CAAS units where the status of the unit could be overridden by the status of the container.

type StatusSetter

type StatusSetter interface {
	SetStatus(StatusInfo) error
}

StatusSetter represents a type whose status can be set.

Jump to

Keyboard shortcuts

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