Add support for more readiness args
This commit is contained in:
james song
2021-05-19 23:52:33 +08:00
committed by GitHub
parent 771ecbf471
commit 0b331d9e5d
6 changed files with 112 additions and 4 deletions
+9
View File
@@ -44,6 +44,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
)
/**
@@ -511,6 +512,14 @@ func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.Servic
Command: service.HealthChecks.Liveness.Test,
},
}
} else if !reflect.ValueOf(service.HealthChecks.Liveness.HTTPPath).IsZero() &&
!reflect.ValueOf(service.HealthChecks.Liveness.HTTPPort).IsZero() {
probe.Handler = api.Handler{
HTTPGet: &api.HTTPGetAction{
Path: service.HealthChecks.Liveness.HTTPPath,
Port: intstr.FromInt(int(service.HealthChecks.Liveness.HTTPPort)),
},
}
} else {
return errors.New("Health check must contain a command")
}