Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph: reduce the number of provisioner pods in small K8s cluster #6437

Merged
merged 1 commit into from Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -315,6 +316,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