From 068f64e32f6ba931889df9d05bf7f54a2f8da150 Mon Sep 17 00:00:00 2001 From: "xin.li" Date: Thu, 26 May 2022 18:19:55 +0800 Subject: [PATCH] add livenes for karmada-scheduler Signed-off-by: xin.li --- artifacts/deploy/karmada-scheduler.yaml | 9 +++++++++ charts/templates/karmada_scheduler.yaml | 9 +++++++++ .../cmdinit/kubernetes/deployments.go | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/artifacts/deploy/karmada-scheduler.yaml b/artifacts/deploy/karmada-scheduler.yaml index 7eecc4b828b7..ca2e81d67f52 100644 --- a/artifacts/deploy/karmada-scheduler.yaml +++ b/artifacts/deploy/karmada-scheduler.yaml @@ -23,6 +23,15 @@ spec: - name: karmada-scheduler image: swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest imagePullPolicy: IfNotPresent + livenessProbe: + httpGet: + path: /healthz + port: 10351 + scheme: HTTP + failureThreshold: 3 + initialDelaySeconds: 15 + periodSeconds: 15 + timeoutSeconds: 5 command: - /bin/karmada-scheduler - --kubeconfig=/etc/kubeconfig diff --git a/charts/templates/karmada_scheduler.yaml b/charts/templates/karmada_scheduler.yaml index 06eb02889f35..bf6128c53f68 100644 --- a/charts/templates/karmada_scheduler.yaml +++ b/charts/templates/karmada_scheduler.yaml @@ -60,6 +60,15 @@ spec: - --bind-address=0.0.0.0 - --secure-port=10351 - --feature-gates=Failover=true + livenessProbe: + httpGet: + path: /healthz + port: 10351 + scheme: HTTP + failureThreshold: 3 + initialDelaySeconds: 15 + periodSeconds: 15 + timeoutSeconds: 5 volumeMounts: {{- include "karmada.kubeconfig.volumeMount" . | nindent 12 }} resources: diff --git a/pkg/karmadactl/cmdinit/kubernetes/deployments.go b/pkg/karmadactl/cmdinit/kubernetes/deployments.go index 0013d8cb97d6..084176ea4c12 100644 --- a/pkg/karmadactl/cmdinit/kubernetes/deployments.go +++ b/pkg/karmadactl/cmdinit/kubernetes/deployments.go @@ -360,6 +360,23 @@ func (i *CommandInitOption) makeKarmadaSchedulerDeployment() *appsv1.Deployment }, } + // Probes + livenesProbe := &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{ + Path: "/healthz", + Port: intstr.IntOrString{ + IntVal: 10351, + }, + Scheme: corev1.URISchemeHTTP, + }, + }, + InitialDelaySeconds: 15, + FailureThreshold: 3, + PeriodSeconds: 15, + TimeoutSeconds: 5, + } + podSpec := corev1.PodSpec{ Affinity: &corev1.Affinity{ PodAntiAffinity: &corev1.PodAntiAffinity{ @@ -394,6 +411,7 @@ func (i *CommandInitOption) makeKarmadaSchedulerDeployment() *appsv1.Deployment fmt.Sprintf("--leader-elect-resource-namespace=%s", i.Namespace), "--v=4", }, + LivenessProbe: livenesProbe, VolumeMounts: []corev1.VolumeMount{ { Name: kubeConfigSecretAndMountName,