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

package provider

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


Package Files

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


const (
    CredAttrUsername              = "username"
    CredAttrPassword              = "password"
    CredAttrClientCertificateData = "ClientCertificateData"
    CredAttrClientKeyData         = "ClientKeyData"
    CredAttrToken                 = "Token"

    RBACLabelKeyName = "rbac-id"
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 (
    // Domain is the primary TLD for juju when giving resource domains to
    // Kubernetes
    Domain = "juju.is"

    // InformerResyncPeriod is the default resync period set on IndexInformers
    InformerResyncPeriod = time.Minute * 5

    // 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 is the model config attribute used to specify
    // the storage class for provisioning workload storage.
    WorkloadStorageKey = "workload-storage"

    // OperatorStorageKey is the model config attribute used to specify
    // the storage class for provisioning operator 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 AppNameForServiceAccount Uses

func AppNameForServiceAccount(sa *core.ServiceAccount) (string, error)

AppNameForServiceAccount returns the juju application name associated with a given ServiceAccount. If app name cannot be obtained from the service account, errors.NotFound is returned.

func AppendLabels Uses

func AppendLabels(dest map[string]string, sources ...map[string]string) map[string]string

AppendLabels adds the labels defined in src to dest returning the result. Overlapping keys in sources maps are overwritten by the very last defined value for a duplicate key.

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, error)

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

func CloudSpecToK8sRestConfig Uses

func CloudSpecToK8sRestConfig(cloudSpec environs.CloudSpec) (*rest.Config, error)

CloudSpecToK8sRestConfig tranlates cloudspec to k8s rest config.

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 LabelsForApp Uses

func LabelsForApp(name string) map[string]string

LabelsForApp returns the labels that should be on a k8s object for a given application name

func LabelsForModel Uses

func LabelsForModel(name string) map[string]string

LabelsForModel returns the labels that should be on a k8s object for a given model name

func MakeK8sDomain Uses

func MakeK8sDomain(components ...string) string

MakeK8sDomain builds and returns a Kubernetes resource domain for the provided components. Func is idempotent

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 RBACLabels Uses

func RBACLabels(appName, model string, global bool) map[string]string

RBACLabels returns a set of labels that should be present for RBAC objects.

func RequireOperatorStorage Uses

func RequireOperatorStorage(charmMinJujuVersion version.Number) bool

RequireOperatorStorage returns true if the specified min-juju-version defined by a charm is such that the charm requires operator storage.

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 CRDGetterInterface Uses

type CRDGetterInterface interface {
    Get(string) (*apiextensionsv1beta1.CustomResourceDefinition, error)

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 K8sStringsWatcherFilterFunc Uses

type K8sStringsWatcherFilterFunc func(evt WatchEvent, obj interface{}) (string, bool)

type KubeCloudParams Uses

type KubeCloudParams struct {
    ClusterName string
    ContextName string
    CloudName   string
    // CredentialUID ensures RBAC resources are unique.
    CredentialUID      string
    HostCloudRegion    string
    CaasType           string
    ClientConfigGetter ClientConfigFuncGetter
    Clock              jujuclock.Clock

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 KubernetesNotifyWatcher Uses

type KubernetesNotifyWatcher interface {
    Changes() watcher.NotifyChannel

type KubernetesStringsWatcher Uses

type KubernetesStringsWatcher interface {
    Changes() watcher.StringsChannel

type NewK8sClientFunc Uses

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

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

type NewK8sStringsWatcherFunc Uses

type NewK8sStringsWatcherFunc func(
    informer cache.SharedIndexInformer,
    name string,
    clock jujuclock.Clock, initialEvents []string,
    filterFunc K8sStringsWatcherFilterFunc) (KubernetesStringsWatcher, error)

NewK8sStringsWatcherFunc defines a function which returns a k8s string watcher based on the supplied config

type NewK8sWatcherFunc Uses

type NewK8sWatcherFunc func(
    informer cache.SharedIndexInformer,
    name string,
    clock jujuclock.Clock) (KubernetesNotifyWatcher, 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

type WatchEvent Uses

type WatchEvent string
var (
    WatchEventAdd    WatchEvent = "add"
    WatchEventDelete WatchEvent = "delete"
    WatchEventUpdate WatchEvent = "update"


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 86 packages (graph) and is imported by 42 packages. Updated 2020-03-30. Refresh now. Tools for package owners.