Skip to content

Commit

Permalink
Merge pull request #6443 from rook/mergify/bp/release-1.4/pr-6437
Browse files Browse the repository at this point in the history
ceph: reduce the number of provisioner pods in small K8s cluster (bp #6437)
  • Loading branch information
mergify[bot] committed Oct 15, 2020
2 parents a590a5d + 39ccb68 commit d25b581
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Expand Up @@ -4,7 +4,7 @@ metadata:
name: csi-cephfsplugin-provisioner
namespace: {{ .Namespace }}
spec:
replicas: 2
replicas: {{ .ProvisionerReplicas }}
selector:
matchLabels:
app: csi-cephfsplugin-provisioner
Expand Down
Expand Up @@ -4,7 +4,7 @@ metadata:
name: csi-rbdplugin-provisioner
namespace: {{ .Namespace }}
spec:
replicas: 2
replicas: {{ .ProvisionerReplicas }}
selector:
matchLabels:
app: csi-rbdplugin-provisioner
Expand Down
11 changes: 11 additions & 0 deletions pkg/operator/ceph/csi/spec.go
Expand Up @@ -57,6 +57,7 @@ type Param struct {
CephFSLivenessMetricsPort uint16
RBDGRPCMetricsPort uint16
RBDLivenessMetricsPort uint16
ProvisionerReplicas uint8
}

type templateParam struct {
Expand Down Expand Up @@ -325,6 +326,16 @@ func startDrivers(clientset kubernetes.Interface, rookclientset rookclient.Inter
}
}

tp.ProvisionerReplicas = 2
nodes, err := clientset.CoreV1().Nodes().List(metav1.ListOptions{})
if err == nil {
if len(nodes.Items) == 1 {
tp.ProvisionerReplicas = 1
}
} else {
logger.Errorf("failed to get nodes. Defaulting the number of replicas of provisioner pods to 2. %v", err)
}

if EnableRBD {
rbdPlugin, err = templateToDaemonSet("rbdplugin", RBDPluginTemplatePath, tp)
if err != nil {
Expand Down

0 comments on commit d25b581

Please sign in to comment.