Skip to content

Commit

Permalink
fix: patchCluster not working on vsphere
Browse files Browse the repository at this point in the history
Signed-off-by: Hex Sattler <[email protected]>
  • Loading branch information
hexchen authored and prometherion committed Apr 22, 2024
1 parent b2de6d8 commit 16a0e2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions controllers/kamajicontrolplane_controller_cluster_patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 16a0e2d

Please sign in to comment.