Skip to content

Commit

Permalink
[forge] clean up forge deployer interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
rustielin committed Sep 16, 2024
1 parent d5192eb commit 02dad86
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 110 deletions.
14 changes: 5 additions & 9 deletions testsuite/forge-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,12 @@ fn main() -> Result<()> {
OperatorCommand::Create(create) => {
let kube_client = runtime.block_on(create_k8s_client())?;
let era = generate_new_era();
let values = ForgeDeployerValues {
profile: DEFAULT_FORGE_DEPLOYER_PROFILE.to_string(),
let config = ForgeDeployerConfig::new(
DEFAULT_FORGE_DEPLOYER_PROFILE.to_string(),
era,
namespace: create.namespace,
indexer_grpc_values: None,
indexer_processor_values: None,
};
let forge_deployer_manager =
ForgeDeployerManager::from_k8s_client(kube_client, values);
runtime.block_on(forge_deployer_manager.ensure_namespace_prepared())?;
create.namespace,
);
let forge_deployer_manager = ForgeDeployerManager::new(kube_client, config);
// NOTE: this is generally not going to run from within the cluster, do not perform any operations
// that might require internal DNS resolution to work, such as txn emission directly against the node service IPs.
runtime.block_on(forge_deployer_manager.start(ForgeDeployerType::Testnet))?;
Expand Down
22 changes: 9 additions & 13 deletions testsuite/forge/src/backend/k8s/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mod stateful_set;
mod swarm;

use super::{
ForgeDeployerManager, ForgeDeployerType, ForgeDeployerValues, DEFAULT_FORGE_DEPLOYER_PROFILE,
ForgeDeployerConfig, ForgeDeployerManager, ForgeDeployerType, DEFAULT_FORGE_DEPLOYER_PROFILE,
};
use aptos_sdk::crypto::ed25519::ED25519_PRIVATE_KEY_LENGTH;
pub use cluster_helper::*;
Expand Down Expand Up @@ -185,18 +185,14 @@ impl Factory for K8sFactory {
// add an indexer too!
if self.enable_indexer {
// NOTE: by default, use a deploy profile and no additional configuration values
let values = ForgeDeployerValues {
profile: DEFAULT_FORGE_DEPLOYER_PROFILE.to_string(),
era: new_era.clone().expect("Era not set in created testnet"),
namespace: self.kube_namespace.clone(),
indexer_grpc_values: None,
indexer_processor_values: None,
};

let forge_deployer_manager =
ForgeDeployerManager::from_k8s_client(kube_client.clone(), values);

forge_deployer_manager.ensure_namespace_prepared().await?;
let config = ForgeDeployerConfig::new(
DEFAULT_FORGE_DEPLOYER_PROFILE.to_string(),
new_era.clone().expect("Era not set in created testnet"),
self.kube_namespace.clone(),
);

let forge_deployer_manager = ForgeDeployerManager::new(kube_client.clone(), config);

forge_deployer_manager
.start(ForgeDeployerType::Indexer)
.await?;
Expand Down
Loading

0 comments on commit 02dad86

Please sign in to comment.