provider

package
v2.25.0-beta.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Overview

Package provider contains abstract cloud provider types and interfaces.

Index

Constants

View Source
const (
	DefaultSSHPort     = 22
	DefaultKubeletPort = 10250

	DefaultKubeconfigFieldPath = "kubeconfig"
)
View Source
const (
	// DefaultSeedName is the name of the Seed resource that is used
	// in the Community Edition, which is limited to a single seed.
	DefaultSeedName = "kubermatic"
)

Variables

View Source
var (
	ErrNoKubermaticConfigurationFound      = errors.New("no KubermaticConfiguration resource found")
	ErrTooManyKubermaticConfigurationFound = errors.New("more than one KubermaticConfiguration resource found")
)

Functions

This section is empty.

Types

type CloudProvider

type CloudProvider interface {
	InitializeCloudProvider(context.Context, *kubermaticv1.Cluster, ClusterUpdater) (*kubermaticv1.Cluster, error)
	CleanUpCloudProvider(context.Context, *kubermaticv1.Cluster, ClusterUpdater) (*kubermaticv1.Cluster, error)
	DefaultCloudSpec(context.Context, *kubermaticv1.ClusterSpec) error
	ValidateCloudSpec(context.Context, kubermaticv1.CloudSpec) error
	ValidateCloudSpecUpdate(ctx context.Context, oldSpec kubermaticv1.CloudSpec, newSpec kubermaticv1.CloudSpec) error
}

CloudProvider declares a set of methods for interacting with a cloud provider.

type ClusterUpdater

type ClusterUpdater func(context.Context, string, func(*kubermaticv1.Cluster)) (*kubermaticv1.Cluster, error)

ClusterUpdater defines a function to persist an update to a cluster.

type ExternalClusterProvider

type ExternalClusterProvider interface {
	New(ctx context.Context, userInfo *UserInfo, project *kubermaticv1.Project, cluster *kubermaticv1.ExternalCluster) (*kubermaticv1.ExternalCluster, error)

	Get(ctx context.Context, userInfo *UserInfo, clusterName string) (*kubermaticv1.ExternalCluster, error)

	Delete(ctx context.Context, userInfo *UserInfo, cluster *kubermaticv1.ExternalCluster) error

	Update(ctx context.Context, userInfo *UserInfo, cluster *kubermaticv1.ExternalCluster) (*kubermaticv1.ExternalCluster, error)

	List(ctx context.Context, project *kubermaticv1.Project) (*kubermaticv1.ExternalClusterList, error)

	GenerateClient(cfg *clientcmdapi.Config) (ctrlruntimeclient.Client, error)

	GetClient(ctx context.Context, cluster *kubermaticv1.ExternalCluster) (ctrlruntimeclient.Client, error)

	ValidateKubeconfig(ctx context.Context, kubeconfig []byte) error

	CreateOrUpdateKubeconfigSecretForCluster(ctx context.Context, cluster *kubermaticv1.ExternalCluster, kubeconfig []byte, namespace string) error

	CreateOrUpdateCredentialSecretForCluster(ctx context.Context, cloud *apiv2.ExternalClusterCloudSpec, projectID, clusterID string) (*providerconfig.GlobalSecretKeySelector, error)

	CreateKubeOneClusterNamespace(ctx context.Context, externalCluster *kubermaticv1.ExternalCluster) error

	CreateOrUpdateKubeOneSSHSecret(ctx context.Context, sshKey apiv2.KubeOneSSHKey, externalCluster *kubermaticv1.ExternalCluster) error

	CreateOrUpdateKubeOneManifestSecret(ctx context.Context, manifest string, externalCluster *kubermaticv1.ExternalCluster) error

	CreateOrUpdateKubeOneCredentialSecret(ctx context.Context, cloud apiv2.KubeOneCloudSpec, externalCluster *kubermaticv1.ExternalCluster) error

	GetVersion(ctx context.Context, cluster *kubermaticv1.ExternalCluster) (*ksemver.Semver, error)

	VersionsEndpoint(ctx context.Context, configGetter KubermaticConfigurationGetter, providerType kubermaticv1.ExternalClusterProviderType) ([]apiv1.MasterVersion, error)

	ListNodes(ctx context.Context, cluster *kubermaticv1.ExternalCluster) (*corev1.NodeList, error)

	GetNode(ctx context.Context, cluster *kubermaticv1.ExternalCluster, nodeName string) (*corev1.Node, error)

	GetProviderPoolNodes(ctx context.Context, cluster *kubermaticv1.ExternalCluster, providerNodeLabel, providerNodePoolName string) ([]corev1.Node, error)

	IsMetricServerAvailable(ctx context.Context, cluster *kubermaticv1.ExternalCluster) (bool, error)
}

ExternalClusterProvider declares the set of methods for interacting with external cluster.

type KubermaticConfigurationGetter added in v2.19.0

type KubermaticConfigurationGetter = func(ctx context.Context) (*kubermaticv1.KubermaticConfiguration, error)

