docker

package
v0.20.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMachineTemplate added in v0.13.0

func GetMachineTemplate(ctx context.Context, client kubernetes.Client, name, namespace string) (*dockerv1.DockerMachineTemplate, error)

GetMachineTemplate gets a DockerMachineTemplate object using the provided client If the object doesn't exist, it returns a NotFound error.

func MachineTemplateEqual added in v0.13.0

func MachineTemplateEqual(new, old *dockerv1.DockerMachineTemplate) bool

MachineTemplateEqual returns a boolean indicating whether or not the provided DockerMachineTemplates are equal.

func NeedsNewControlPlaneTemplate

func NeedsNewControlPlaneTemplate(oldSpec, newSpec *cluster.Spec) bool

NeedsNewControlPlaneTemplate determines if a new control plane template is needed.

func NeedsNewEtcdTemplate

func NeedsNewEtcdTemplate(oldSpec, newSpec *cluster.Spec) bool

NeedsNewEtcdTemplate determines if a new etcd template is needed.

func NeedsNewKubeadmConfigTemplate added in v0.9.0

func NeedsNewKubeadmConfigTemplate(newWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration, oldWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration) bool

NeedsNewKubeadmConfigTemplate determines if a new kubeadm config template is needed.

func NeedsNewWorkloadTemplate

func NeedsNewWorkloadTemplate(oldSpec, newSpec *cluster.Spec, oldWorker, newWorker v1alpha1.WorkerNodeGroupConfiguration) bool

NeedsNewWorkloadTemplate determines if a new workload template is needed.

func ValidateControlPlaneEndpoint added in v0.13.0

func ValidateControlPlaneEndpoint(clusterSpec *cluster.Spec) error

ValidateControlPlaneEndpoint - checks to see if endpoint host configuration is specified for docker cluster and returns an error if true.

Types

type ControlPlane added in v0.13.0

ControlPlane represents a CAPI Docker control plane.

func ControlPlaneSpec added in v0.13.0

func ControlPlaneSpec(ctx context.Context, logger logr.Logger, client kubernetes.Client, spec *cluster.Spec) (*ControlPlane, error)

ControlPlaneSpec builds a docker ControlPlane definition based on an eks-a cluster spec.

type DockerTemplateBuilder

type DockerTemplateBuilder struct {
	// contains filtered or unexported fields
}

DockerTemplateBuilder builds the docker templates.

func NewDockerTemplateBuilder

func NewDockerTemplateBuilder(now types.NowFunc) *DockerTemplateBuilder

NewDockerTemplateBuilder returns a docker template builder object.

func (*DockerTemplateBuilder) CAPIWorkersSpecWithInitialNames added in v0.13.0

func (d *DockerTemplateBuilder) CAPIWorkersSpecWithInitialNames(spec *cluster.Spec) (content []byte, err error)

CAPIWorkersSpecWithInitialNames generates a yaml spec with the CAPI objects representing the worker nodes for a particular eks-a cluster. It uses default initial names (ended in '-1') for the docker machine templates and kubeadm config templates.

func (*DockerTemplateBuilder) GenerateCAPISpecControlPlane added in v0.6.0

func (d *DockerTemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spec, buildOptions ...providers.BuildMapOption) (content []byte, err error)

GenerateCAPISpecControlPlane generates a yaml spec with the CAPI objects representing the control plane.

func (*DockerTemplateBuilder) GenerateCAPISpecWorkers added in v0.6.0

func (d *DockerTemplateBuilder) GenerateCAPISpecWorkers(clusterSpec *cluster.Spec, workloadTemplateNames, kubeadmconfigTemplateNames map[string]string) (content []byte, err error)

GenerateCAPISpecWorkers generates a yaml spec with the CAPI objects representing the worker nodes for a particular eks-a cluster.

type KubeconfigReader added in v0.19.0

type KubeconfigReader interface {
	GetClusterKubeconfig(ctx context.Context, clusterName, kubeconfigPath string) ([]byte, error)
}

KubeconfigReader reads the kubeconfig secret from the cluster.

type KubeconfigWriter added in v0.19.0

type KubeconfigWriter struct {
	// contains filtered or unexported fields
}

KubeconfigWriter reads the kubeconfig secret on a docker cluster and copies the contents to a writer.

func NewKubeconfigWriter added in v0.19.0

func NewKubeconfigWriter(docker ProviderClient, reader KubeconfigReader) KubeconfigWriter

NewKubeconfigWriter creates a KubeconfigWriter.

func (KubeconfigWriter) WriteKubeconfig added in v0.19.0

func (kr KubeconfigWriter) WriteKubeconfig(ctx context.Context, clusterName, kubeconfigPath string, w io.Writer) error

WriteKubeconfig retrieves the contents of the specified cluster's kubeconfig from a secret and copies it to an io.Writer.

func (KubeconfigWriter) WriteKubeconfigContent added in v0.19.0

func (kr KubeconfigWriter) WriteKubeconfigContent(ctx context.Context, clusterName string, content []byte, w io.Writer) error

WriteKubeconfigContent retrieves the contents of the specified cluster's kubeconfig from a secret and copies it to an io.Writer.

