From 75575777ac979cfbbf7196fd3f947b15e4346813 Mon Sep 17 00:00:00 2001 From: Kyle Squizzato Date: Thu, 5 Sep 2024 13:54:28 -0700 Subject: [PATCH] Modify CreateDeployment to CreateManagedCluster Signed-off-by: Kyle Squizzato --- test/e2e/e2e_test.go | 2 +- test/kubeclient/kubeclient.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 75f2e1ec2..0d3b748d3 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -146,7 +146,7 @@ var _ = Describe("controller", Ordered, func() { d := managedcluster.GetUnstructured(managedcluster.ProviderAWS, template) clusterName = d.GetName() - deleteFunc, err = kc.CreateDeployment(context.Background(), d) + deleteFunc, err = kc.CreateManagedCluster(context.Background(), d) Expect(err).NotTo(HaveOccurred()) By("waiting for infrastructure providers to deploy successfully") diff --git a/test/kubeclient/kubeclient.go b/test/kubeclient/kubeclient.go index bac6a2909..c1a4453c9 100644 --- a/test/kubeclient/kubeclient.go +++ b/test/kubeclient/kubeclient.go @@ -164,33 +164,33 @@ func (kc *KubeClient) GetDynamicClient(gvr schema.GroupVersionResource) (dynamic return client.Resource(gvr).Namespace(kc.Namespace), nil } -// CreateDeployment creates a deployment.hmc.mirantis.com in the given +// CreateDeployment creates a managedcluster.hmc.mirantis.com in the given // namespace and returns a DeleteFunc to clean up the deployment. // The DeleteFunc is a no-op if the deployment has already been deleted. -func (kc *KubeClient) CreateDeployment( - ctx context.Context, deployment *unstructured.Unstructured) (func() error, error) { - kind := deployment.GetKind() +func (kc *KubeClient) CreateManagedCluster( + ctx context.Context, managedcluster *unstructured.Unstructured) (func() error, error) { + kind := managedcluster.GetKind() - if kind != "Deployment" { - return nil, fmt.Errorf("expected kind Deployment, got: %s", kind) + if kind != "ManagedCluster" { + return nil, fmt.Errorf("expected kind ManagedCluster, got: %s", kind) } client, err := kc.GetDynamicClient(schema.GroupVersionResource{ Group: "hmc.mirantis.com", Version: "v1alpha1", - Resource: "deployments", + Resource: "managedclusters", }) if err != nil { return nil, fmt.Errorf("failed to get dynamic client: %w", err) } - _, err = client.Create(ctx, deployment, metav1.CreateOptions{}) + _, err = client.Create(ctx, managedcluster, metav1.CreateOptions{}) if err != nil { return nil, fmt.Errorf("failed to create Deployment: %w", err) } return func() error { - err := client.Delete(ctx, deployment.GetName(), metav1.DeleteOptions{}) + err := client.Delete(ctx, managedcluster.GetName(), metav1.DeleteOptions{}) if apierrors.IsNotFound(err) { return nil }