Skip to content

Commit

Permalink
fixup! refactor: Apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Apr 26, 2024
1 parent a75a063 commit 3191a4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ jobs:
matrix:
provider:
- Docker
# Uncomment below once we have the ability to run e2e tests on AWS from GHA.
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
# - AWS
# - Nutanix
fail-fast: false
uses: ./.github/workflows/e2e.yml
with:
Expand All @@ -76,8 +77,9 @@ jobs:
matrix:
provider:
- Docker
# Uncomment below once we have the ability to run e2e tests on AWS from GHA.
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
# - AWS
# - Nutanix
fail-fast: false
uses: ./.github/workflows/e2e.yml
with:
Expand Down
22 changes: 7 additions & 15 deletions test/e2e/clusterautoscaler_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/utils"
)

const clusterAutoscalerPrefix = "cluster-autoscaler-"
Expand All @@ -42,23 +40,17 @@ func WaitForClusterAutoscalerToBeReadyInWorkloadCluster(
return
}

// Only check for ClusterAutoscaler if the cluster is self-managed. Check this by checking if the kubeconfig
// exists in the workload cluster itself.
// Only check for ClusterAutoscaler if the cluster is self-managed.
// ManagementCluster function will return a nil managementCluster if workloadClusterClient
// is not a self-managed cluster.
workloadClusterClient := input.ClusterProxy.GetWorkloadCluster(
ctx, input.WorkloadCluster.Namespace, input.WorkloadCluster.Name,
).GetClient()
err := workloadClusterClient.Get(
ctx,
client.ObjectKey{
Namespace: input.WorkloadCluster.Namespace,
Name: input.WorkloadCluster.Name + "-kubeconfig",
},
&corev1.Secret{},
)
if err != nil && errors.IsNotFound(err) {
managementCluster, err := utils.ManagementCluster(ctx, workloadClusterClient)
Expect(err).NotTo(HaveOccurred())
if managementCluster == nil {
return
}
Expect(err).NotTo(HaveOccurred())

switch input.ClusterAutoscaler.Strategy {
case v1alpha1.AddonStrategyClusterResourceSet:
Expand Down

0 comments on commit 3191a4a

Please sign in to comment.