Skip to content

Commit 3191a4a

Browse files
committed
fixup! refactor: Apply review feedback
1 parent a75a063 commit 3191a4a

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

.github/workflows/checks.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ jobs:
5959
matrix:
6060
provider:
6161
- Docker
62-
# Uncomment below once we have the ability to run e2e tests on AWS from GHA.
62+
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
6363
# - AWS
64+
# - Nutanix
6465
fail-fast: false
6566
uses: ./.github/workflows/e2e.yml
6667
with:
@@ -76,8 +77,9 @@ jobs:
7677
matrix:
7778
provider:
7879
- Docker
79-
# Uncomment below once we have the ability to run e2e tests on AWS from GHA.
80+
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
8081
# - AWS
82+
# - Nutanix
8183
fail-fast: false
8284
uses: ./.github/workflows/e2e.yml
8385
with:

test/e2e/clusterautoscaler_helpers.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ import (
1212
. "github.com/onsi/ginkgo/v2"
1313
. "github.com/onsi/gomega"
1414
appsv1 "k8s.io/api/apps/v1"
15-
corev1 "k8s.io/api/core/v1"
16-
"k8s.io/apimachinery/pkg/api/errors"
1715
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1816
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
1917
"sigs.k8s.io/cluster-api/test/framework"
20-
"sigs.k8s.io/controller-runtime/pkg/client"
2118

2219
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
20+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/utils"
2321
)
2422

2523
const clusterAutoscalerPrefix = "cluster-autoscaler-"
@@ -42,23 +40,17 @@ func WaitForClusterAutoscalerToBeReadyInWorkloadCluster(
4240
return
4341
}
4442

45-
// Only check for ClusterAutoscaler if the cluster is self-managed. Check this by checking if the kubeconfig
46-
// exists in the workload cluster itself.
43+
// Only check for ClusterAutoscaler if the cluster is self-managed.
44+
// ManagementCluster function will return a nil managementCluster if workloadClusterClient
45+
// is not a self-managed cluster.
4746
workloadClusterClient := input.ClusterProxy.GetWorkloadCluster(
4847
ctx, input.WorkloadCluster.Namespace, input.WorkloadCluster.Name,
4948
).GetClient()
50-
err := workloadClusterClient.Get(
51-
ctx,
52-
client.ObjectKey{
53-
Namespace: input.WorkloadCluster.Namespace,
54-
Name: input.WorkloadCluster.Name + "-kubeconfig",
55-
},
56-
&corev1.Secret{},
57-
)
58-
if err != nil && errors.IsNotFound(err) {
49+
managementCluster, err := utils.ManagementCluster(ctx, workloadClusterClient)
50+
Expect(err).NotTo(HaveOccurred())
51+
if managementCluster == nil {
5952
return
6053
}
61-
Expect(err).NotTo(HaveOccurred())
6254

6355
switch input.ClusterAutoscaler.Strategy {
6456
case v1alpha1.AddonStrategyClusterResourceSet:

0 commit comments

Comments
 (0)