Răsfoiți Sursa

Do not specify successThreshold, from MSFT : defaults to 1 and cannot be changed, related to Kube healthchecks: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#probe-v1-core

Signed-off-by: Guillaume Tardif <[email protected]>
Guillaume Tardif 5 ani în urmă
părinte
comite
3d18eda869
2 a modificat fișierele cu 4 adăugiri și 5 ștergeri
  1. 2 3
      aci/convert/convert.go
  2. 2 2
      aci/convert/convert_test.go

+ 2 - 3
aci/convert/convert.go

@@ -272,7 +272,6 @@ func (s serviceConfigAciHelper) getLivenessProbe() *containerinstance.ContainerP
 		}
 		if retries != nil && *retries > 0 {
 			probe.FailureThreshold = retries
-			probe.SuccessThreshold = retries
 		}
 		return &probe
 	}
@@ -365,8 +364,8 @@ func ContainerGroupToContainer(containerID string, cg containerinstance.Containe
 			if cc.LivenessProbe.PeriodSeconds != nil {
 				healthcheck.Interval = types.Duration(int64(*cc.LivenessProbe.PeriodSeconds) * int64(time.Second))
 			}
-			if cc.LivenessProbe.SuccessThreshold != nil {
-				healthcheck.Retries = int(*cc.LivenessProbe.SuccessThreshold)
+			if cc.LivenessProbe.FailureThreshold != nil {
+				healthcheck.Retries = int(*cc.LivenessProbe.FailureThreshold)
 			}
 			if cc.LivenessProbe.TimeoutSeconds != nil {
 				healthcheck.Timeout = types.Duration(int64(*cc.LivenessProbe.TimeoutSeconds) * int64(time.Second))

+ 2 - 2
aci/convert/convert_test.go

@@ -98,7 +98,7 @@ func TestContainerGroupToContainer(t *testing.T) {
 					}),
 				},
 				PeriodSeconds:       to.Int32Ptr(10),
-				SuccessThreshold:    to.Int32Ptr(3),
+				FailureThreshold:    to.Int32Ptr(3),
 				InitialDelaySeconds: to.Int32Ptr(2),
 				TimeoutSeconds:      to.Int32Ptr(1),
 			},
@@ -178,7 +178,7 @@ func TestHealthcheckTranslation(t *testing.T) {
 		assert.NilError(t, err)
 		assert.DeepEqual(t, (*group.Containers)[0].LivenessProbe.Exec.Command, to.StringSlicePtr(test))
 		assert.Equal(t, *(*group.Containers)[0].LivenessProbe.PeriodSeconds, int32(10))
-		assert.Equal(t, *(*group.Containers)[0].LivenessProbe.SuccessThreshold, int32(42))
+		assert.Assert(t, (*group.Containers)[0].LivenessProbe.SuccessThreshold == nil)
 		assert.Equal(t, *(*group.Containers)[0].LivenessProbe.FailureThreshold, int32(42))
 		assert.Equal(t, *(*group.Containers)[0].LivenessProbe.InitialDelaySeconds, int32(2))
 		assert.Equal(t, *(*group.Containers)[0].LivenessProbe.TimeoutSeconds, int32(3))