juju: github.com/juju/juju/caas Index | Files | Directories

package caas

import "github.com/juju/juju/caas"

Index

Package Files

broker.go config.go metadata.go operator.go scripts.go

Constants

const (
    // JujuExternalHostNameKey specifies the hostname of a CAAS application.
    JujuExternalHostNameKey = "juju-external-hostname"

    // JujuApplicationPath specifies the relative http path used to access a CAAS application.
    JujuApplicationPath = "juju-application-path"

    // JujuDefaultApplicationPath is the default value for juju-application-path.
    JujuDefaultApplicationPath = "/"
)
const (
    // K8sCloudMicrok8s is the name used for microk8s k8s clouds.
    K8sCloudMicrok8s = "microk8s"

    // K8sCloudGCE is the name used for GCE k8s clouds(GKE, CDK).
    K8sCloudGCE = "gce"

    // K8sCloudAzure is the name used for Azure k8s clouds(AKS, CDK).
    K8sCloudAzure = "azure"

    // K8sCloudEC2 is the name used for AWS k8s clouds(EKS, CDK).
    K8sCloudEC2 = "ec2"

    // K8sCloudOpenStack is the name used for openstack k8s clouds(CDK).
    K8sCloudOpenStack = "openstack"

    // K8sCloudMAAS is the name used for MAAS k8s clouds(CDK).
    K8sCloudMAAS = "maas"

    // K8sCloudLXD is the name used for LXD k8s clouds(Kubernetes Core).
    K8sCloudLXD = "lxd"

    // K8sCloudRackspace is the name used for Rackspace k8s clouds(CDK).
    K8sCloudRackspace = "rackspace"

    // K8sCloudOther is the name used for any other k8s cloud is not listed above.
    K8sCloudOther = "other"

    // Microk8sRegion is the single microk8s cloud region.
    Microk8sRegion = "localhost"

    // MicroK8sClusterName is the cluster named used by microk8s.
    MicroK8sClusterName = "microk8s-cluster"
)
const (
    // OperatorInfoFile is the file which contains certificate information for
    // the operator.
    OperatorInfoFile = "operator.yaml"

    // OperatorClientInfoFile is the file containing info about the operator,
    // copied to the workload pod so the hook tools and juju-run can function.
    OperatorClientInfoFile = "operator-client.yaml"

    // OperatorClientInfoCacheFile is a cache of OperatorClientInfoFile stored on the operator.
    OperatorClientInfoCacheFile = "operator-client-cache.yaml"

    // CACertFile is the file containing the cluster CA.
    CACertFile = "ca.crt"
)

Variables

var (
    JujudStartUpSh = "" /* 141 byte string literal not displayed */[1:]
)

func ConfigDefaults Uses

func ConfigDefaults(providerDefaults schema.Defaults) schema.Defaults

ConfigDefaults returns the default values for a CAAS application config.

func ConfigSchema Uses

func ConfigSchema(providerFields environschema.Fields) (environschema.Fields, error)

ConfigSchema returns the valid fields for a CAAS application config.

func IsNonPreferredStorageError Uses

func IsNonPreferredStorageError(err error) bool

IsNonPreferredStorageError returns true if err is a NonPreferredStorageError.

func RegisterContainerProvider Uses

func RegisterContainerProvider(name string, p ContainerEnvironProvider, alias ...string) (unregister func())

RegisterContainerProvider is used for providers that we want to use for managing 'instances', but are not possible sources for 'juju bootstrap'.

type Broker Uses

