diff --git a/internal/controller/gardener_cluster_controller_test.go b/internal/controller/gardener_cluster_controller_test.go index 3a5f4531..702f42a9 100644 --- a/internal/controller/gardener_cluster_controller_test.go +++ b/internal/controller/gardener_cluster_controller_test.go @@ -16,7 +16,6 @@ import ( var _ = Describe("Gardener Cluster controller", func() { Context("Secret with kubeconfig doesn't exist", func() { It("Should create secret, and set Ready status on CR", func() { - Skip("Skipping for now, do not merge with this!") kymaName := "kymaname1" secretName := "secret-name1" shootName := "shootName1" @@ -57,7 +56,6 @@ var _ = Describe("Gardener Cluster controller", func() { }) It("Should delete secret", func() { - Skip("Skipping for now, do not merge with this!") kymaName := "kymaname2" secretName := "secret-name2" shootName := "shootName2" @@ -87,7 +85,6 @@ var _ = Describe("Gardener Cluster controller", func() { }) It("Should set Error status on CR if failed to fetch kubeconfig", func() { - Skip("Skipping for now, do not merge with this!") kymaName := "kymaname3" secretName := "secret-name3" shootName := "shootName3" @@ -112,7 +109,6 @@ var _ = Describe("Gardener Cluster controller", func() { Context("Secret with kubeconfig exists", func() { namespace := "default" DescribeTable("Should update secret", func(gardenerClusterCR imv1.GardenerCluster, secret corev1.Secret, expectedKubeconfig string) { - Skip("Skipping for now, do not merge with this!") By("Create kubeconfig secret") Expect(k8sClient.Create(context.Background(), &secret)).To(Succeed()) @@ -249,7 +245,8 @@ func fixSecretLabels(kymaName, shootName string) map[string]string { func fixGardenerClusterCR(kymaName, namespace, shootName, secretName string) imv1.GardenerCluster { return newTestGardenerClusterCR(kymaName, namespace, shootName, secretName). - WithLabels(fixGardenerClusterLabels(kymaName, shootName)).ToCluster() + WithLabels(fixGardenerClusterLabels(kymaName, shootName)). + ToCluster() } func fixGardenerClusterCRWithForceRotationAnnotation(kymaName, namespace, shootName, secretName string) imv1.GardenerCluster { diff --git a/internal/controller/metrics/metrics.go b/internal/controller/metrics/metrics.go index cea8ae51..405acda6 100644 --- a/internal/controller/metrics/metrics.go +++ b/internal/controller/metrics/metrics.go @@ -36,11 +36,13 @@ func (m Metrics) SetGardenerClusterStates(cluster v1.GardenerCluster) { var runtimeId = cluster.GetLabels()[runtimeIDLabel] if runtimeId != "" { - var reason = cluster.Status.Conditions[0].Reason + if len(cluster.Status.Conditions) != 0 { + var reason = cluster.Status.Conditions[0].Reason - // first clean the old metric - m.cleanUpGardenerClusterGauge(runtimeId) - m.gardenerClustersStateGaugeVec.WithLabelValues(runtimeId, string(cluster.Status.State), reason).Set(1) + // first clean the old metric + m.cleanUpGardenerClusterGauge(runtimeId) + m.gardenerClustersStateGaugeVec.WithLabelValues(runtimeId, string(cluster.Status.State), reason).Set(1) + } } }