controller

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 62 Imported by: 0

Documentation

Overview

The controller package groups various commands that are based on talking directly to the controller, and not environments in the controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDetails

func ConfigDetails() (map[string]interface{}, error)

ConfigDetails gets information about controller config attributes.

func ControllerMachineCounts

func ControllerMachineCounts(controllerModelUUID string, modelStatusResults []base.ModelStatus) (activeCount, totalCount int)

func NewAddModelCommand

func NewAddModelCommand() cmd.Command

NewAddModelCommand returns a command to add a model.

func NewConfigCommand

func NewConfigCommand() cmd.Command

NewConfigCommand returns a new command that can retrieve or update controller configuration.

func NewDestroyCommand

func NewDestroyCommand() cmd.Command

NewDestroyCommand returns a command to destroy a controller.

func NewEnableDestroyControllerCommand

func NewEnableDestroyControllerCommand() cmd.Command

NewEnableDestroyControllerCommand returns a command that allows a controller admin to remove blocks from the controller.

func NewKillCommand

func NewKillCommand() modelcmd.Command

NewKillCommand returns a command to kill a controller. Killing is a forceful destroy.

func NewListControllersCommand

func NewListControllersCommand() cmd.Command

NewListControllersCommand returns a command to list registered controllers.

func NewListModelsCommand

func NewListModelsCommand() cmd.Command

NewListModelsCommand returns a command to list models.

func NewRegisterCommand

func NewRegisterCommand() cmd.Command

NewRegisterCommand returns a command to allow the user to register a controller.

func NewShowControllerCommand

func NewShowControllerCommand() cmd.Command

NewShowControllerCommand returns a command to show details of the desired controllers.

func NewUnregisterCommand

func NewUnregisterCommand(store jujuclient.ClientStore) cmd.Command

NewUnregisterCommand returns a command to allow the user to unregister a controller.

Types

type AccountDetails

type AccountDetails struct {
	// User is the username for the account.
	User string `yaml:"user" json:"user"`

	// Access is the level of access the user has on the controller.
	Access string `yaml:"access,omitempty" json:"access,omitempty"`

	// Password is the password for the account.
	Password string `yaml:"password,omitempty" json:"password,omitempty"`
}

AccountDetails holds details of an account to show.

type AddModelAPI

type AddModelAPI interface {
	CreateModel(
		name, owner, cloudName, cloudRegion string,
		cloudCredential names.CloudCredentialTag,
		config map[string]interface{},
	) (base.ModelInfo, error)
}

type CloudAPI

type CloudAPI interface {
	Clouds() (map[names.CloudTag]jujucloud.Cloud, error)
	Cloud(names.CloudTag) (jujucloud.Cloud, error)
	UserCredentials(names.UserTag, names.CloudTag) ([]names.CloudCredentialTag, error)
	AddCredential(tag string, credential jujucloud.Credential) error
}

type ControllerAccessAPI

type ControllerAccessAPI interface {
	GetControllerAccess(user string) (permission.Access, error)
	ModelConfig() (map[string]interface{}, error)
	ModelStatus(models ...names.ModelTag) ([]base.ModelStatus, error)
	AllModels() ([]base.UserModel, error)
	MongoVersion() (string, error)
	IdentityProviderURL() (string, error)
	ControllerVersion() (controller.ControllerVersion, error)
	Close() error
}

ControllerAccessAPI defines a subset of the api/controller/Client API.

type ControllerDetails

type ControllerDetails struct {
	// ControllerUUID is the unique ID for the controller.
	ControllerUUID string `yaml:"controller-uuid" json:"uuid"`

	// APIEndpoints is the collection of API endpoints running in this controller.
	APIEndpoints []string `yaml:"api-endpoints,flow" json:"api-endpoints"`

	// Cloud is the name of the cloud that this controller runs in.
	Cloud string `yaml:"cloud" json:"cloud"`

	// CloudRegion is the name of the cloud region that this controller runs in.
	CloudRegion string `yaml:"region,omitempty" json:"region,omitempty"`

	// AgentVersion is the version of the agent running on this controller.
	// AgentVersion need not always exist so we omitempty here. This struct is
	// used in both list-controller and show-controller. show-controller
	// displays the agent version where list-controller does not.
	AgentVersion string `yaml:"agent-version,omitempty" json:"agent-version,omitempty"`

	// AgentGitCommit is the git commit hash used to build the controller binary.
	AgentGitCommit string `yaml:"agent-git-commit,omitempty" json:"agent-git-commit,omitempty"`

	// ControllerModelVersion is the version in the controller model config state.
	ControllerModelVersion string `yaml:"controller-model-version,omitempty" json:"controller-model-version,omitempty"`

	// MongoVersion is the version of the mongo server running on this
	// controller.
	MongoVersion string `yaml:"mongo-version,omitempty" json:"mongo-version,omitempty"`

	// IdentityURL contails the address of an external identity provider
	// if one has been configured for this controller.
	IdentityURL string `yaml:"identity-url,omitempty" json:"identity-url,omitempty"`

	// SHA-256 fingerprint of the CA cert
	CAFingerprint string `yaml:"ca-fingerprint,omitempty" json:"ca-fingerprint,omitempty"`

	// CACert is a security certificate for this controller.
	CACert string `yaml:"ca-cert" json:"ca-cert"`
}

ControllerDetails holds details of a controller to show.

type ControllerItem

type ControllerItem struct {
	ModelName          string              `yaml:"current-model,omitempty" json:"current-model,omitempty"`
	User               string              `yaml:"user,omitempty" json:"user,omitempty"`
	Access             string              `yaml:"access,omitempty" json:"access,omitempty"`
	Server             string              `yaml:"recent-server,omitempty" json:"recent-server,omitempty"`
	ControllerUUID     string              `yaml:"controller-uuid" json:"uuid"`
	APIEndpoints       []string            `yaml:"api-endpoints,flow" json:"api-endpoints"`
	CACert             string              `yaml:"ca-cert" json:"ca-cert"`
	Cloud              string              `yaml:"cloud" json:"cloud"`
	CloudRegion        string              `yaml:"region,omitempty" json:"region,omitempty"`
	AgentVersion       string              `yaml:"agent-version,omitempty" json:"agent-version,omitempty"`
	ModelCount         *int                `yaml:"model-count,omitempty" json:"model-count,omitempty"`
	MachineCount       *int                `yaml:"machine-count,omitempty" json:"machine-count,omitempty"`
	ControllerMachines *ControllerMachines `yaml:"controller-machines,omitempty" json:"controller-machines,omitempty"`

	// k8s controllers are not called machines
	NodeCount       *int                `yaml:"node-count,omitempty" json:"node-count,omitempty"`
	ControllerNodes *ControllerMachines `yaml:"controller-nodes,omitempty" json:"controller-nodes,omitempty"`
}

ControllerItem defines the serialization behaviour of controller information.

type ControllerMachines

type ControllerMachines struct {
	Active int `yaml:"active"`
	Total  int `yaml:"total"`
}

ControllerMachines holds the total number of controller machines and the number of active ones.

type ControllerSet

type ControllerSet struct {
	Controllers       map[string]ControllerItem `yaml:"controllers" json:"controllers"`
	CurrentController string                    `yaml:"current-controller" json:"current-controller"`
}

ControllerSet contains the set of controllers known to the client, and name of the current controller.

type CredentialAPI

type CredentialAPI interface {
	InvalidateModelCredential(string) error
	Close() error
}

CredentialAPI defines the methods on the credential API endpoint that the destroy command might call.

type MachineDetails

type MachineDetails struct {
	// ID holds the id of the machine.
	ID string `yaml:"id,omitempty" json:"id,omitempty"`

	// InstanceID holds the cloud instance id of the machine.
	InstanceID string `yaml:"instance-id,omitempty" json:"instance-id,omitempty"`

	// HAStatus holds information informing of the HA status of the machine.
	HAStatus string `yaml:"ha-status,omitempty" json:"ha-status,omitempty"`

	// HAPrimary is set to true for a primary controller machine in HA.
	HAPrimary bool `yaml:"ha-primary,omitempty" json:"ha-primary,omitempty"`
}

ModelDetails holds details of a model to show.

type ModelDetails

type ModelDetails struct {
	// ModelUUID holds the details of a model.
	ModelUUID string `yaml:"model-uuid" json:"uuid"`

	// MachineCount holds the number of machines in the model.
	MachineCount *int `yaml:"machine-count,omitempty" json:"machine-count,omitempty"`

	// CoreCount holds the number of cores across the machines in the model.
	CoreCount *int `yaml:"core-count,omitempty" json:"core-count,omitempty"`

	// UnitCount holds the number of units in the model.
	UnitCount *int `yaml:"unit-count,omitempty" json:"unit-count,omitempty"`
}

ModelDetails holds details of a model to show.

type ModelManagerAPI

type ModelManagerAPI interface {
	Close() error
	ListModels(user string) ([]base.UserModel, error)
	ListModelSummaries(user string, all bool) ([]base.UserModelSummary, error)
	ModelInfo([]names.ModelTag) ([]params.ModelInfoResult, error)
	BestAPIVersion() int
}

ModelManagerAPI defines the methods on the model manager API that the models command calls.

