Skip to content

Commit

Permalink
Update references usage across the code
Browse files Browse the repository at this point in the history
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
  • Loading branch information
Danil-Grigorev committed Nov 1, 2024
1 parent f2603d6 commit b03866f
Show file tree
Hide file tree
Showing 26 changed files with 76 additions and 76 deletions.
2 changes: 1 addition & 1 deletion bootstrap/util/configowner.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func getConfigOwner(ctx context.Context, c client.Client, obj metav1.Object, get

// GetOwnerByRef finds and returns the owner by looking at the object reference.
func GetOwnerByRef(ctx context.Context, c client.Client, ref *corev1.ObjectReference) (*ConfigOwner, error) {
obj, err := external.Get(ctx, c, ref, ref.Namespace)
obj, err := external.Get(ctx, c, ref)
if err != nil {
return nil, err
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/clusterctl/client/tree/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func Discovery(ctx context.Context, c client.Client, namespace, name string, opt
tree := NewObjectTree(cluster, options.toObjectTreeOptions())

// Adds cluster infra
clusterInfra, err := external.Get(ctx, c, cluster.Spec.InfrastructureRef, cluster.Namespace)
clusterInfra, err := external.Get(ctx, c, cluster.Spec.InfrastructureRef)
if err != nil {
return nil, errors.Wrap(err, "get InfraCluster reference from Cluster")
}
Expand All @@ -95,7 +95,7 @@ func Discovery(ctx context.Context, c client.Client, namespace, name string, opt
}

// Adds control plane
controlPlane, err := external.Get(ctx, c, cluster.Spec.ControlPlaneRef, cluster.Namespace)
controlPlane, err := external.Get(ctx, c, cluster.Spec.ControlPlaneRef)
if err == nil {
addControlPlane(cluster, controlPlane, tree, options)
}
Expand All @@ -112,13 +112,13 @@ func Discovery(ctx context.Context, c client.Client, namespace, name string, opt

if visible {
if (m.Spec.InfrastructureRef != corev1.ObjectReference{}) {
if machineInfra, err := external.Get(ctx, c, &m.Spec.InfrastructureRef, cluster.Namespace); err == nil {
if machineInfra, err := external.Get(ctx, c, &m.Spec.InfrastructureRef); err == nil {
tree.Add(m, machineInfra, ObjectMetaName("MachineInfrastructure"), NoEcho(true))
}
}

if m.Spec.Bootstrap.ConfigRef != nil {
if machineBootstrap, err := external.Get(ctx, c, m.Spec.Bootstrap.ConfigRef, cluster.Namespace); err == nil {
if machineBootstrap, err := external.Get(ctx, c, m.Spec.Bootstrap.ConfigRef); err == nil {
tree.Add(m, machineBootstrap, ObjectMetaName("BootstrapConfig"), NoEcho(true))
}
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func Discovery(ctx context.Context, c client.Client, namespace, name string, opt

if len(machinePoolList.Items) > 0 { // Add MachinePool objects
tree.Add(cluster, workers)
addMachinePoolsToObjectTree(ctx, c, cluster.Namespace, workers, machinePoolList, machinesList, tree, addMachineFunc)
addMachinePoolsToObjectTree(ctx, c, workers, machinePoolList, machinesList, tree, addMachineFunc)
}

// Handles orphan machines.
Expand Down Expand Up @@ -275,17 +275,17 @@ func addMachineDeploymentToObjectTree(ctx context.Context, c client.Client, clus
return nil
}

func addMachinePoolsToObjectTree(ctx context.Context, c client.Client, namespace string, workers *unstructured.Unstructured, machinePoolList *expv1.MachinePoolList, machinesList *clusterv1.MachineList, tree *ObjectTree, addMachineFunc func(parent client.Object, m *clusterv1.Machine)) {
func addMachinePoolsToObjectTree(ctx context.Context, c client.Client, workers *unstructured.Unstructured, machinePoolList *expv1.MachinePoolList, machinesList *clusterv1.MachineList, tree *ObjectTree, addMachineFunc func(parent client.Object, m *clusterv1.Machine)) {
for i := range machinePoolList.Items {
mp := &machinePoolList.Items[i]
_, visible := tree.Add(workers, mp, GroupingObject(true))

if visible {
if machinePoolBootstrap, err := external.Get(ctx, c, mp.Spec.Template.Spec.Bootstrap.ConfigRef, namespace); err == nil {
if machinePoolBootstrap, err := external.Get(ctx, c, mp.Spec.Template.Spec.Bootstrap.ConfigRef); err == nil {
tree.Add(mp, machinePoolBootstrap, ObjectMetaName("BootstrapConfig"), NoEcho(true))
}

if machinePoolInfra, err := external.Get(ctx, c, &mp.Spec.Template.Spec.InfrastructureRef, namespace); err == nil {
if machinePoolInfra, err := external.Get(ctx, c, &mp.Spec.Template.Spec.InfrastructureRef); err == nil {
tree.Add(mp, machinePoolInfra, ObjectMetaName("MachinePoolInfrastructure"), NoEcho(true))
}
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/external/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

// Get uses the client and reference to get an external, unstructured object.
func Get(ctx context.Context, c client.Reader, ref *corev1.ObjectReference, _ string) (*unstructured.Unstructured, error) {
func Get(ctx context.Context, c client.Reader, ref *corev1.ObjectReference) (*unstructured.Unstructured, error) {
if ref == nil {
return nil, errors.Errorf("cannot get object - object reference not set")
}
Expand Down Expand Up @@ -92,7 +92,7 @@ type CreateFromTemplateInput struct {

// CreateFromTemplate uses the client and the reference to create a new object from the template.
func CreateFromTemplate(ctx context.Context, in *CreateFromTemplateInput) (*corev1.ObjectReference, error) {
from, err := Get(ctx, in.Client, in.TemplateRef, in.Namespace)
from, err := Get(ctx, in.Client, in.TemplateRef)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/external/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestGetResourceFound(t *testing.T) {
}

fakeClient := fake.NewClientBuilder().WithObjects(testResource.DeepCopy()).Build()
got, err := Get(ctx, fakeClient, testResourceReference, metav1.NamespaceDefault)
got, err := Get(ctx, fakeClient, testResourceReference)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(got).To(BeComparableTo(testResource))
}
Expand All @@ -79,7 +79,7 @@ func TestGetResourceNotFound(t *testing.T) {
}

fakeClient := fake.NewClientBuilder().Build()
_, err := Get(ctx, fakeClient, testResourceReference, metav1.NamespaceDefault)
_, err := Get(ctx, fakeClient, testResourceReference)
g.Expect(err).To(HaveOccurred())
g.Expect(apierrors.IsNotFound(errors.Cause(err))).To(BeTrue())
}
Expand Down
2 changes: 1 addition & 1 deletion controlplane/kubeadm/internal/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (c *ControlPlane) UpToDateMachines() (collections.Machines, error) {
func getInfraResources(ctx context.Context, cl client.Client, machines collections.Machines) (map[string]*unstructured.Unstructured, error) {
result := map[string]*unstructured.Unstructured{}
for _, m := range machines {
infraObj, err := external.Get(ctx, cl, &m.Spec.InfrastructureRef, m.Namespace)
infraObj, err := external.Get(ctx, cl, &m.Spec.InfrastructureRef)
if err != nil {
if apierrors.IsNotFound(errors.Cause(err)) {
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ kubernetesVersion: metav1.16.1
machine := machineList.Items[0]
g.Expect(machine.Name).To(HavePrefix(kcp.Name))
// Newly cloned infra objects should have the infraref annotation.
infraObj, err := external.Get(ctx, r.Client, &machine.Spec.InfrastructureRef, machine.Spec.InfrastructureRef.Namespace)
infraObj, err := external.Get(ctx, r.Client, &machine.Spec.InfrastructureRef)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(infraObj.GetAnnotations()).To(HaveKeyWithValue(clusterv1.TemplateClonedFromNameAnnotation, genericInfrastructureMachineTemplate.GetName()))
g.Expect(infraObj.GetAnnotations()).To(HaveKeyWithValue(clusterv1.TemplateClonedFromGroupKindAnnotation, genericInfrastructureMachineTemplate.GroupVersionKind().GroupKind().String()))
Expand Down
2 changes: 1 addition & 1 deletion controlplane/kubeadm/internal/controllers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileExternalReference(ctx context.C
return err
}

obj, err := external.Get(ctx, r.Client, ref, controlPlane.Cluster.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
if apierrors.IsNotFound(err) {
controlPlane.InfraMachineTemplateIsNotFound = true
Expand Down
2 changes: 1 addition & 1 deletion controlplane/kubeadm/internal/controllers/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func TestCloneConfigsAndGenerateMachine(t *testing.T) {
g.Expect(m.Name).NotTo(BeEmpty())
g.Expect(m.Name).To(HavePrefix(kcp.Name + namingTemplateKey))

infraObj, err := external.Get(ctx, r.Client, &m.Spec.InfrastructureRef, m.Spec.InfrastructureRef.Namespace)
infraObj, err := external.Get(ctx, r.Client, &m.Spec.InfrastructureRef)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(infraObj.GetAnnotations()).To(HaveKeyWithValue(clusterv1.TemplateClonedFromNameAnnotation, genericInfrastructureMachineTemplate.GetName()))
g.Expect(infraObj.GetAnnotations()).To(HaveKeyWithValue(clusterv1.TemplateClonedFromGroupKindAnnotation, genericInfrastructureMachineTemplate.GroupVersionKind().GroupKind().String()))
Expand Down
4 changes: 2 additions & 2 deletions exp/internal/controllers/machinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ func (r *MachinePoolReconciler) reconcileDeleteExternal(ctx context.Context, mac
continue
}

obj, err := external.Get(ctx, r.Client, ref, machinePool.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil && !apierrors.IsNotFound(errors.Cause(err)) {
return false, errors.Wrapf(err, "failed to get %s %q for MachinePool %q in namespace %q",
ref.GroupVersionKind(), ref.Name, machinePool.Name, machinePool.Namespace)
ref.GroupVersionKind(), ref.Name, machinePool.Name, ref.Namespace)
}
if obj != nil {
objects = append(objects, obj)
Expand Down
4 changes: 2 additions & 2 deletions exp/internal/controllers/machinepool_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ func (r *MachinePoolReconciler) reconcileExternal(ctx context.Context, cluster *
return external.ReconcileOutput{}, err
}

obj, err := external.Get(ctx, r.Client, ref, m.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
if apierrors.IsNotFound(errors.Cause(err)) {
return external.ReconcileOutput{}, errors.Wrapf(err, "could not find %v %q for MachinePool %q in namespace %q, requeuing",
ref.GroupVersionKind(), ref.Name, m.Name, m.Namespace)
ref.GroupVersionKind(), ref.Name, m.Name, ref.Namespace)
}
return external.ReconcileOutput{}, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,7 @@ func TestReconcileMachinePoolMachines(t *testing.T) {
g.Expect(machineList.Items).To(HaveLen(2))
for i := range machineList.Items {
machine := &machineList.Items[i]
_, err := external.Get(ctx, r.Client, &machine.Spec.InfrastructureRef, machine.Namespace)
_, err := external.Get(ctx, r.Client, &machine.Spec.InfrastructureRef)
g.Expect(err).ToNot(HaveOccurred())
}
})
Expand Down Expand Up @@ -1539,7 +1539,7 @@ func TestReconcileMachinePoolMachines(t *testing.T) {
g.Expect(machineList.Items).To(HaveLen(2))
for i := range machineList.Items {
machine := &machineList.Items[i]
_, err := external.Get(ctx, r.Client, &machine.Spec.InfrastructureRef, machine.Namespace)
_, err := external.Get(ctx, r.Client, &machine.Spec.InfrastructureRef)
g.Expect(err).ToNot(HaveOccurred())
}
})
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/cluster/cluster_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (r *Reconciler) reconcileExternal(ctx context.Context, cluster *clusterv1.C
return nil, err
}

obj, err := external.Get(ctx, r.Client, ref, cluster.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions internal/controllers/clusterclass/clusterclass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,17 @@ func refString(ref *corev1.ObjectReference) string {
func (r *Reconciler) reconcileExternal(ctx context.Context, clusterClass *clusterv1.ClusterClass, ref *corev1.ObjectReference) error {
log := ctrl.LoggerFrom(ctx)

obj, err := external.Get(ctx, r.Client, ref, clusterClass.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
if apierrors.IsNotFound(errors.Cause(err)) {
return errors.Wrapf(err, "Could not find external object for the ClusterClass. refGroupVersionKind: %s, refName: %s", ref.GroupVersionKind(), ref.Name)
return errors.Wrapf(err, "Could not find external object for the ClusterClass. refGroupVersionKind: %s, refName: %s, refNamespace: %s", ref.GroupVersionKind(), ref.Name, ref.Namespace)
}
return errors.Wrapf(err, "failed to get the external object for the ClusterClass. refGroupVersionKind: %s, refName: %s", ref.GroupVersionKind(), ref.Name)
return errors.Wrapf(err, "failed to get the external object for the ClusterClass. refGroupVersionKind: %s, refName: %s, refNamespace: %s", ref.GroupVersionKind(), ref.Name, ref.Namespace)
}

// If referenced object is paused, return early.
if annotations.HasPaused(obj) {
log.V(3).Info("External object referenced is paused", "refGroupVersionKind", ref.GroupVersionKind(), "refName", ref.Name)
log.V(3).Info("External object referenced is paused", "refGroupVersionKind", ref.GroupVersionKind(), "refName", ref.Name, "refNamespace", ref.Namespace)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ func (r *Reconciler) isDeleteNodeAllowed(ctx context.Context, cluster *clusterv1
// controlPlaneRef is an optional field in the Cluster so skip the external
// managed control plane check if it is nil
if cluster.Spec.ControlPlaneRef != nil {
controlPlane, err := external.Get(ctx, r.Client, cluster.Spec.ControlPlaneRef, cluster.Spec.ControlPlaneRef.Namespace)
controlPlane, err := external.Get(ctx, r.Client, cluster.Spec.ControlPlaneRef)
if apierrors.IsNotFound(err) {
// If control plane object in the reference does not exist, log and skip check for
// external managed control plane
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/machine/machine_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (r *Reconciler) reconcileExternal(ctx context.Context, cluster *clusterv1.C
func (r *Reconciler) ensureExternalOwnershipAndWatch(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine, ref *corev1.ObjectReference) (*unstructured.Unstructured, error) {
log := ctrl.LoggerFrom(ctx)

obj, err := external.Get(ctx, r.Client, ref, m.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ func reconcileExternalTemplateReference(ctx context.Context, c client.Client, cl
return errors.New(err.Error())
}

obj, err := external.Get(ctx, c, ref, cluster.Namespace)
obj, err := external.Get(ctx, c, ref)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestMachineDeploymentReconciler(t *testing.T) {

t.Log("Verifying the linked infrastructure template has a cluster owner reference")
g.Eventually(func() bool {
obj, err := external.Get(ctx, env, &deployment.Spec.Template.Spec.InfrastructureRef, deployment.Namespace)
obj, err := external.Get(ctx, env, &deployment.Spec.Template.Spec.InfrastructureRef)
if err != nil {
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,15 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg
UID: t.Machine.UID,
}

from, err := external.Get(ctx, r.Client, m.Spec.RemediationTemplate, t.Machine.Namespace)
from, err := external.Get(ctx, r.Client, m.Spec.RemediationTemplate)
if err != nil {
conditions.MarkFalse(m, clusterv1.ExternalRemediationTemplateAvailableCondition, clusterv1.ExternalRemediationTemplateNotFoundReason, clusterv1.ConditionSeverityError, err.Error())

v1beta2conditions.Set(t.Machine, metav1.Condition{
Type: clusterv1.MachineExternallyRemediatedV1Beta2Condition,
Status: metav1.ConditionFalse,
Reason: clusterv1.MachineExternallyRemediatedRemediationTemplateNotFoundV1Beta2Reason,
Message: fmt.Sprintf("Error retrieving remediation template %s %s", m.Spec.RemediationTemplate.Kind, klog.KRef(t.Machine.Namespace, m.Spec.RemediationTemplate.Name)),
Message: fmt.Sprintf("Error retrieving remediation template %s %s", m.Spec.RemediationTemplate.Kind, klog.KRef(m.Spec.RemediationTemplate.Namespace, m.Spec.RemediationTemplate.Name)),
})
errList = append(errList, errors.Wrapf(err, "error retrieving remediation template %v %q for machine %q in namespace %q within cluster %q", m.Spec.RemediationTemplate.GroupVersionKind(), m.Spec.RemediationTemplate.Name, t.Machine.Name, t.Machine.Namespace, m.Spec.ClusterName))
return errList
Expand Down Expand Up @@ -691,7 +691,7 @@ func (r *Reconciler) getExternalRemediationRequest(ctx context.Context, m *clust
Name: machineName,
Namespace: m.Namespace,
}
remediationReq, err := external.Get(ctx, r.Client, remediationRef, m.Namespace)
remediationReq, err := external.Get(ctx, r.Client, remediationRef)
if err != nil {
return nil, errors.Wrapf(err, "failed to retrieve external remediation request object")
}
Expand Down
6 changes: 3 additions & 3 deletions internal/controllers/machineset/machineset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func (r *Reconciler) syncMachines(ctx context.Context, s *scope) (ctrl.Result, e
}
machines[i] = updatedMachine

infraMachine, err := external.Get(ctx, r.Client, &updatedMachine.Spec.InfrastructureRef, updatedMachine.Namespace)
infraMachine, err := external.Get(ctx, r.Client, &updatedMachine.Spec.InfrastructureRef)
if err != nil {
return ctrl.Result{}, errors.Wrapf(err, "failed to get InfrastructureMachine %s",
klog.KRef(updatedMachine.Spec.InfrastructureRef.Namespace, updatedMachine.Spec.InfrastructureRef.Name))
Expand All @@ -548,7 +548,7 @@ func (r *Reconciler) syncMachines(ctx context.Context, s *scope) (ctrl.Result, e
}

if updatedMachine.Spec.Bootstrap.ConfigRef != nil {
bootstrapConfig, err := external.Get(ctx, r.Client, updatedMachine.Spec.Bootstrap.ConfigRef, updatedMachine.Namespace)
bootstrapConfig, err := external.Get(ctx, r.Client, updatedMachine.Spec.Bootstrap.ConfigRef)
if err != nil {
return ctrl.Result{}, errors.Wrapf(err, "failed to get BootstrapConfig %s",
klog.KRef(updatedMachine.Spec.Bootstrap.ConfigRef.Namespace, updatedMachine.Spec.Bootstrap.ConfigRef.Name))
Expand Down Expand Up @@ -1328,7 +1328,7 @@ func (r *Reconciler) reconcileExternalTemplateReference(ctx context.Context, clu
return false, err
}

obj, err := external.Get(ctx, r.Client, ref, cluster.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
if apierrors.IsNotFound(err) {
if !ms.DeletionTimestamp.IsZero() {
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/machineset/machineset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestMachineSetReconciler(t *testing.T) {

t.Log("Verifying the linked bootstrap template has a cluster owner reference")
g.Eventually(func() bool {
obj, err := external.Get(ctx, env, instance.Spec.Template.Spec.Bootstrap.ConfigRef, instance.Namespace)
obj, err := external.Get(ctx, env, instance.Spec.Template.Spec.Bootstrap.ConfigRef)
if err != nil {
return false
}
Expand All @@ -240,7 +240,7 @@ func TestMachineSetReconciler(t *testing.T) {

t.Log("Verifying the linked infrastructure template has a cluster owner reference")
g.Eventually(func() bool {
obj, err := external.Get(ctx, env, &instance.Spec.Template.Spec.InfrastructureRef, instance.Namespace)
obj, err := external.Get(ctx, env, &instance.Spec.Template.Spec.InfrastructureRef)
if err != nil {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/machineset/machineset_preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (r *Reconciler) runPreflightChecks(ctx context.Context, cluster *clusterv1.
}

// Get the control plane object.
controlPlane, err := external.Get(ctx, r.Client, cluster.Spec.ControlPlaneRef, cluster.Namespace)
controlPlane, err := external.Get(ctx, r.Client, cluster.Spec.ControlPlaneRef)
if err != nil {
return ctrl.Result{}, "", errors.Wrapf(err, "failed to perform %q: failed to perform preflight checks: failed to get ControlPlane %s", action, klog.KRef(cluster.Spec.ControlPlaneRef.Namespace, cluster.Spec.ControlPlaneRef.Name))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/topology/cluster/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (r *Reconciler) getReference(ctx context.Context, ref *corev1.ObjectReferen
return nil, errors.New("reference is not set")
}

obj, err := external.Get(ctx, r.Client, ref, ref.Namespace)
obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
return nil, errors.Wrapf(err, "failed to retrieve %s %s", ref.Kind, klog.KRef(ref.Namespace, ref.Name))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/webhooks/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func (webhook *Cluster) validateTopologyVersion(ctx context.Context, fldPath *fi
}

func validateTopologyControlPlaneVersion(ctx context.Context, ctrlClient client.Reader, oldCluster *clusterv1.Cluster, oldVersion semver.Version) error {
cp, err := external.Get(ctx, ctrlClient, oldCluster.Spec.ControlPlaneRef, oldCluster.Namespace)
cp, err := external.Get(ctx, ctrlClient, oldCluster.Spec.ControlPlaneRef)
if err != nil {
return errors.Wrap(err, "failed to get ControlPlane object")
}
Expand Down
Loading

0 comments on commit b03866f

Please sign in to comment.