Skip to content

Commit 1be406d

Browse files
support configuring replicas for balancerd and console in MZ CR
1 parent 2114876 commit 1be406d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/cloud-resources/src/crd/materialize.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ pub mod v1alpha1 {
9999
pub balancerd_resource_requirements: Option<ResourceRequirements>,
100100
// Resource requirements for the console pod
101101
pub console_resource_requirements: Option<ResourceRequirements>,
102+
// Number of balancerd pods to create
103+
pub balancerd_replicas: Option<i32>,
104+
// Number of console pods to create
105+
pub console_replicas: Option<i32>,
102106

103107
// Name of the kubernetes service account to use.
104108
// If not set, we will create one with the same name as this Materialize object.
@@ -268,6 +272,14 @@ pub mod v1alpha1 {
268272
self.name_prefixed("balancerd-external-tls")
269273
}
270274

275+
pub fn balancerd_replicas(&self) -> i32 {
276+
self.spec.balancerd_replicas.unwrap_or(2)
277+
}
278+
279+
pub fn console_replicas(&self) -> i32 {
280+
self.spec.console_replicas.unwrap_or(2)
281+
}
282+
271283
pub fn console_configmap_name(&self) -> String {
272284
self.name_prefixed("console")
273285
}

src/orchestratord/src/controller/materialize/balancer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ fn create_balancerd_deployment_object(
320320
};
321321

322322
let deployment_spec = DeploymentSpec {
323-
replicas: Some(1),
323+
replicas: Some(mz.balancerd_replicas()),
324324
selector: LabelSelector {
325325
match_labels: Some(pod_template_labels.clone()),
326326
..Default::default()

src/orchestratord/src/controller/materialize/console.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ ssl_certificate_key /nginx/tls/tls.key;",
395395
};
396396

397397
let deployment_spec = DeploymentSpec {
398-
replicas: Some(2),
398+
replicas: Some(mz.console_replicas()),
399399
selector: LabelSelector {
400400
match_labels: Some(pod_template_labels.clone()),
401401
..Default::default()

0 commit comments

Comments
 (0)