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

package provider

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


Package Files

bootstrap.go builtin.go cloud.go config.go configmap.go constraints.go credentials.go customresourcedefinitions.go detectcloud.go dockerconfig.go errors.go events.go init.go k8s.go k8swatcher.go metadata.go namespaces.go operator.go precheck.go provider.go providerconfig.go rbac.go resources.go secrets.go storage.go template.go


const (
    CredAttrUsername              = "username"
    CredAttrPassword              = "password"
    CredAttrClientCertificateData = "ClientCertificateData"
    CredAttrClientKeyData         = "ClientKeyData"
    CredAttrToken                 = "Token"
const (
    // Container event reason list
    CreatedContainer        = "Created"
    StartedContainer        = "Started"
    FailedToCreateContainer = "Failed"
    FailedToStartContainer  = "Failed"
    KillingContainer        = "Killing"
    PreemptContainer        = "Preempting"
    BackOffStartContainer   = "BackOff"
    ExceededGracePeriod     = "ExceededGracePeriod"

    // Pod event reason list
    FailedToKillPod                = "FailedKillPod"
    FailedToCreatePodContainer     = "FailedCreatePodContainer"
    FailedToMakePodDataDirectories = "Failed"
    NetworkNotReady                = "NetworkNotReady"

    // Image event reason list
    PullingImage            = "Pulling"
    PulledImage             = "Pulled"
    FailedToPullImage       = "Failed"
    FailedToInspectImage    = "InspectFailed"
    ErrImageNeverPullPolicy = "ErrImageNeverPull"
    BackOffPullImage        = "BackOff"

Constants below are copied from "k8s.io/kubernetes/pkg/kubelet/events" to avoid introducing the huge dependency. Remove them once k8s.io/kubernetes added as a dependency.

const (

    // OperatorPodIPEnvName is the environment name for operator pod IP.
    OperatorPodIPEnvName = "JUJU_OPERATOR_POD_IP"

    // OperatorServiceIPEnvName is the environment name for operator service IP.
    OperatorServiceIPEnvName = "JUJU_OPERATOR_SERVICE_IP"

    // OperatorNamespaceEnvName is the environment name for k8s namespace the operator is in.
    OperatorNamespaceEnvName = "JUJU_OPERATOR_NAMESPACE"

    // JujuRunServerSocketPort is the port used by juju run callbacks.
    JujuRunServerSocketPort = 30666
const (
    WorkloadStorageKey = "workload-storage"
    OperatorStorageKey = "operator-storage"
const (
    // K8s_ProviderType defines the Juju storage type which can be used
    // to provision storage on k8s models.
    K8s_ProviderType = storage.ProviderType("kubernetes")

    // StorageClass is the name of a storage class resource.
    StorageClass = "storage-class"
const CAASProviderType = "kubernetes"
const (
    // JujuControllerStackName is the juju CAAS controller stack name.
    JujuControllerStackName = "controller"
const (
    ServiceTypeConfigKey = "kubernetes-service-type"


var (
    // TemplateFileNameServerPEM is the template server.pem file name.
    TemplateFileNameServerPEM = "template-" + mongo.FileNameDBSSLKey
    // TemplateFileNameAgentConf is the template agent.conf file name.
    TemplateFileNameAgentConf = "template-" + agent.AgentConfigFilename

func BaseKubeCloudOpenParams Uses

func BaseKubeCloudOpenParams(cloud cloud.Cloud, credential cloud.Credential) (environs.OpenParams, error)

BaseKubeCloudOpenParams provides a basic OpenParams for a cluster

func CloudFromKubeConfig Uses

func CloudFromKubeConfig(reader io.Reader, cloudParams KubeCloudParams) (cloud.Cloud, cloud.Credential, string, error)

CloudFromKubeConfig attempts to extract a cloud and credential details from the provided Kubeconfig.

func ConfigDefaults Uses

func ConfigDefaults() schema.Defaults

ConfigDefaults returns the default values for a kubernetes configuration.

func ConfigSchema Uses

func ConfigSchema() environschema.Fields

ConfigSchema returns the configuration schema for a kubernetes provider config.

func DecideControllerNamespace Uses

func DecideControllerNamespace(controllerName string) string

DecideControllerNamespace decides the namespace name to use for a new controller.

func IsClusterQueryError Uses

func IsClusterQueryError(err error) bool

IsClusterQueryError returns true if err is a ClusterQueryError.

func IsNoRecommendedStorageError Uses

func IsNoRecommendedStorageError(err error) bool

IsNoRecommendedStorageError returns true if err is a NoRecommendedStorageError

func IsUnknownClusterError Uses

func IsUnknownClusterError(err error) bool

IsUnknownClusterError returns true if err is a UnknownClusterError

func MaskError Uses

func MaskError(err error) bool

MaskError is used to signify that an error should not be reported back to the caller.

func UpdateKubeCloudWithStorage Uses

func UpdateKubeCloudWithStorage(k8sCloud *cloud.Cloud, storageParams KubeCloudStorageParams) (storageMsg string, err error)

UpdateKubeCloudWithStorage updates the passed Cloud with storage details retrieved from the clouds' cluster.

func ValidateStorageProvider Uses

func ValidateStorageProvider(providerType storage.ProviderType, attributes map[string]interface{}) error

ValidateStorageProvider returns an error if the storage type and config is not valid for a Kubernetes deployment.

type ClientConfigFuncGetter Uses

type ClientConfigFuncGetter func(string) (clientconfig.ClientConfigFunc, error)

ClientConfigFuncGetter returns a function returning az reader that will read a k8s cluster config for a given cluster type

type ClusterQueryError Uses

type ClusterQueryError struct {
    Message string

ClusterQueryError represents an issue when querying a cluster.

func (ClusterQueryError) Error Uses

func (e ClusterQueryError) Error() string

type CommandRunner Uses

type CommandRunner interface {
    RunCommands(run exec.RunParams) (*exec.ExecResponse, error)

CommandRunner allows to run commands on the underlying system

type DockerConfig Uses

type DockerConfig map[string]DockerConfigEntry

DockerConfig represents the config file used by the docker CLI.

type DockerConfigEntry Uses

type DockerConfigEntry struct {
    Username string
    Password string
    Email    string

DockerConfigEntry represents an Auth entry in the dockerconfigjson.

type DockerConfigJSON Uses

type DockerConfigJSON struct {
    Auths DockerConfig `json:"auths"`

DockerConfigJSON represents ~/.docker/config.json file info.

type GetClusterMetadataFunc Uses

type GetClusterMetadataFunc func(KubeCloudStorageParams) (*caas.ClusterMetadata, error)

GetClusterMetadataFunc returns the ClusterMetadata using the provided ClusterMetadataChecker

type KubeCloudParams Uses

type KubeCloudParams struct {
    ClusterName        string
    ContextName        string
    CaasName           string
    HostCloudRegion    string
    CaasType           string
    ClientConfigGetter ClientConfigFuncGetter

KubeCloudParams defines the parameters used to extract a k8s cluster definition from kubeconfig data.

type KubeCloudStorageParams Uses

type KubeCloudStorageParams struct {
    WorkloadStorage        string
    HostCloudRegion        string
    MetadataChecker        caas.ClusterMetadataChecker
    GetClusterMetadataFunc GetClusterMetadataFunc

KubeCloudStorageParams defines the parameters used to determine storage details for a k8s cluster.

type NewK8sClientFunc Uses

type NewK8sClientFunc func(c *rest.Config) (kubernetes.Interface, apiextensionsclientset.Interface, error)

NewK8sClientFunc defines a function which returns a k8s client based on the supplied config.

type NewK8sWatcherFunc Uses

type NewK8sWatcherFunc func(wi watch.Interface, name string, clock jujuclock.Clock) (*kubernetesWatcher, error)

NewK8sWatcherFunc defines a function which returns a k8s watcher based on the supplied config.

type NoRecommendedStorageError Uses

type NoRecommendedStorageError struct {
    Message      string
    ProviderName string

NoRecommendedStorageError represents when Juju is unable to determine which storage a cluster uses (or should use)

func (NoRecommendedStorageError) Error Uses

func (e NoRecommendedStorageError) Error() string

func (NoRecommendedStorageError) StorageProvider Uses

func (e NoRecommendedStorageError) StorageProvider() string

type RandomPrefixFunc Uses

type RandomPrefixFunc func() (string, error)

RandomPrefixFunc defines a function used to generate a random hex string.

type UnknownClusterError Uses

type UnknownClusterError struct {
    Message   string
    CloudName string

UnknownClusterError occurs when the provided cluster is not known to Juju.

func (UnknownClusterError) Error Uses

func (e UnknownClusterError) Error() string


exec/mocksPackage mocks is a generated GoMock package.
mocksPackage mocks is a generated GoMock package.
specs/mocksPackage mocks is a generated GoMock package.

Package provider imports 77 packages (graph) and is imported by 35 packages. Updated 2019-10-19. Refresh now. Tools for package owners.