type Provider added in v0.19.0

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements providers.Provider for the docker cluster-api provider.

func NewProvider

func NewProvider(providerConfig *v1alpha1.DockerDatacenterConfig, docker ProviderClient, providerKubectlClient ProviderKubectlClient, now types.NowFunc) *Provider

NewProvider returns a new Provider.

func (*Provider) BootstrapClusterOpts added in v0.19.0

func (p *Provider) BootstrapClusterOpts(_ *cluster.Spec) ([]bootstrapper.BootstrapClusterOption, error)

BootstrapClusterOpts returns a list of options to be used when creating the bootstrap cluster.

func (*Provider) ChangeDiff added in v0.19.0

func (p *Provider) ChangeDiff(currentComponents, newComponents *cluster.ManagementComponents) *types.ComponentChangeDiff

ChangeDiff returns the component change diff for the provider.

func (*Provider) DatacenterConfig added in v0.19.0

func (p *Provider) DatacenterConfig(_ *cluster.Spec) providers.DatacenterConfig

DatacenterConfig returns the datacenter config for the provider.

func (*Provider) DatacenterResourceType added in v0.19.0

func (p *Provider) DatacenterResourceType() string

DatacenterResourceType returns the resource type for the dockerdatacenterconfigs.

func (*Provider) DeleteResources added in v0.19.0

func (p *Provider) DeleteResources(_ context.Context, _ *cluster.Spec) error

DeleteResources is a no-op. It implements providers.Provider.

func (*Provider) EnvMap added in v0.19.0

EnvMap returns a map of environment variables to be set when running the docker clusterctl command.

func (*Provider) GenerateCAPISpecForCreate added in v0.19.0

func (p *Provider) GenerateCAPISpecForCreate(ctx context.Context, _ *types.Cluster, clusterSpec *cluster.Spec) (controlPlaneSpec, workersSpec []byte, err error)

GenerateCAPISpecForCreate generates a yaml spec with the CAPI objects representing the control plane and worker nodes for a particular eks-a cluster.

func (*Provider) GenerateCAPISpecForUpgrade added in v0.19.0

func (p *Provider) GenerateCAPISpecForUpgrade(ctx context.Context, bootstrapCluster, workloadCluster *types.Cluster, currentSpec, newClusterSpec *cluster.Spec) (controlPlaneSpec, workersSpec []byte, err error)

GenerateCAPISpecForUpgrade generates a yaml spec with the CAPI objects representing the control plane and worker nodes for a particular eks-a cluster.

func (*Provider) GetDeployments added in v0.19.0

func (p *Provider) GetDeployments() map[string][]string

GetDeployments returns a map of namespaces to deployments that should be running for the provider.

func (*Provider) GetInfrastructureBundle added in v0.19.0

func (p *Provider) GetInfrastructureBundle(components *cluster.ManagementComponents) *types.InfrastructureBundle

GetInfrastructureBundle returns the infrastructure bundle for the provider.

func (*Provider) InstallCustomProviderComponents added in v0.19.0

func (p *Provider) InstallCustomProviderComponents(ctx context.Context, kubeconfigFile string) error

InstallCustomProviderComponents is a no-op. It implements providers.Provider.

func (*Provider) MachineConfigs added in v0.19.0

func (p *Provider) MachineConfigs(_ *cluster.Spec) []providers.MachineConfig

MachineConfigs is a no-op. It implements providers.Provider.

func (*Provider) MachineResourceType added in v0.19.0

func (p *Provider) MachineResourceType() string

MachineResourceType returns nothing because docker has no machines. It implements providers.Provider.

func (*Provider) Name added in v0.19.0

func (p *Provider) Name() string

Name returns the name of the provider.

func (*Provider) PostBootstrapDeleteForUpgrade added in v0.19.0

func (p *Provider) PostBootstrapDeleteForUpgrade(ctx context.Context, cluster *types.Cluster) error

PostBootstrapDeleteForUpgrade is a no-op. It implements providers.Provider.

func (*Provider) PostBootstrapSetup added in v0.19.0

func (p *Provider) PostBootstrapSetup(ctx context.Context, clusterConfig *v1alpha1.Cluster, cluster *types.Cluster) error

PostBootstrapSetup is a no-op. It implements providers.Provider.

func (*Provider) PostBootstrapSetupUpgrade added in v0.19.0

func (p *Provider) PostBootstrapSetupUpgrade(ctx context.Context, clusterConfig *v1alpha1.Cluster, cluster *types.Cluster) error

PostBootstrapSetupUpgrade is a no-op. It implements providers.Provider.

func (*Provider) PostClusterDeleteValidate added in v0.19.0

func (p *Provider) PostClusterDeleteValidate(_ context.Context, _ *types.Cluster) error

PostClusterDeleteValidate is a no-op. It implements providers.Provider.

func (*Provider) PostMoveManagementToBootstrap added in v0.19.0

func (p *Provider) PostMoveManagementToBootstrap(_ context.Context, _ *types.Cluster) error

PostMoveManagementToBootstrap is a no-op. It implements providers.Provider.