type ModelSet

type ModelSet struct {
	Models []common.ModelInfo `yaml:"models" json:"models"`

	// CurrentModel is the name of the current model, qualified for the
	// user for which we're listing models. i.e. for the user admin,
	// and the model admin/foo, this field will contain "foo"; for
	// bob and the same model, the field will contain "admin/foo".
	CurrentModel string `yaml:"current-model,omitempty" json:"current-model,omitempty"`

	// CurrentModelQualified is the fully qualified name for the current
	// model, i.e. having the format $owner/$model.
	CurrentModelQualified string `yaml:"-" json:"-"`
}

ModelSet contains the set of models known to the client, and UUID of the current model. (anastasiamac 2017-23-11) This is old, pre juju 2.3 implementation.

type ModelSummary

type ModelSummary struct {
	// Name is a fully qualified model name, i.e. having the format $owner/$model.
	Name string `json:"name" yaml:"name"`

	// ShortName is un-qualified model name.
	ShortName string          `json:"short-name" yaml:"short-name"`
	UUID      string          `json:"model-uuid" yaml:"model-uuid"`
	Type      model.ModelType `json:"model-type" yaml:"model-type"`

	ControllerUUID     string                  `json:"controller-uuid" yaml:"controller-uuid"`
	ControllerName     string                  `json:"controller-name" yaml:"controller-name"`
	IsController       bool                    `json:"is-controller" yaml:"is-controller"`
	Owner              string                  `json:"owner" yaml:"owner"`
	Cloud              string                  `json:"cloud" yaml:"cloud"`
	CloudRegion        string                  `json:"region,omitempty" yaml:"region,omitempty"`
	CloudCredential    *common.ModelCredential `json:"credential,omitempty" yaml:"credential,omitempty"`
	ProviderType       string                  `json:"type,omitempty" yaml:"type,omitempty"`
	Life               life.Value              `json:"life" yaml:"life"`
	Status             *common.ModelStatus     `json:"status,omitempty" yaml:"status,omitempty"`
	UserAccess         string                  `yaml:"access" json:"access"`
	UserLastConnection string                  `yaml:"last-connection" json:"last-connection"`

	// Counts is the map of different counts where key is the entity that was counted
	// and value is the number, for e.g. {"machines":10,"cores":3, "units:4}.
	Counts       map[string]int64 `json:"-" yaml:"-"`
	SLA          string           `json:"sla,omitempty" yaml:"sla,omitempty"`
	SLAOwner     string           `json:"sla-owner,omitempty" yaml:"sla-owner,omitempty"`
	AgentVersion string           `json:"agent-version,omitempty" yaml:"agent-version,omitempty"`
}

ModelSummary contains a summary of some information about a model.

type ModelSummarySet

type ModelSummarySet struct {
	Models []ModelSummary `yaml:"models" json:"models"`

	// CurrentModel is the name of the current model, qualified for the
	// user for which we're listing models. i.e. for the user admin,
	// and the model admin/foo, this field will contain "foo"; for
	// bob and the same model, the field will contain "admin/foo".
	CurrentModel string `yaml:"current-model,omitempty" json:"current-model,omitempty"`

	// CurrentModelQualified is the fully qualified name for the current
	// model, i.e. having the format $owner/$model.
	CurrentModelQualified string `yaml:"-" json:"-"`
}

ModelSummarySet contains the set of summaries for models.

type ModelsSysAPI

type ModelsSysAPI interface {
	Close() error
	AllModels() ([]base.UserModel, error)
}

ModelsSysAPI defines the methods on the controller manager API that the list models command calls.

type ShowControllerDetails

type ShowControllerDetails struct {
	// Details contains the same details that client store caches for this controller.
	Details ControllerDetails `yaml:"details,omitempty" json:"details,omitempty"`

	// Machines is a collection of all machines forming the controller cluster.
	Machines map[string]MachineDetails `yaml:"controller-machines,omitempty" json:"controller-machines,omitempty"`

	// Nodes is a collection of all k8s pods forming the controller cluster.
	Nodes map[string]MachineDetails `yaml:"controller-nodes,omitempty" json:"controller-nodes,omitempty"`

	// Models is a collection of all models for this controller.
	Models map[string]ModelDetails `yaml:"models,omitempty" json:"models,omitempty"`

	// CurrentModel is the name of the current model for this controller
	CurrentModel string `yaml:"current-model,omitempty" json:"current-model,omitempty"`

	// Account is the account details for the user logged into this controller.
	Account *AccountDetails `yaml:"account,omitempty" json:"account,omitempty"`

	// Errors is a collection of errors related to accessing this controller details.
	Errors []string `yaml:"errors,omitempty" json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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