Skip to content

Commit 0df19b8

Browse files
deployment: thread config_format from CLI to node container arg
Add a `--config-format {preset,native}` deployment CLI flag (default preset) and thread its value from the parser through SequencerNodeChart and the Deployment/StatefulSet constructs to PodBuilder, which now emits `--config_format <value>` to the node container instead of a hardcoded "preset". With the default (preset) the synthesized output is unchanged. The ConfigMap content path (native config generation) consumes this value in a follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6ca2fa5 commit 0df19b8

6 files changed

Lines changed: 34 additions & 4 deletions

File tree

deployments/sequencer/src/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def main():
4949
monitoring_configs["enabled"],
5050
args.layout,
5151
args.overlay or [],
52+
args.config_format,
5253
)
5354
_create_monitoring_chart(app, namespace, args.cluster, monitoring_configs)
5455

@@ -199,6 +200,7 @@ def _create_service_charts(
199200
monitoring_enabled: bool,
200201
layout: str,
201202
overlays: list[str],
203+
config_format: str,
202204
):
203205
"""Create SequencerNodeChart for each service."""
204206
for service_cfg in deployment_config.services:
@@ -210,6 +212,7 @@ def _create_service_charts(
210212
service_config=service_cfg,
211213
layout=layout,
212214
overlays=overlays,
215+
config_format=config_format,
213216
)
214217

215218

deployments/sequencer/src/charts/node.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ def __init__(
3131
service_config: ServiceConfig,
3232
layout: str,
3333
overlays: list[str],
34+
config_format: str,
3435
):
3536
super().__init__(scope, name, disable_resource_name_hashes=True, namespace=namespace)
3637

3738
self.monitoring = monitoring
3839
self.service_config = service_config
40+
self.config_format = config_format
3941

4042
# Create labels dictionary from service config + service name
4143
# Base labels from shared config (metaLabels) - now merged into service_config
@@ -48,7 +50,13 @@ def __init__(
4850

4951
# Create ConfigMap
5052
self.config_map = ConfigMapConstruct(
51-
self, "configmap", service_config, labels, monitoring_endpoint_port, layout, overlays
53+
self,
54+
"configmap",
55+
service_config,
56+
labels,
57+
monitoring_endpoint_port,
58+
layout,
59+
overlays,
5260
)
5361

5462
# Create ServiceAccount if enabled
@@ -95,6 +103,7 @@ def __init__(
95103
service_config=self.service_config,
96104
labels=labels,
97105
monitoring_endpoint_port=monitoring_endpoint_port,
106+
config_format=config_format,
98107
)
99108
else:
100109
self.controller = DeploymentConstruct(
@@ -103,6 +112,7 @@ def __init__(
103112
service_config=self.service_config,
104113
labels=labels,
105114
monitoring_endpoint_port=monitoring_endpoint_port,
115+
config_format=config_format,
106116
)
107117

108118
# Create BackendConfig if enabled

deployments/sequencer/src/cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ def argument_parser():
7575
action=UniqueStoreAction,
7676
help="Override image for all services. Format: 'repository:tag' or 'repository' (defaults to 'latest' tag).",
7777
)
78+
parser.add_argument(
79+
"--config-format",
80+
type=str,
81+
action=UniqueStoreAction,
82+
choices=["preset", "native"],
83+
default="preset",
84+
help="Node config format to emit and pass to the node container via --config_format. "
85+
"'preset' (default): flat dotted-key placeholder fill (legacy). "
86+
"'native': nested SequencerNodeConfig assembled via jsonnet build().",
87+
)
7888
parser.add_argument(
7989
"-v",
8090
"--verbose",

deployments/sequencer/src/constructs/deployment.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def __init__(
1111
service_config,
1212
labels,
1313
monitoring_endpoint_port,
14+
config_format: str,
1415
):
1516
super().__init__(
1617
scope,
@@ -20,13 +21,15 @@ def __init__(
2021
monitoring_endpoint_port,
2122
)
2223

24+
self.config_format = config_format
2325
self.deployment = self._create_deployment()
2426

2527
def _create_deployment(self) -> k8s.KubeDeployment:
2628
pod_builder = PodBuilder(
2729
self.service_config,
2830
self.labels,
2931
self.monitoring_endpoint_port,
32+
config_format=self.config_format,
3033
)
3134

3235
selector_labels = {"service": self.labels["service"]}

deployments/sequencer/src/constructs/helpers/pod_builder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ def __init__(
1616
service_config: ServiceConfig,
1717
labels: dict[str, str],
1818
monitoring_endpoint_port: int,
19+
config_format: str,
1920
):
2021
self.service_config = service_config
2122
self.labels = labels
2223
self.monitoring_endpoint_port = monitoring_endpoint_port
24+
self.config_format = config_format
2325

2426
def build_pod_spec(self) -> k8s.PodSpec:
2527
"""Build a complete PodSpec with all necessary configurations."""
@@ -82,9 +84,8 @@ def _build_container(self) -> k8s.Container:
8284

8385
def _build_container_args(self) -> list[str]:
8486
"""Build container arguments, always including --config_file with fixed file paths."""
85-
# Interpret the --config_file arguments with the legacy flat-preset loader for now. The
86-
# node also supports "native" (nested serde) loading; this is the explicit switch point.
87-
args = ["--config_format", "preset"]
87+
# First argument is the config format.
88+
args = ["--config_format", self.config_format]
8889

8990
# Add --config_file /config/sequencer/presets/config (ConfigMap)
9091
# Note: node version uses directory mount, so path is just the directory + "config"

deployments/sequencer/src/constructs/statefulset.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def __init__(
1111
service_config,
1212
labels,
1313
monitoring_endpoint_port,
14+
config_format,
1415
):
1516
super().__init__(
1617
scope,
@@ -20,6 +21,7 @@ def __init__(
2021
monitoring_endpoint_port,
2122
)
2223

24+
self.config_format = config_format
2325
self.statefulset = self._create_statefulset()
2426

2527
def _build_update_strategy(self) -> k8s.StatefulSetUpdateStrategy:
@@ -67,6 +69,7 @@ def _create_statefulset(self) -> k8s.KubeStatefulSet:
6769
self.service_config,
6870
statefulset_labels,
6971
self.monitoring_endpoint_port,
72+
config_format=self.config_format,
7073
)
7174

7275
selector_labels = {"service": statefulset_labels["service"]}

0 commit comments

Comments
 (0)