ceph: allow disable liveness check for mds daemonset
Allow to disable liveness probes for mds pod Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
This commit is contained in:
1 parent
423bc3167d
commit
d3416fcf2c
5 files changed
+30
-4
No files matched your search
@@ -21,6 +21,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
KeyMds rook.KeyType = "mds"
|
||||
KeyMon rook.KeyType = "mon"
|
||||
KeyMonArbiter rook.KeyType = "arbiter"
|
||||
KeyMgr rook.KeyType = "mgr"
|
||||
|
||||
@@ -34,3 +34,8 @@ func GetMgrLivenessProbe(l CephClusterHealthCheckSpec) *corev1.Probe {
|
||||
func GetOSDLivenessProbe(l CephClusterHealthCheckSpec) *corev1.Probe {
|
||||
return l.LivenessProbe[ResourcesKeyOSD].Probe
|
||||
}
|
||||
|
||||
// GetMdsLivenessProbe returns the liveness probe for the MDS service
|
||||
func GetMdsLivenessProbe(l CephClusterHealthCheckSpec) *corev1.Probe {
|
||||
return l.LivenessProbe[ResourcesKeyMDS].Probe
|
||||
}
|
||||
@@ -33,6 +33,7 @@ func ConfigureLivenessProbe(daemon rookv1.KeyType, container v1.Container, healt
|
||||
cephv1.KeyMon: cephv1.GetMonLivenessProbe,
|
||||
cephv1.KeyMgr: cephv1.GetMgrLivenessProbe,
|
||||
cephv1.KeyOSD: cephv1.GetOSDLivenessProbe,
|
||||
cephv1.KeyMds: cephv1.GetMdsLivenessProbe,
|
||||
}
|
||||
|
||||
if _, ok := healthCheck.LivenessProbe[daemon]; ok {
|
||||
|
||||
@@ -29,6 +29,19 @@ import (
|
||||
)
|
||||
|
||||
func TestConfigureLivenessProbe(t *testing.T) {
|
||||
keyTypes := []rookv1.KeyType{
|
||||
cephv1.KeyMds,
|
||||
cephv1.KeyMon,
|
||||
cephv1.KeyMgr,
|
||||
cephv1.KeyOSD,
|
||||
}
|
||||
|
||||
for _, keyType := range keyTypes {
|
||||
configLivenessProbeHelper(t, keyType)
|
||||
}
|
||||
}
|
||||
|
||||
func configLivenessProbeHelper(t *testing.T, keyType rookv1.KeyType) {
|
||||
p := &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
@@ -38,7 +51,7 @@ func TestConfigureLivenessProbe(t *testing.T) {
|
||||
},
|
||||
}
|
||||
container := v1.Container{LivenessProbe: p}
|
||||
l := map[rookv1.KeyType]*rookv1.ProbeSpec{cephv1.KeyMon: {Disabled: true}}
|
||||
l := map[rookv1.KeyType]*rookv1.ProbeSpec{keyType: {Disabled: true}}
|
||||
type args struct {
|
||||
daemon rookv1.KeyType
|
||||
container v1.Container
|
||||
@@ -49,8 +62,8 @@ func TestConfigureLivenessProbe(t *testing.T) {
|
||||
args args
|
||||
want v1.Container
|
||||
}{
|
||||
{"probe-enabled", args{cephv1.KeyMon, container, cephv1.CephClusterHealthCheckSpec{}}, container},
|
||||
{"probe-disabled", args{cephv1.KeyMon, container, cephv1.CephClusterHealthCheckSpec{LivenessProbe: l}}, v1.Container{}},
|
||||
{"probe-enabled", args{keyType, container, cephv1.CephClusterHealthCheckSpec{}}, container},
|
||||
{"probe-disabled", args{keyType, container, cephv1.CephClusterHealthCheckSpec{LivenessProbe: l}}, v1.Container{}},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/operator/ceph/config"
|
||||
"github.com/rook/rook/pkg/operator/ceph/controller"
|
||||
@@ -38,6 +39,10 @@ const (
|
||||
)
|
||||
|
||||
func (c *Cluster) makeDeployment(mdsConfig *mdsConfig) (*apps.Deployment, error) {
|
||||
|
||||
mdsContainer := c.makeMdsDaemonContainer(mdsConfig)
|
||||
config.ConfigureLivenessProbe(cephv1.KeyMds, mdsContainer, c.clusterSpec.HealthCheck)
|
||||
|
||||
podSpec := v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: mdsConfig.ResourceName,
|
||||
@@ -48,7 +53,7 @@ func (c *Cluster) makeDeployment(mdsConfig *mdsConfig) (*apps.Deployment, error)
|
||||
c.makeChownInitContainer(mdsConfig),
|
||||
},
|
||||
Containers: []v1.Container{
|
||||
c.makeMdsDaemonContainer(mdsConfig),
|
||||
mdsContainer,
|
||||
},
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
Volumes: controller.DaemonVolumes(mdsConfig.DataPathMap, mdsConfig.ResourceName),
|
||||
@@ -56,6 +61,7 @@ func (c *Cluster) makeDeployment(mdsConfig *mdsConfig) (*apps.Deployment, error)
|
||||
PriorityClassName: c.fs.Spec.MetadataServer.PriorityClassName,
|
||||
},
|
||||
}
|
||||
|
||||
// Replace default unreachable node toleration
|
||||
k8sutil.AddUnreachableNodeToleration(&podSpec.Spec)
|
||||
|
||||
|
||||
Reference in new issue
Block a user