type Broker interface {
    // Provider returns the ContainerEnvironProvider that created this Broker.
    Provider() ContainerEnvironProvider

    // APIVersion returns the master kubelet API version.
    APIVersion() (string, error)

    // EnsureOperator creates or updates an operator pod for running
    // a charm for the specified application.
    EnsureOperator(appName, agentPath string, config *OperatorConfig) error

    // OperatorExists indicates if the operator for the specified
    // application exists, and whether the operator is terminating.
    OperatorExists(appName string) (OperatorState, error)

    // DeleteOperator deletes the specified operator.
    DeleteOperator(appName string) error

    // WatchUnits returns a watcher which notifies when there
    // are changes to units of the specified application.
    WatchUnits(appName string) (watcher.NotifyWatcher, error)

    // Units returns all units and any associated filesystems
    // of the specified application. Filesystems are mounted
    // via volumes bound to the unit.
    Units(appName string) ([]Unit, error)

    // WatchOperator returns a watcher which notifies when there
    // are changes to the operator of the specified application.
    WatchOperator(string) (watcher.NotifyWatcher, error)

    // WatchService returns a watcher which notifies when there
    // are changes to the deployment of the specified application.
    WatchService(appName string) (watcher.NotifyWatcher, error)

    // Operator returns an Operator with current status and life details.
    Operator(string) (*Operator, error)

    // ClusterMetadataChecker provides an API to query cluster metadata.
    ClusterMetadataChecker

    // NamespaceWatcher provides the API to watch caas namespace.
    NamespaceWatcher

    // InstancePrechecker provides a means of "prechecking" placement
    // arguments before recording them in state.
    environs.InstancePrechecker

    // BootstrapEnviron defines methods for bootstrapping a controller.
    environs.BootstrapEnviron

    // ResourceAdopter defines methods for adopting resources.
    environs.ResourceAdopter

    // NamespaceGetterSetter provides the API to get/set namespace.
    NamespaceGetterSetter

    // StorageValidator provides methods to validate storage.
    StorageValidator

    // ServiceGetterSetter provides the API to get/set service.
    ServiceGetterSetter

    // Upgrader provides the API to perform upgrades.
    Upgrader

    // ClusterVersionGetter provides methods to get cluster version information.
    ClusterVersionGetter
}

Broker instances interact with the CAAS substrate.

func New Uses

func New(args environs.OpenParams) (Broker, error)

New returns a new broker based on the provided configuration.

func Open Uses

func Open(p environs.EnvironProvider, args environs.OpenParams) (Broker, error)

Open creates a Broker instance and errors if the provider is not for a container substrate.

type CharmStorageParams Uses

type CharmStorageParams struct {
    // Size is the minimum size of the filesystem in MiB.
    Size uint64

    // The provider type for this filesystem.
    Provider storage.ProviderType

    // Attributes is a set of provider-specific options for storage creation,
    // as defined in a storage pool.
    Attributes map[string]interface{}

    // ResourceTags is a set of tags to set on the created filesystem, if the
    // storage provider supports tags.
    ResourceTags map[string]string
}

CharmStorageParams defines parameters used to create storage for operators to use for charm state.

type ClusterMetadata Uses

type ClusterMetadata struct {
    NominatedStorageClass *StorageProvisioner
    OperatorStorageClass  *StorageProvisioner
    Cloud                 string
    Regions               set.Strings
}

ClusterMetadata defines metadata about a cluster.

type ClusterMetadataChecker Uses

type ClusterMetadataChecker interface {
    // GetClusterMetadata returns metadata about host cloud and storage for the cluster.
    GetClusterMetadata(storageClass string) (result *ClusterMetadata, err error)

    // CheckDefaultWorkloadStorage returns an error if the opinionated storage defined for
    // the cluster does not match the specified storage.
    CheckDefaultWorkloadStorage(cluster string, storageProvisioner *StorageProvisioner) error

    // EnsureStorageProvisioner creates a storage provisioner with the specified config, or returns an existing one.
    EnsureStorageProvisioner(cfg StorageProvisioner) (*StorageProvisioner, error)
}

ClusterMetadataChecker provides an API to query cluster metadata.

type ClusterVersionGetter Uses

type ClusterVersionGetter interface {
    // Version returns cluster version information.
    Version() (*version.Number, error)
}

ClusterVersionGetter provides methods to get cluster version information.

type ContainerEnvironProvider Uses

type ContainerEnvironProvider interface {
    environs.EnvironProvider

    // Open opens the broker and returns it. The configuration must
    // have passed through PrepareConfig at some point in its lifecycle.
    //
    // Open should not perform any expensive operations, such as querying
    // the cloud API, as it will be called frequently.
    Open(args environs.OpenParams) (Broker, error)
}

ContainerEnvironProvider represents a computing and storage provider for a container runtime.

type DeploymentParams Uses

type DeploymentParams struct {
    DeploymentType DeploymentType
    ServiceType    ServiceType
}

