Skip to content

Commit

Permalink
fix: change log verbosity + improve func readbility
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamir David authored and Tamir David committed Nov 5, 2024
1 parent 58463a4 commit 03de724
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"os"
"strings"

apierrors "k8s.io/apimachinery/pkg/api/errors"

"github.com/odigos-io/odigos/k8sutils/pkg/env"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -277,17 +279,15 @@ func main() {

func isMetricsServerInstalled(mgr ctrl.Manager, logger logr.Logger) bool {
var metricsServerDeployment appsv1.Deployment

// Use APIReader (uncached client) for direct access to the API server
// uses because mgr not cache the metrics-server deployment
err := mgr.GetAPIReader().Get(context.TODO(), types.NamespacedName{Name: "metrics-server", Namespace: "kube-system"}, &metricsServerDeployment)
if err != nil {
if client.IgnoreNotFound(err) != nil {
if apierrors.IsNotFound(err) {
logger.Info("Metrics-server deployment not found")
} else {
logger.Error(err, "Failed to get metrics-server deployment")
return false
}

logger.Error(err, "Metrics-server deployment not found")
return false
}

Expand Down

0 comments on commit 03de724

Please sign in to comment.