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

package provider

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


Package Files

admissionregistration.go bootstrap.go builtin.go cloud.go config.go configmap.go constraints.go controller_upgrade.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 modeloperator.go modeloperator_upgrade.go namespaces.go operator.go operator_upgrade.go precheck.go provider.go providerconfig.go rbac.go resources.go secrets.go services.go statefulsets.go storage.go teardown.go template.go typehelper.go upgrade.go volume.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
const (
    EnvModelAgentCAASServiceName      = "SERVICE_NAME"
    EnvModelAgentCAASServiceNamespace = "SERVICE_NAMESPACE"
    EnvModelAgentHTTPPort             = "HTTP_PORT"
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 environscloudspec.CloudSpec) (*rest.Config, error)

CloudSpecToK8sRestConfig translates 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 ModelOperatorBroker Uses

type ModelOperatorBroker interface {
    // EnsureConfigMap ensures the supplied kubernetes config map exists in the
    // targeted cluster. Error returned if this action is not able to be
    // performed.
    EnsureConfigMap(*core.ConfigMap) error

    // EnsureDeployment ensures the supplied kubernetes deployment object exists
    // in the targeted cluster. Error returned if this action is not able to be
    // performed.
    EnsureDeployment(*apps.Deployment) error

    // EnsureService ensures the spplied kubernetes service object exists in the
    // targeted cluster. Error returned if the action is not able to be
    // performed.
    EnsureService(*core.Service) error

    // Namespace returns the current default namespace targeted by this broker.
    Namespace() string

ModelOperatorBroker defines a broker for Executing Kubernetes ensure commands. This interfaces is scoped down to the exact components needed by the ensure model operator routines.

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

type UpgradeCAASControllerBroker interface {
    // Client returns a Kubernetes client associated with the current broker's
    // cluster
    Client() kubernetes.Interface

    // Namespace returns the targeted Kubernetes namespace for this broker
    Namespace() string

UpgradeCAASControllerBroker describes the interface needed for upgrading Juju Kubernetes controllers

type UpgradeCAASModelOperatorBroker Uses

type UpgradeCAASModelOperatorBroker interface {
    // Client returns a Kubernetes client associated with the current broker's
    // cluster
    Client() kubernetes.Interface

    // Namespace returns the targeted Kubernetes namespace for this broker
    Namespace() string

type UpgradeCAASOperatorBroker Uses

type UpgradeCAASOperatorBroker interface {
    // Clock provides the clock to use with this broker for time operations
    Clock() clock.Clock

    // Client returns a Kubernetes client associated with the current broker's
    // cluster
    Client() kubernetes.Interface

    // Returns the deployment name use for the given application name, supports
    // finding legacy deployment names if set to True.
    DeploymentName(string, bool) string

    Namespace() string

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

    // OperatorName returns the operator name used for the operator deployment
    // for the supplied application.
    OperatorName(string) 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 91 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.