Documentation ¶
Index ¶
- Variables
- func AddUnits(st *state.State, svc *state.Service, n int, placement []*instance.Placement) ([]*state.Unit, error)
- func DeployService(st ServiceDeployer, args DeployServiceParams) (*state.Service, error)
- func InitJujuXDGDataHome() error
- func NewAPIConnection(args NewAPIConnectionParams) (api.Connection, error)
- func PrepareEndpointsForCaching(controllerDetails jujuclient.ControllerDetails, hostPorts [][]network.HostPort, ...) (addresses, hostnames []string, haveChanged bool)
- func UpdateControllerAddresses(store jujuclient.ControllerStore, controllerName string, ...) error
- type DeployServiceParams
- type NewAPIConnectionParams
- type ServiceDeployer
Constants ¶
This section is empty.
Variables ¶
var JujuPublicKey = `` /* 3165-byte string literal not displayed */
JujuPublicKey is the public key required to authenticate data on http://streams.canonical.com. Declared as a var so it can be overridden for testing.
Functions ¶
func AddUnits ¶
func AddUnits(st *state.State, svc *state.Service, n int, placement []*instance.Placement) ([]*state.Unit, error)
AddUnits starts n units of the given service using the specified placement directives to allocate the machines.
func DeployService ¶
func DeployService(st ServiceDeployer, args DeployServiceParams) (*state.Service, error)
DeployService takes a charm and various parameters and deploys it.
func InitJujuXDGDataHome ¶
func InitJujuXDGDataHome() error
InitJujuXDGDataHome initializes the charm cache, environs/config and utils/ssh packages to use default paths based on the $JUJU_DATA or $HOME environment variables. This function should be called before running a Juju CLI command.
func NewAPIConnection ¶
func NewAPIConnection(args NewAPIConnectionParams) (api.Connection, error)
NewAPIConnection returns an api.Connection to the specified Juju controller, with specified account credentials, optionally scoped to the specified model name.
func PrepareEndpointsForCaching ¶
func PrepareEndpointsForCaching( controllerDetails jujuclient.ControllerDetails, hostPorts [][]network.HostPort, addrConnectedTo ...network.HostPort, ) (addresses, hostnames []string, haveChanged bool)
PrepareEndpointsForCaching performs the necessary operations on the given API hostPorts so they are suitable for saving into the controller.yaml file, taking into account the addrConnectedTo and the existing config store info:
1. Collapses hostPorts into a single slice. 2. Filters out machine-local and link-local addresses. 3. Removes any duplicates 4. Call network.SortHostPorts() on the list. 5. Puts the addrConnectedTo on top. 6. Compares the result against info.APIEndpoint.Hostnames. 7. If the addresses differ, call network.ResolveOrDropHostnames() on the list and perform all steps again from step 1. 8. Compare the list of resolved addresses against the cached info APIEndpoint.Addresses, and if changed return both addresses and hostnames as strings (so they can be cached on APIEndpoint) and set haveChanged to true. 9. If the hostnames haven't changed, return two empty slices and set haveChanged to false. No DNS resolution is performed to save time.
This is used right after bootstrap to saved the initial API endpoints, as well as on each CLI connection to verify if the saved endpoints need updating.
func UpdateControllerAddresses ¶
func UpdateControllerAddresses( store jujuclient.ControllerStore, controllerName string, currentHostPorts [][]network.HostPort, addrConnectedTo ...network.HostPort, ) error
UpdateControllerAddresses writes any new api addresses to the client controller file. Controller may be specified by a UUID or name, and must already exist.
Types ¶
type DeployServiceParams ¶
type DeployServiceParams struct { ServiceName string Series string ServiceOwner string Charm *state.Charm Channel csparams.Channel ConfigSettings charm.Settings Constraints constraints.Value NumUnits int // Placement is a list of placement directives which may be used // instead of a machine spec. Placement []*instance.Placement Storage map[string]storage.Constraints EndpointBindings map[string]string // Resources is a map of resource name to IDs of pending resources. Resources map[string]string }
DeployServiceParams contains the arguments required to deploy the referenced charm.
type NewAPIConnectionParams ¶
type NewAPIConnectionParams struct { // ControllerName is the name of the controller to connect to. ControllerName string // Store is the jujuclient.ClientStore from which the controller's // details will be fetched, and updated on address changes. Store jujuclient.ClientStore // DialOpts contains the options used to dial the API connection. DialOpts api.DialOpts // BootstrapConfig returns the bootstrap configuration for the named // controller. BootstrapConfig func(controllerName string) (*config.Config, error) // AccountDetails contains the account details to use for logging // in to the Juju API. If this is nil, then no login will take // place. AccountDetails *jujuclient.AccountDetails // ModelUUID is an optional model UUID. If specified, the API connection // will be scoped to the model with that UUID; otherwise it will be // scoped to the controller. ModelUUID string }
NewAPIConnectionParams contains the parameters for creating a new Juju API connection.