From c25c92592a969f9028e7290e08406f35b51dd177 Mon Sep 17 00:00:00 2001 From: Griznah Date: Thu, 18 Jan 2024 13:13:55 +0100 Subject: [PATCH] added annotation for pod template --- controllers/application/deployment.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/application/deployment.go b/controllers/application/deployment.go index 10e2debb..4228c515 100644 --- a/controllers/application/deployment.go +++ b/controllers/application/deployment.go @@ -4,6 +4,8 @@ import ( "context" goerrors "errors" "fmt" + "strings" + "github.com/go-logr/logr" skiperatorv1alpha1 "github.com/kartverket/skiperator/api/v1alpha1" "github.com/kartverket/skiperator/pkg/resourcegenerator/core" @@ -22,7 +24,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "strings" ) const ( @@ -88,9 +89,13 @@ func (r *ApplicationReconciler) defineDeployment(ctx context.Context, applicatio podTemplateLabels = util.GetPodAppSelector(application.Name) } + // Add annotations to pod template, safe-to-evict added due to issues + // with cluster-autoscaler and unable to evict pods with local volumes + // https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md generatedSpecAnnotations := map[string]string{ - "argocd.argoproj.io/sync-options": "Prune=false", - "prometheus.io/scrape": "true", + "argocd.argoproj.io/sync-options": "Prune=false", + "prometheus.io/scrape": "true", + "cluster-autoscaler.kubernetes.io/safe-to-evict": "true", } // By specifying port and path annotations, Istio will scrape metrics from the application // and merge it together with its own metrics.