DeploymentParams defines parameters for specifying how a service is deployed.

type DeploymentType Uses

type DeploymentType string

DeploymentType defines a deployment type.

const (
    DeploymentStateless DeploymentType = "stateless"
    DeploymentStateful  DeploymentType = "stateful"
    DeploymentDaemon    DeploymentType = "daemon"
)

type FilesystemInfo Uses

type FilesystemInfo struct {
    StorageName  string
    FilesystemId string
    Size         uint64
    MountPoint   string
    ReadOnly     bool
    Status       status.StatusInfo
    Volume       VolumeInfo
}

FilesystemInfo represents information about a filesystem mounted by a unit.

type NamespaceGetterSetter Uses

type NamespaceGetterSetter interface {
    // Namespaces returns name names of the namespaces on the cluster.
    Namespaces() ([]string, error)

    // GetNamespace returns the namespace for the specified name or current namespace.
    GetNamespace(name string) (*core.Namespace, error)

    // GetCurrentNamespace returns current namespace name.
    GetCurrentNamespace() string
}

NamespaceGetterSetter provides the API to get/set namespace.

type NamespaceWatcher Uses

type NamespaceWatcher interface {
    // WatchNamespace returns a watcher which notifies when there
    // are changes to current namespace.
    WatchNamespace() (watcher.NotifyWatcher, error)
}

NamespaceWatcher provides the API to watch caas namespace.

type NewContainerBrokerFunc Uses

type NewContainerBrokerFunc func(args environs.OpenParams) (Broker, error)

NewContainerBrokerFunc returns a Container Broker.

type NonPreferredStorageError Uses

type NonPreferredStorageError struct {
    PreferredStorage
}

NonPreferredStorageError is raised when a cluster does not have the opinionated default storage Juju requires.

func (*NonPreferredStorageError) Error Uses

func (e *NonPreferredStorageError) Error() string

Error implements error.

type Operator Uses

type Operator struct {
    Id     string
    Dying  bool
    Status status.StatusInfo
    Config *OperatorConfig
}

Operator represents information about the status of an "operator pod".

type OperatorClientInfo Uses

type OperatorClientInfo struct {
    ServiceAddress string `yaml:"service-address,omitempty"`
    Token          string `yaml:"token,omitempty"`
}

OperatorClientInfo contains information needed by CAAS tools.

func UnmarshalOperatorClientInfo Uses

func UnmarshalOperatorClientInfo(data []byte) (*OperatorClientInfo, error)

UnmarshalOperatorClientInfo parses OperatorClientInfo yaml data.

func (OperatorClientInfo) Marshal Uses

func (info OperatorClientInfo) Marshal() ([]byte, error)

Marshal OperatorClientInfo into yaml data.

type OperatorConfig Uses

type OperatorConfig struct {
    // OperatorImagePath is the docker registry URL for the image.
    OperatorImagePath string

    // Version is the Juju version of the operator image.
    Version version.Number

    // CharmStorage defines parameters used to create storage
    // for operators to use for charm state.
    CharmStorage CharmStorageParams

    // AgentConf is the contents of the agent.conf file.
    AgentConf []byte

    // OperatorInfo is the contents of the operator.yaml file.
    OperatorInfo []byte

    // ResourceTags is a set of tags to set on the operator pod.
    ResourceTags map[string]string
}

OperatorConfig is the config to use when creating an operator.

type OperatorInfo Uses

type OperatorInfo struct {
    CACert     string `yaml:"ca-cert,omitempty"`
    Cert       string `yaml:"cert,omitempty"`
    PrivateKey string `yaml:"private-key,omitempty"`
}

OperatorInfo contains information needed by CAAS operators

func UnmarshalOperatorInfo Uses

func UnmarshalOperatorInfo(data []byte) (*OperatorInfo, error)

UnmarshalOperatorInfo parses OperatorInfo yaml data.

func (OperatorInfo) Marshal Uses

func (info OperatorInfo) Marshal() ([]byte, error)

Marshal OperatorInfo into yaml data.

type OperatorState Uses

type OperatorState struct {
    // Exists is true if the operator exists in the cluster.
    Exists bool

    // Terminating is true if the operator is in Terminating state.
    Terminating bool
}

OperatorState is returned by the OperatorExists call.

