Skip to content

Commit

Permalink
chore: remove duplicate imports
Browse files Browse the repository at this point in the history
This PR fixes some spots where we were importing the same libraries
multiple times under different names.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
  • Loading branch information
rsmitty authored and talos-bot committed Jun 4, 2021
1 parent d7f4618 commit f7191a0
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions controllers/taloscontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
talosclient "github.com/talos-systems/talos/pkg/machinery/client"
talosconfig "github.com/talos-systems/talos/pkg/machinery/client/config"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -28,9 +27,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/utils/pointer"
"sigs.k8s.io/cluster-api/api/v1alpha3"
capiv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
"sigs.k8s.io/cluster-api/controllers/external"
capierrors "sigs.k8s.io/cluster-api/errors"
"sigs.k8s.io/cluster-api/util"
Expand Down Expand Up @@ -326,7 +323,7 @@ func (r *TalosControlPlaneReconciler) scaleDownControlPlane(ctx context.Context,

r.Log.Info("Found control plane machines", "machines", len(machines))

kubeconfigSecret := &v1.Secret{}
kubeconfigSecret := &corev1.Secret{}

err = r.Client.Get(ctx,
types.NamespacedName{
Expand Down Expand Up @@ -386,7 +383,7 @@ func (r *TalosControlPlaneReconciler) scaleDownControlPlane(ctx context.Context,
}

for _, addr := range node.Status.Addresses {
if addr.Type == v1.NodeInternalIP {
if addr.Type == corev1.NodeInternalIP {
address = addr.Address
break
}
Expand Down Expand Up @@ -555,7 +552,7 @@ func (r *TalosControlPlaneReconciler) bootControlPlane(ctx context.Context, clus
Name: names.SimpleNameGenerator.GenerateName(tcp.Name + "-"),
Namespace: tcp.Namespace,
Labels: map[string]string{
clusterv1.ClusterLabelName: cluster.ClusterName,
capiv1.ClusterLabelName: cluster.ClusterName,
capiv1.MachineControlPlaneLabelName: "",
},
OwnerReferences: []metav1.OwnerReference{
Expand Down Expand Up @@ -652,7 +649,7 @@ func (r *TalosControlPlaneReconciler) updateStatus(ctx context.Context, tcp *con
return nil
}

kubeconfigSecret := &v1.Secret{}
kubeconfigSecret := &corev1.Secret{}

err = r.Client.Get(ctx,
types.NamespacedName{
Expand Down Expand Up @@ -682,7 +679,7 @@ func (r *TalosControlPlaneReconciler) updateStatus(ctx context.Context, tcp *con

go func() {
e := func() error {
if v1alpha3.MachinePhase(ownedMachine.Status.Phase) == v1alpha3.MachinePhaseDeleting {
if capiv1.MachinePhase(ownedMachine.Status.Phase) == capiv1.MachinePhaseDeleting {
return fmt.Errorf("machine is deleting")
}

Expand Down Expand Up @@ -773,7 +770,7 @@ func (r *TalosControlPlaneReconciler) reconcileKubeconfig(ctx context.Context, c
return nil
}

func (r *TalosControlPlaneReconciler) addClusterOwnerToObj(ctx context.Context, ref v1.ObjectReference, cluster *capiv1.Cluster) error {
func (r *TalosControlPlaneReconciler) addClusterOwnerToObj(ctx context.Context, ref corev1.ObjectReference, cluster *capiv1.Cluster) error {
obj, err := external.Get(ctx, r.Client, &ref, cluster.Namespace)
if err != nil {
return err
Expand All @@ -785,7 +782,7 @@ func (r *TalosControlPlaneReconciler) addClusterOwnerToObj(ctx context.Context,
}

obj.SetOwnerReferences(util.EnsureOwnerRef(obj.GetOwnerReferences(), metav1.OwnerReference{
APIVersion: clusterv1.GroupVersion.String(),
APIVersion: capiv1.GroupVersion.String(),
Kind: "Cluster",
Name: cluster.Name,
UID: cluster.UID,
Expand Down

0 comments on commit f7191a0

Please sign in to comment.