From 16a0e2d0023ffa647ee530ba61aafdbe0c5af0cc Mon Sep 17 00:00:00 2001 From: Hex Sattler Date: Wed, 17 Apr 2024 18:13:17 +0000 Subject: [PATCH] fix: patchCluster not working on vsphere Signed-off-by: Hex Sattler --- controllers/kamajicontrolplane_controller_cluster_patch.go | 4 ++-- .../kamajicontrolplane_controller_cluster_patch_errors.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/kamajicontrolplane_controller_cluster_patch.go b/controllers/kamajicontrolplane_controller_cluster_patch.go index c9a8144..355e3bb 100644 --- a/controllers/kamajicontrolplane_controller_cluster_patch.go +++ b/controllers/kamajicontrolplane_controller_cluster_patch.go @@ -60,7 +60,7 @@ func (r *KamajiControlPlaneReconciler) patchCluster(ctx context.Context, cluster func (r *KamajiControlPlaneReconciler) checkOrPatchVSphereCluster(ctx context.Context, cluster capiv1beta1.Cluster, endpoint string, port int64) error { if err := r.checkGenericCluster(ctx, cluster, endpoint, port); err != nil { - if errors.Is(err, UnmanagedControlPlaneAddressError{}) { + if errors.As(err, &UnmanagedControlPlaneAddressError{}) { return r.patchGenericCluster(ctx, cluster, endpoint, port, false) } @@ -134,7 +134,7 @@ func (r *KamajiControlPlaneReconciler) checkGenericCluster(ctx context.Context, cpHost, cpPort := controlPlaneEndpoint["host"].(string), controlPlaneEndpoint["port"].(int64) //nolint:forcetypeassert if len(cpHost) == 0 && cpPort == 0 { - return NewUnmanagedControlPlaneAddressError(gkc.GetKind()) + return *NewUnmanagedControlPlaneAddressError(gkc.GetKind()) } if cpHost != endpoint { diff --git a/controllers/kamajicontrolplane_controller_cluster_patch_errors.go b/controllers/kamajicontrolplane_controller_cluster_patch_errors.go index 03fd46d..184f32e 100644 --- a/controllers/kamajicontrolplane_controller_cluster_patch_errors.go +++ b/controllers/kamajicontrolplane_controller_cluster_patch_errors.go @@ -16,5 +16,5 @@ func NewUnmanagedControlPlaneAddressError(kind string) *UnmanagedControlPlaneAdd } func (u UnmanagedControlPlaneAddressError) Error() string { - return fmt.Sprintf("the %s resource is not managaing directly the Control Plane address", u.Kind) + return fmt.Sprintf("the %s resource is not directly managing the Control Plane address", u.Kind) }