func (*Provider) PostWorkloadInit added in v0.19.0

func (p *Provider) PostWorkloadInit(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error

PostWorkloadInit is a no-op. It implements providers.Provider.

func (*Provider) PreCAPIInstallOnBootstrap added in v0.19.0

func (p *Provider) PreCAPIInstallOnBootstrap(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error

PreCAPIInstallOnBootstrap is a no-op. It implements providers.Provider.

func (*Provider) PreCoreComponentsUpgrade added in v0.19.0

func (p *Provider) PreCoreComponentsUpgrade(
	ctx context.Context,
	cluster *types.Cluster,
	managementComponents *cluster.ManagementComponents,
	clusterSpec *cluster.Spec,
) error

PreCoreComponentsUpgrade staisfies the Provider interface.

func (*Provider) RunPostControlPlaneCreation added in v0.19.0

func (p *Provider) RunPostControlPlaneCreation(ctx context.Context, clusterSpec *cluster.Spec, cluster *types.Cluster) error

RunPostControlPlaneCreation is a no-op. It implements providers.Provider.

func (*Provider) RunPostControlPlaneUpgrade added in v0.19.0

func (p *Provider) RunPostControlPlaneUpgrade(ctx context.Context, oldClusterSpec *cluster.Spec, clusterSpec *cluster.Spec, workloadCluster *types.Cluster, managementCluster *types.Cluster) error

RunPostControlPlaneUpgrade is a no-op. It implements providers.Provider.

func (*Provider) SetupAndValidateCreateCluster added in v0.19.0

func (p *Provider) SetupAndValidateCreateCluster(ctx context.Context, clusterSpec *cluster.Spec) error

SetupAndValidateCreateCluster validates the cluster spec and sets up any provider-specific resources.

func (*Provider) SetupAndValidateDeleteCluster added in v0.19.0

func (p *Provider) SetupAndValidateDeleteCluster(ctx context.Context, _ *types.Cluster, _ *cluster.Spec) error

SetupAndValidateDeleteCluster is a no-op. It implements providers.Provider.

func (*Provider) SetupAndValidateUpgradeCluster added in v0.19.0

func (p *Provider) SetupAndValidateUpgradeCluster(ctx context.Context, _ *types.Cluster, _ *cluster.Spec, _ *cluster.Spec) error

SetupAndValidateUpgradeCluster is a no-op. It implements providers.Provider.

func (*Provider) SetupAndValidateUpgradeManagementComponents added in v0.19.0

func (p *Provider) SetupAndValidateUpgradeManagementComponents(_ context.Context, _ *cluster.Spec) error

SetupAndValidateUpgradeManagementComponents performs necessary setup for upgrade management components operation.

func (*Provider) UpdateKubeConfig added in v0.19.0

func (p *Provider) UpdateKubeConfig(content *[]byte, clusterName string) error

UpdateKubeConfig updates the kubeconfig secret on a docker cluster.

func (*Provider) UpdateSecrets added in v0.19.0

func (p *Provider) UpdateSecrets(ctx context.Context, cluster *types.Cluster, _ *cluster.Spec) error

UpdateSecrets is a no-op. It implements providers.Provider.

func (*Provider) UpgradeNeeded added in v0.19.0

func (p *Provider) UpgradeNeeded(_ context.Context, _, _ *cluster.Spec, _ *types.Cluster) (bool, error)

UpgradeNeeded is a no-op. It implements providers.Provider.

func (*Provider) ValidateNewSpec added in v0.19.0

func (p *Provider) ValidateNewSpec(_ context.Context, _ *types.Cluster, _ *cluster.Spec) error

ValidateNewSpec is a no-op. It implements providers.Provider.

func (*Provider) Version added in v0.19.0

func (p *Provider) Version(components *cluster.ManagementComponents) string

Version returns the version of the provider.

type ProviderClient

type ProviderClient interface {
	GetDockerLBPort(ctx context.Context, clusterName string) (port string, err error)
}

type ProviderKubectlClient

type ProviderKubectlClient interface {
	GetEksaCluster(ctx context.Context, cluster *types.Cluster, clusterName string) (*v1alpha1.Cluster, error)
	GetMachineDeployment(ctx context.Context, machineDeploymentName string, opts ...executables.KubectlOpt) (*clusterv1.MachineDeployment, error)
	GetKubeadmControlPlane(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*controlplanev1.KubeadmControlPlane, error)
	GetEtcdadmCluster(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*etcdv1.EtcdadmCluster, error)
	UpdateAnnotation(ctx context.Context, resourceType, objectName string, annotations map[string]string, opts ...executables.KubectlOpt) error
}

type Workers added in v0.13.0

Workers represents the docker specific CAPI spec for worker nodes.

func WorkersSpec added in v0.13.0

func WorkersSpec(ctx context.Context, logger logr.Logger, client kubernetes.Client, spec *cluster.Spec) (*Workers, error)

WorkersSpec generates a Docker specific CAPI spec for an eks-a cluster worker nodes. It talks to the cluster with a client to detect changes in immutable objects and generates new names for them.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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