Skip to content

Commit 2ea644a

Browse files
committed
indexer custom config support
1 parent b4cc69b commit 2ea644a

File tree

6 files changed

+56
-22
lines changed

6 files changed

+56
-22
lines changed

testsuite/forge/src/backend/k8s/mod.rs

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ impl Factory for K8sFactory {
116116
genesis_config_fn: Option<GenesisConfigFn>,
117117
node_config_fn: Option<NodeConfigFn>,
118118
existing_db_tag: Option<String>,
119+
indexer_config: Option<serde_json::Value>,
119120
) -> Result<Box<dyn Swarm>> {
120121
let genesis_modules_path = match genesis_config {
121122
Some(config) => match config {
@@ -196,28 +197,50 @@ impl Factory for K8sFactory {
196197
.boxed();
197198

198199
let deploy_indexer_fut = async {
199-
if self.enable_indexer {
200-
// NOTE: by default, use a deploy profile and no additional configuration values
201-
let config = serde_json::from_value(json!({
202-
"profile": self.deployer_profile.clone(),
203-
"era": new_era.clone(),
204-
"namespace": self.kube_namespace.clone(),
205-
"indexer-grpc-values": {
206-
"indexerGrpcImage": format!("{}:{}", INDEXER_GRPC_DOCKER_IMAGE_REPO, init_version),
207-
"fullnodeConfig": {
208-
"image": format!("{}:{}", VALIDATOR_DOCKER_IMAGE_REPO, init_version),
209-
}
210-
},
211-
}))?;
200+
if let Some(indexer_values) = indexer_config {
201+
let mut config = json!({
202+
"profile": self.deployer_profile.clone(),
203+
"era": new_era.clone(),
204+
"namespace": self.kube_namespace.clone(),
205+
"indexer-grpc-v2-values": {
206+
"indexerGrpcImage": format!("{}:{}", INDEXER_GRPC_DOCKER_IMAGE_REPO, init_version),
207+
"fullnodeConfig": {
208+
"image": format!("{}:{}", VALIDATOR_DOCKER_IMAGE_REPO, init_version),
209+
}
210+
},
211+
});
212+
// json_patch::merge(&mut config, &indexer_values);
213+
let indexer_deployer = ForgeDeployerManager::new(
214+
kube_client.clone(),
215+
self.kube_namespace.clone(),
216+
FORGE_INDEXER_DEPLOYER_DOCKER_IMAGE_REPO.to_string(),
217+
None,
218+
);
219+
indexer_deployer.start(config).await?;
220+
indexer_deployer.wait_completed().await?;
221+
Ok(())
222+
} else if self.enable_indexer {
223+
// NOTE: by default, use a deploy profile and no additional configuration values
224+
let config = serde_json::from_value(json!({
225+
"profile": self.deployer_profile.clone(),
226+
"era": new_era.clone(),
227+
"namespace": self.kube_namespace.clone(),
228+
"indexer-grpc-values": {
229+
"indexerGrpcImage": format!("{}:{}", INDEXER_GRPC_DOCKER_IMAGE_REPO, init_version),
230+
"fullnodeConfig": {
231+
"image": format!("{}:{}", VALIDATOR_DOCKER_IMAGE_REPO, init_version),
232+
}
233+
},
234+
}))?;
212235

213-
let indexer_deployer = ForgeDeployerManager::new(
214-
kube_client.clone(),
215-
self.kube_namespace.clone(),
216-
FORGE_INDEXER_DEPLOYER_DOCKER_IMAGE_REPO.to_string(),
217-
None,
218-
);
219-
indexer_deployer.start(config).await?;
220-
indexer_deployer.wait_completed().await
236+
let indexer_deployer = ForgeDeployerManager::new(
237+
kube_client.clone(),
238+
self.kube_namespace.clone(),
239+
FORGE_INDEXER_DEPLOYER_DOCKER_IMAGE_REPO.to_string(),
240+
None,
241+
);
242+
indexer_deployer.start(config).await?;
243+
indexer_deployer.wait_completed().await
221244
} else {
222245
Ok(())
223246
}

testsuite/forge/src/backend/k8s_deployer/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub const INDEXER_GRPC_DOCKER_IMAGE_REPO: &str =
1010
"us-docker.pkg.dev/aptos-registry/docker/indexer-grpc";
1111

1212
/// The version of the forge deployer image to use.
13-
pub const DEFAULT_FORGE_DEPLOYER_IMAGE_TAG: &str = "0769f1eb0c17e101e6e9d852cfe1c22e2ca82190"; // default to the latest stable build from the main branch (2025-08-02)
13+
pub const DEFAULT_FORGE_DEPLOYER_IMAGE_TAG: &str = "48e97c74576c69088b56ac6ab66fd6c0ae22a7d3"; // default to the latest stable build from the main branch (2025-08-02)
1414

1515
/// This is the service account name that the deployer will use to deploy the forge components. It may require extra permissions and additonal setup
1616
pub const FORGE_DEPLOYER_SERVICE_ACCOUNT_NAME: &str = "forge";

testsuite/forge/src/backend/local/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ impl Factory for LocalFactory {
184184
_genesis_config_fn: Option<GenesisConfigFn>,
185185
_node_config_fn: Option<NodeConfigFn>,
186186
_existing_db_tag: Option<String>,
187+
_indexer_config: Option<serde_json::Value>,
187188
) -> Result<Box<dyn Swarm>> {
188189
let framework = match genesis_config {
189190
Some(config) => match config {

testsuite/forge/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ pub struct ForgeConfig {
5858

5959
/// Retain debug logs and above for all nodes instead of just the first 5 nodes
6060
pub retain_debug_logs: bool,
61+
62+
pub indexer_config: Option<serde_json::Value>,
6163
}
6264

6365
impl ForgeConfig {
@@ -281,6 +283,11 @@ impl ForgeConfig {
281283
self
282284
}
283285

286+
pub fn with_indexer_config(mut self, indexer_config: serde_json::Value) -> Self {
287+
self.indexer_config = Some(indexer_config);
288+
self
289+
}
290+
284291
pub fn get_emit_job(&self) -> &EmitJobRequest {
285292
&self.emit_job_request
286293
}
@@ -357,6 +364,7 @@ impl Default for ForgeConfig {
357364
validator_resource_override: NodeResourceOverride::default(),
358365
fullnode_resource_override: NodeResourceOverride::default(),
359366
retain_debug_logs: false,
367+
indexer_config: None,
360368
}
361369
}
362370
}

testsuite/forge/src/interface/factory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ pub trait Factory {
2424
genesis_config_fn: Option<GenesisConfigFn>,
2525
node_config_fn: Option<NodeConfigFn>,
2626
existing_db_tag: Option<String>,
27+
indexer_config: Option<serde_json::Value>,
2728
) -> Result<Box<dyn Swarm>>;
2829
}

testsuite/forge/src/runner.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ impl<'cfg, F: Factory> Forge<'cfg, F> {
290290
self.tests.genesis_helm_config_fn.clone(),
291291
self.tests.build_node_helm_config_fn(retain_debug_logs),
292292
self.tests.existing_db_tag.clone(),
293+
self.tests.indexer_config.clone(),
293294
))?;
294295

295296
// Run AptosTests

0 commit comments

Comments
 (0)