type PreferredStorage Uses

type PreferredStorage struct {
    Name              string
    Provisioner       string
    Parameters        map[string]string
    VolumeBindingMode string
}

PreferredStorage defines preferred storage attributes on a given cluster.

type Service Uses

type Service struct {
    Id         string
    Addresses  network.ProviderAddresses
    Scale      *int
    Generation *int64
    Status     status.StatusInfo
}

Service represents information about the status of a caas service entity.

type ServiceGetterSetter Uses

type ServiceGetterSetter interface {
    // EnsureService creates or updates a service for pods with the given params.
    EnsureService(appName string, statusCallback StatusCallbackFunc, params *ServiceParams, numUnits int, config application.ConfigAttributes) error

    // DeleteService deletes the specified service with all related resources.
    DeleteService(appName string) error

    // ExposeService sets up external access to the specified service.
    ExposeService(appName string, resourceTags map[string]string, config application.ConfigAttributes) error

    // UnexposeService removes external access to the specified service.
    UnexposeService(appName string) error

    // GetService returns the service for the specified application.
    GetService(appName string, includeClusterIP bool) (*Service, error)
}

ServiceGetterSetter provides the API to get/set service.

type ServiceParams Uses

type ServiceParams struct {
    // Deployment defines how a service is deployed.
    Deployment DeploymentParams

    // PodSpec is the spec used to configure a pod.
    PodSpec *specs.PodSpec

    // ResourceTags is a set of tags to set on the created service.
    ResourceTags map[string]string

    // Constraints is a set of constraints on
    // the pod to create.
    Constraints constraints.Value

    // Filesystems is a set of parameters for filesystems that should be created.
    Filesystems []storage.KubernetesFilesystemParams

    // Devices is a set of parameters for Devices that is required.
    Devices []devices.KubernetesDeviceParams
}

ServiceParams defines parameters used to create a service.

type ServiceType Uses

type ServiceType string

ServiceType defines a service type.

const (
    ServiceCluster      ServiceType = "cluster"
    ServiceLoadBalancer ServiceType = "loadbalancer"
    ServiceExternal     ServiceType = "external"
    ServiceOmit         ServiceType = "omit"
)

func (ServiceType) IsOmit Uses

func (st ServiceType) IsOmit() bool

IsOmit indicates if a service is required.

type StatusCallbackFunc Uses

type StatusCallbackFunc func(appName string, settableStatus status.Status, info string, data map[string]interface{}) error

StatusCallbackFunc represents a function that can be called to report a status.

type StorageProvisioner Uses

type StorageProvisioner struct {
    Name              string
    Provisioner       string
    Parameters        map[string]string
    Namespace         string
    ReclaimPolicy     string
    VolumeBindingMode string
}

StorageProvisioner defines the a storage provisioner available on a cluster.

type StorageValidator Uses

type StorageValidator interface {
    // ValidateStorageClass returns an error if the storage config is not valid.
    ValidateStorageClass(config map[string]interface{}) error
}

StorageValidator provides methods to validate storage.

type Unit Uses

type Unit struct {
    Id             string
    Address        string
    Ports          []string
    Dying          bool
    Stateful       bool
    Status         status.StatusInfo
    FilesystemInfo []FilesystemInfo
}

Unit represents information about the status of a "pod".

type Upgrader Uses

type Upgrader interface {
    // Upgrade sets the OCI image for the app to the specified version.
    Upgrade(appName string, vers version.Number) error
}

Upgrader provides the API to perform upgrades.

type VolumeInfo Uses

type VolumeInfo struct {
    VolumeId   string
    Size       uint64
    Persistent bool
    Status     status.StatusInfo
}

VolumeInfo represents information about a volume mounted by a unit.

Directories

PathSynopsis
kubernetes/clientconfig
kubernetes/provider
kubernetes/provider/exec
kubernetes/provider/exec/mocksPackage mocks is a generated GoMock package.
kubernetes/provider/mocksPackage mocks is a generated GoMock package.
kubernetes/provider/specs
kubernetes/provider/specs/mocksPackage mocks is a generated GoMock package.
specs

Package caas imports 17 packages (graph) and is imported by 63 packages. Updated 2019-10-19. Refresh now. Tools for package owners.