Skip to content

Commit

Permalink
move capd packages to internal
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Dec 6, 2021
1 parent 008f1e7 commit f6f9b3b
Show file tree
Hide file tree
Showing 24 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1beta1"
utilexp "sigs.k8s.io/cluster-api/exp/util"
infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/docker"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/internal/docker"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/patch"
"sigs.k8s.io/cluster-api/util/predicates"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
corev1 "k8s.io/api/core/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/docker"
infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/docker"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/container"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/docker"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/docker"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/cluster-api/util/patch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/docker"
docker2 "sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/docker"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/annotations"
"sigs.k8s.io/cluster-api/util/conditions"
Expand Down Expand Up @@ -138,7 +138,7 @@ func (r *DockerMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}

// Create a helper for managing the docker container hosting the machine.
externalMachine, err := docker.NewMachine(cluster, machine.Name, dockerMachine.Spec.CustomImage, nil)
externalMachine, err := docker2.NewMachine(cluster, machine.Name, dockerMachine.Spec.CustomImage, nil)
if err != nil {
return ctrl.Result{}, errors.Wrapf(err, "failed to create helper for managing the externalMachine")
}
Expand All @@ -147,7 +147,7 @@ func (r *DockerMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
// NB. the machine controller has to manage the cluster load balancer because the current implementation of the
// docker load balancer does not support auto-discovery of control plane nodes, so CAPD should take care of
// updating the cluster load balancer configuration when control plane machines are added/removed
externalLoadBalancer, err := docker.NewLoadBalancer(cluster, dockerCluster)
externalLoadBalancer, err := docker2.NewLoadBalancer(cluster, dockerCluster)
if err != nil {
return ctrl.Result{}, errors.Wrapf(err, "failed to create helper for managing the externalLoadBalancer")
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func patchDockerMachine(ctx context.Context, patchHelper *patch.Helper, dockerMa
)
}

func (r *DockerMachineReconciler) reconcileNormal(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine, dockerMachine *infrav1.DockerMachine, externalMachine *docker.Machine, externalLoadBalancer *docker.LoadBalancer) (res ctrl.Result, retErr error) {
func (r *DockerMachineReconciler) reconcileNormal(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine, dockerMachine *infrav1.DockerMachine, externalMachine *docker2.Machine, externalLoadBalancer *docker2.LoadBalancer) (res ctrl.Result, retErr error) {
log := ctrl.LoggerFrom(ctx)

// if the machine is already provisioned, return
Expand Down Expand Up @@ -304,7 +304,7 @@ func (r *DockerMachineReconciler) reconcileNormal(ctx context.Context, cluster *
// Requeue if there is an error, as this is likely momentary load balancer
// state changes during control plane provisioning.
if err := externalMachine.SetNodeProviderID(ctx); err != nil {
if errors.As(err, &docker.ContainerNotRunningError{}) {
if errors.As(err, &docker2.ContainerNotRunningError{}) {
return ctrl.Result{}, errors.Wrap(err, "failed to patch the Kubernetes node with the machine providerID")
}
log.Error(err, "failed to patch the Kubernetes node with the machine providerID")
Expand All @@ -319,7 +319,7 @@ func (r *DockerMachineReconciler) reconcileNormal(ctx context.Context, cluster *
return ctrl.Result{}, nil
}

func (r *DockerMachineReconciler) reconcileDelete(ctx context.Context, machine *clusterv1.Machine, dockerMachine *infrav1.DockerMachine, externalMachine *docker.Machine, externalLoadBalancer *docker.LoadBalancer) (ctrl.Result, error) {
func (r *DockerMachineReconciler) reconcileDelete(ctx context.Context, machine *clusterv1.Machine, dockerMachine *infrav1.DockerMachine, externalMachine *docker2.Machine, externalLoadBalancer *docker2.LoadBalancer) (ctrl.Result, error) {
// Set the ContainerProvisionedCondition reporting delete is started, and issue a patch in order to make
// this visible to the users.
// NB. The operation in docker is fast, so there is the chance the user will not notice the status change;
Expand Down Expand Up @@ -433,7 +433,7 @@ func (r *DockerMachineReconciler) getBootstrapData(ctx context.Context, machine
}

// setMachineAddress gets the address from the container corresponding to a docker node and sets it on the Machine object.
func setMachineAddress(ctx context.Context, dockerMachine *infrav1.DockerMachine, externalMachine *docker.Machine) error {
func setMachineAddress(ctx context.Context, dockerMachine *infrav1.DockerMachine, externalMachine *docker2.Machine) error {
machineAddress, err := externalMachine.Address(ctx)
if err != nil {
return err
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/pkg/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/container"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/docker/types"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/docker/types"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/kind/pkg/apis/config/v1alpha4"
"sigs.k8s.io/kind/pkg/cluster/constants"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/container"
infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/docker/types"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/third_party/forked/loadbalancer"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/docker/types"
loadbalancer2 "sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/third_party/forked/loadbalancer"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/kind/pkg/cluster/constants"
)
Expand Down Expand Up @@ -82,9 +82,9 @@ func NewLoadBalancer(cluster *clusterv1.Cluster, dockerCluster *infrav1.DockerCl
// the load balancer.
func getLoadBalancerImage(dockerCluster *infrav1.DockerCluster) string {
// Check if a non-default image was provided
image := loadbalancer.Image
imageRepo := loadbalancer.DefaultImageRepository
imageTag := loadbalancer.DefaultImageTag
image := loadbalancer2.Image
imageRepo := loadbalancer2.DefaultImageRepository
imageTag := loadbalancer2.DefaultImageTag

if dockerCluster != nil {
if dockerCluster.Spec.LoadBalancer.ImageRepository != "" {
Expand Down Expand Up @@ -164,7 +164,7 @@ func (s *LoadBalancer) UpdateConfiguration(ctx context.Context) error {
}
}

loadBalancerConfig, err := loadbalancer.Config(&loadbalancer.ConfigData{
loadBalancerConfig, err := loadbalancer2.Config(&loadbalancer2.ConfigData{
ControlPlanePort: 6443,
BackendServers: backendServers,
IPv6: s.ipFamily == clusterv1.IPv6IPFamily,
Expand All @@ -174,7 +174,7 @@ func (s *LoadBalancer) UpdateConfiguration(ctx context.Context) error {
}

log.Info("Updating load balancer configuration")
if err := s.container.WriteFile(ctx, loadbalancer.ConfigPath, loadBalancerConfig); err != nil {
if err := s.container.WriteFile(ctx, loadbalancer2.ConfigPath, loadBalancerConfig); err != nil {
return errors.WithStack(err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/container"
infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/cloudinit"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/docker/types"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/cloudinit"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/docker/types"
clusterapicontainer "sigs.k8s.io/cluster-api/util/container"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/kind/pkg/apis/config/v1alpha4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/pkg/errors"
"sigs.k8s.io/cluster-api/test/infrastructure/container"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/docker/types"
"sigs.k8s.io/cluster-api/test/infrastructure/docker/internal/docker/types"
)

const clusterLabelKey = "io.x-k8s.kind.cluster"
Expand Down

0 comments on commit f6f9b3b

Please sign in to comment.