Skip to content

Commit

Permalink
Merge pull request #30370 from MaterializeInc/doy-cluster-sizes
Browse files Browse the repository at this point in the history
make cluster sizes configurable in the orchestratord helm chart
  • Loading branch information
doy-materialize authored Nov 7, 2024
2 parents 8c42cac + 7f3cad8 commit 9b6ef61
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 57 deletions.
15 changes: 15 additions & 0 deletions misc/helm-charts/operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ The following table lists the configurable parameters of the Materialize operato
| `operator.args.localDevelopment` | | ``true`` |
| `operator.args.region` | | ``"kind"`` |
| `operator.args.startupLogFilter` | | ``"INFO,mz_orchestratord=TRACE"`` |
| `operator.clusters.defaultSizes.analytics` | | ``"3xsmall"`` |
| `operator.clusters.defaultSizes.catalogServer` | | ``"2xsmall"`` |
| `operator.clusters.defaultSizes.default` | | ``"3xsmall"`` |
| `operator.clusters.defaultSizes.probe` | | ``"probe"`` |
| `operator.clusters.defaultSizes.support` | | ``"3xsmall"`` |
| `operator.clusters.defaultSizes.system` | | ``"3xsmall"`` |
| `operator.clusters.sizes.2xsmall.credits_per_hour` | | ``"0.5"`` |
| `operator.clusters.sizes.2xsmall.scale` | | ``1`` |
| `operator.clusters.sizes.2xsmall.workers` | | ``1`` |
| `operator.clusters.sizes.3xsmall.credits_per_hour` | | ``"0.25"`` |
| `operator.clusters.sizes.3xsmall.scale` | | ``1`` |
| `operator.clusters.sizes.3xsmall.workers` | | ``1`` |
| `operator.clusters.sizes.probe.credits_per_hour` | | ``"0"`` |
| `operator.clusters.sizes.probe.scale` | | ``1`` |
| `operator.clusters.sizes.probe.workers` | | ``1`` |
| `operator.image.pullPolicy` | | ``"IfNotPresent"`` |
| `operator.image.repository` | | ``"materialize/orchestratord"`` |
| `operator.image.tag` | | ``"v0.124.0-dev.0--pr.gd5e227d7d07dc4878d2a065c7c10a48c2555385a"`` |
Expand Down
23 changes: 23 additions & 0 deletions misc/helm-charts/operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,29 @@ spec:
{{- if .Values.operator.args.createBalancers }}
- "--create-balancers"
{{- end }}
{{- if .Values.operator.clusters }}
{{- if .Values.operator.clusters.sizes }}
- '--environmentd-cluster-replica-sizes={{ toJson .Values.operator.clusters.sizes }}'
{{- end }}
{{ if .Values.operator.clusters.defaultSizes.default }}
- "--bootstrap-default-cluster-replica-size={{ .Values.operator.clusters.defaultSizes.default }}"
{{- end }}
{{ if .Values.operator.clusters.defaultSizes.system }}
- "--bootstrap-builtin-system-cluster-replica-size={{ .Values.operator.clusters.defaultSizes.system }}"
{{- end }}
{{ if .Values.operator.clusters.defaultSizes.probe }}
- "--bootstrap-builtin-probe-cluster-replica-size={{ .Values.operator.clusters.defaultSizes.probe }}"
{{- end }}
{{ if .Values.operator.clusters.defaultSizes.support }}
- "--bootstrap-builtin-support-cluster-replica-size={{ .Values.operator.clusters.defaultSizes.support }}"
{{- end }}
{{ if .Values.operator.clusters.defaultSizes.catalogServer }}
- "--bootstrap-builtin-catalog-server-cluster-replica-size={{ .Values.operator.clusters.defaultSizes.catalogServer }}"
{{- end }}
{{ if .Values.operator.clusters.defaultSizes.analytics }}
- "--bootstrap-builtin-analytics-cluster-replica-size={{ .Values.operator.clusters.defaultSizes.analytics }}"
{{- end }}
{{- end }}
- "--image-pull-policy={{ kebabcase .Values.operator.image.pullPolicy }}"
{{- range $key, $value := .Values.environmentd.nodeSelector }}
- "--environmentd-node-selector={{ $key }}={{ $value }}"
Expand Down
21 changes: 21 additions & 0 deletions misc/helm-charts/operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,27 @@ operator:
environmentdConnectionRoleARN: ""
# awsAccountID is required when cloudProvider is "aws"
awsAccountID: ""
clusters:
sizes:
3xsmall:
workers: 1
scale: 1
credits_per_hour: "0.25"
2xsmall:
workers: 1
scale: 1
credits_per_hour: "0.5"
probe:
workers: 1
scale: 1
credits_per_hour: "0"
defaultSizes:
default: 3xsmall
system: 3xsmall
probe: probe
support: 3xsmall
catalogServer: 2xsmall
analytics: 3xsmall
# Node selector to use for the operator pod
nodeSelector: {}
resources:
Expand Down
38 changes: 14 additions & 24 deletions src/orchestratord/src/controller/materialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::{
use http::HeaderValue;
use k8s_openapi::apimachinery::pkg::apis::meta::v1::{Condition, Time};
use kube::{api::PostParams, runtime::controller::Action, Api, Client, Resource, ResourceExt};
use serde_json::json;
use tracing::{debug, trace};

use crate::metrics::Metrics;
Expand Down Expand Up @@ -61,20 +60,20 @@ pub struct Args {
#[clap(flatten)]
network_policies: NetworkPolicyConfig,

#[clap(long, default_value_t = default_cluster_replica_sizes())]
environmentd_cluster_replica_sizes: String,
#[clap(long, default_value = "25cc")]
bootstrap_default_cluster_replica_size: String,
#[clap(long, default_value = "25cc")]
bootstrap_builtin_system_cluster_replica_size: String,
#[clap(long, default_value = "mz_probe")]
bootstrap_builtin_probe_cluster_replica_size: String,
#[clap(long, default_value = "25cc")]
bootstrap_builtin_support_cluster_replica_size: String,
#[clap(long, default_value = "50cc")]
bootstrap_builtin_catalog_server_cluster_replica_size: String,
#[clap(long, default_value = "25cc")]
bootstrap_builtin_analytics_cluster_replica_size: String,
#[clap(long)]
environmentd_cluster_replica_sizes: Option<String>,
#[clap(long)]
bootstrap_default_cluster_replica_size: Option<String>,
#[clap(long)]
bootstrap_builtin_system_cluster_replica_size: Option<String>,
#[clap(long)]
bootstrap_builtin_probe_cluster_replica_size: Option<String>,
#[clap(long)]
bootstrap_builtin_support_cluster_replica_size: Option<String>,
#[clap(long)]
bootstrap_builtin_catalog_server_cluster_replica_size: Option<String>,
#[clap(long)]
bootstrap_builtin_analytics_cluster_replica_size: Option<String>,

#[clap(
long,
Expand Down Expand Up @@ -187,15 +186,6 @@ impl Display for Error {
}
}

fn default_cluster_replica_sizes() -> String {
json!({
"25cc": {"workers": 1, "scale": 1, "credits_per_hour": "0.25"},
"50cc": {"workers": 1, "scale": 1, "credits_per_hour": "0.5"},
"mz_probe": {"workers": 1, "scale": 1, "credits_per_hour": "0.00"},
})
.to_string()
}

pub struct Context {
config: Args,
tracing: TracingCliArgs,
Expand Down
69 changes: 36 additions & 33 deletions src/orchestratord/src/controller/materialize/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,16 +801,42 @@ fn create_environmentd_statefulset_object(
));

// Add cluster and storage host size arguments.
args.extend([
format!(
"--cluster-replica-sizes={}",
&config.environmentd_cluster_replica_sizes
),
format!(
"--bootstrap-default-cluster-replica-size={}",
&config.bootstrap_default_cluster_replica_size
),
]);
args.extend(
[
config
.environmentd_cluster_replica_sizes
.as_ref()
.map(|sizes| format!("--cluster-replica-sizes={sizes}")),
config
.bootstrap_default_cluster_replica_size
.as_ref()
.map(|size| format!("--bootstrap-default-cluster-replica-size={size}")),
config
.bootstrap_builtin_system_cluster_replica_size
.as_ref()
.map(|size| format!("--bootstrap-builtin-system-cluster-replica-size={size}")),
config
.bootstrap_builtin_probe_cluster_replica_size
.as_ref()
.map(|size| format!("--bootstrap-builtin-probe-cluster-replica-size={size}")),
config
.bootstrap_builtin_support_cluster_replica_size
.as_ref()
.map(|size| format!("--bootstrap-builtin-support-cluster-replica-size={size}")),
config
.bootstrap_builtin_catalog_server_cluster_replica_size
.as_ref()
.map(|size| {
format!("--bootstrap-builtin-catalog-server-cluster-replica-size={size}")
}),
config
.bootstrap_builtin_analytics_cluster_replica_size
.as_ref()
.map(|size| format!("--bootstrap-builtin-analytics-cluster-replica-size={size}")),
]
.into_iter()
.flatten(),
);

// Add networking arguments.
args.extend([
Expand Down Expand Up @@ -993,29 +1019,6 @@ fn create_environmentd_statefulset_object(
args.push(format!("--sentry-tag=region={}", config.region));
}

args.extend([
format!(
"--bootstrap-builtin-system-cluster-replica-size={}",
&config.bootstrap_builtin_system_cluster_replica_size
),
format!(
"--bootstrap-builtin-probe-cluster-replica-size={}",
&config.bootstrap_builtin_probe_cluster_replica_size
),
format!(
"--bootstrap-builtin-support-cluster-replica-size={}",
&config.bootstrap_builtin_support_cluster_replica_size
),
format!(
"--bootstrap-builtin-catalog-server-cluster-replica-size={}",
&config.bootstrap_builtin_catalog_server_cluster_replica_size
),
format!(
"--bootstrap-builtin-analytics-cluster-replica-size={}",
&config.bootstrap_builtin_analytics_cluster_replica_size
),
]);

// Add Persist PubSub arguments
args.push(format!(
"--persist-pubsub-url=http://{}:{}",
Expand Down

0 comments on commit 9b6ef61

Please sign in to comment.