KubermaticConfigurationGetter is a function to retrieve the currently relevant KubermaticConfiguration. That is the one in the same namespace as the running application (e.g. the seed-controller-manager). It's an error if there are none or more than one KubermaticConfiguration objects in a single namespace.

type NodeCapacity added in v2.22.0

type NodeCapacity struct {
	CPUCores *resource.Quantity
	GPUs     *resource.Quantity
	Memory   *resource.Quantity
	Storage  *resource.Quantity
}

NodeCapacity represents the size of a cluster node in a Kubernetes cluster.

func NewNodeCapacity added in v2.22.0

func NewNodeCapacity() *NodeCapacity

func (*NodeCapacity) WithCPUCount added in v2.22.0

func (c *NodeCapacity) WithCPUCount(cpus int)

func (*NodeCapacity) WithGPUCount added in v2.22.0

func (c *NodeCapacity) WithGPUCount(gpus int)

func (*NodeCapacity) WithMemory added in v2.22.0

func (c *NodeCapacity) WithMemory(value int, unit string) error

func (*NodeCapacity) WithStorage added in v2.22.0

func (c *NodeCapacity) WithStorage(value int, unit string) error

type PrivilegedExternalClusterProvider

type PrivilegedExternalClusterProvider interface {
	// NewUnsecured creates an external cluster
	//
	// Note that this function:
	// is unsafe in a sense that it uses privileged account to create the resources
	NewUnsecured(ctx context.Context, project *kubermaticv1.Project, cluster *kubermaticv1.ExternalCluster) (*kubermaticv1.ExternalCluster, error)

	// DeleteUnsecured deletes an external cluster
	//
	// Note that this function:
	// is unsafe in a sense that it uses privileged account to delete the resources
	DeleteUnsecured(ctx context.Context, cluster *kubermaticv1.ExternalCluster) error

	// GetUnsecured gets an external cluster
	//
	// Note that this function:
	// is unsafe in a sense that it uses privileged account to get the resources
	GetUnsecured(ctx context.Context, clusterName string) (*kubermaticv1.ExternalCluster, error)

	// UpdateUnsecured updates an external cluster
	//
	// Note that this function:
	// is unsafe in a sense that it uses privileged account to update the resources
	UpdateUnsecured(ctx context.Context, cluster *kubermaticv1.ExternalCluster) (*kubermaticv1.ExternalCluster, error)

	// GetMasterClient returns master client
	//
	// Note that this function:
	// is unsafe in a sense that it uses privileged account to update the resources
	GetMasterClient() ctrlruntimeclient.Client
}

ExternalClusterProvider declares the set of methods for interacting with external cluster.

type ReconcilingCloudProvider added in v2.19.0

type ReconcilingCloudProvider interface {
	CloudProvider

	ReconcileCluster(context.Context, *kubermaticv1.Cluster, ClusterUpdater) (*kubermaticv1.Cluster, error)

	// Normally reconciling happens on a regular basis, but the interval between reconciliations can
	// be quite long if migrations/upgrades need to happen. A cloud provider can implement this to
	// decide based on the Cluster whether an immediate reconciliation is required. Cloud providers
	// should be careful and not blindly just "return true" here, as that would defeat the whole
	// "wait N minutes before doing expensive reconciliation" logic.
	ClusterNeedsReconciling(*kubermaticv1.Cluster) bool
}

ReconcilingCloudProvider is a cloud provider that can not just created resources once, but is capable of continuously reconciling and fixing any problems with them.

type SecretKeySelectorValueFunc

type SecretKeySelectorValueFunc func(configVar *providerconfig.GlobalSecretKeySelector, key string) (string, error)

SecretKeySelectorValueFunc is used to fetch the value of a config var. Do not build your own implementation, use SecretKeySelectorValueFuncFactory.

type SeedClientGetter

type SeedClientGetter = func(seed *kubermaticv1.Seed) (ctrlruntimeclient.Client, error)

SeedClientGetter is used to get a ctrlruntimeclient for a given seed.

type SeedGetter

type SeedGetter = func() (*kubermaticv1.Seed, error)

SeedGetter is a function to retrieve a single seed.

type SeedKubeconfigGetter

type SeedKubeconfigGetter = func(seed *kubermaticv1.Seed) (*rest.Config, error)

SeedKubeconfigGetter is used to fetch the kubeconfig for a given seed.

type SeedsGetter

type SeedsGetter = func() (map[string]*kubermaticv1.Seed, error)

SeedsGetter is a function to retrieve a list of seeds.

type UserInfo

type UserInfo struct {
	Email   string
	Groups  []string
	Roles   sets.Set[string]
	IsAdmin bool
}

UserInfo represent authenticated user.

Directories

Path Synopsis
aks
aws
Package aws contains the Amazon Web Services (AWS) cloud provider implementation.
Package aws contains the Amazon Web Services (AWS) cloud provider implementation.
aws/data
Package data is separate from the regular AWS provider package because it initializes a large chunk of data that might not be relevant to everyone using the AWS provider code.
Package data is separate from the regular AWS provider package because it initializes a large chunk of data that might not be relevant to everyone using the AWS provider code.
eks
gcp
gke

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL