From 0523c8dee9ea69a6e75341bcc489936a1556f193 Mon Sep 17 00:00:00 2001 From: Richard Draycott Date: Thu, 13 Jun 2024 15:50:33 +0100 Subject: [PATCH] :sparkles: Fix vendoring and lint issues --- cmd/clusterctl/client/alpha/controlplane.go | 3 +-- cmd/clusterctl/client/alpha/rollout.go | 7 +------ cmd/clusterctl/client/alpha/rollout_restarter.go | 4 ---- cmd/clusterctl/cmd/rollout/restart.go | 1 - go.mod | 2 +- 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/cmd/clusterctl/client/alpha/controlplane.go b/cmd/clusterctl/client/alpha/controlplane.go index e14663c4c520..de688f2f9e3a 100644 --- a/cmd/clusterctl/client/alpha/controlplane.go +++ b/cmd/clusterctl/client/alpha/controlplane.go @@ -152,7 +152,7 @@ func resourceHasRolloutAfter(proxy cluster.Proxy, ref corev1.ObjectReference) (b return false, err } - //Fetch the OpenAPI schema + // Fetch the OpenAPI schema openAPISchema, err := discoveryClient.OpenAPISchema() if err != nil { return false, err @@ -174,7 +174,6 @@ func resourceHasRolloutAfter(proxy cluster.Proxy, ref corev1.ObjectReference) (b if findSpecPropertyForResource(definition, resourceDefName, "rolloutAfter") { return true, nil } - } return false, fmt.Errorf("resource definition for %s.%s.%s not found", "io.x-k8s.cluster.controlplane", ref.APIVersion, ref.Kind) diff --git a/cmd/clusterctl/client/alpha/rollout.go b/cmd/clusterctl/client/alpha/rollout.go index 8e718ebdacec..4fb66593f36f 100644 --- a/cmd/clusterctl/client/alpha/rollout.go +++ b/cmd/clusterctl/client/alpha/rollout.go @@ -29,15 +29,10 @@ const ( MachineDeployment = "machinedeployment" // KubeadmControlPlane is a resource type. KubeadmControlPlane = "kubeadmcontrolplane" - // DefaultAPIVersion is what clusterctl will assume if none is provided + // DefaultAPIVersion is what clusterctl will assume if none is provided. DefaultAPIVersion = "v1beta1" ) -var validResourceTypes = []string{ - MachineDeployment, - KubeadmControlPlane, -} - var validRollbackResourceTypes = []string{ MachineDeployment, } diff --git a/cmd/clusterctl/client/alpha/rollout_restarter.go b/cmd/clusterctl/client/alpha/rollout_restarter.go index 25b6e42a9a7e..e1eacd5e97c2 100644 --- a/cmd/clusterctl/client/alpha/rollout_restarter.go +++ b/cmd/clusterctl/client/alpha/rollout_restarter.go @@ -59,16 +59,12 @@ func (r *rollout) ObjectRestarter(ctx context.Context, proxy cluster.Proxy, ref } if err := checkControlPlaneRolloutAfter(obj); err != nil { - // if _, ok := err.(*errRolloutAfterNotFound); ok { - // return errors.Errorf("Invalid resource type %v. Resource must implement rolloutAfter in it's spec", ref.Kind) - // } return errors.Errorf("err: %s, can't update ControlPlane (remove 'spec.rolloutAfter' first): %v/%v", err.Error(), ref.Kind, ref.Name) } if err := setRolloutAfterOnControlPlane(ctx, proxy, ref); err != nil { return err } - } return nil } diff --git a/cmd/clusterctl/cmd/rollout/restart.go b/cmd/clusterctl/cmd/rollout/restart.go index 7e062bb33a3b..b582c6c46411 100644 --- a/cmd/clusterctl/cmd/rollout/restart.go +++ b/cmd/clusterctl/cmd/rollout/restart.go @@ -31,7 +31,6 @@ type restartOptions struct { kubeconfigContext string resources []string namespace string - apiVersion string } var restartOpt = &restartOptions{} diff --git a/go.mod b/go.mod index 40682af35cd9..8200d8188bd1 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/flatcar/ignition v0.36.2 github.com/go-logr/logr v1.4.1 github.com/gobuffalo/flect v1.0.2 + github.com/google/gnostic-models v0.6.8 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v53 v53.2.0 github.com/google/gofuzz v1.2.0 @@ -89,7 +90,6 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.0.1 // indirect github.com/google/cel-go v0.17.8 // indirect - github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect