diff --git a/PROGRESS.md b/PROGRESS.md index a8ff8b4..5e7c4d0 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -17,7 +17,7 @@ - [x] Build genesis - [x] Docker Build and Push to registry - [x] Bootstrap - - [ ] Validator (regular) + - [x] Validator (regular) - [ ] RPC nodes - [ ] Client - [ ] Create & Deploy Secrets @@ -37,7 +37,7 @@ - [ ] Client - [ ] Create & Deploy Services - [x] Bootstrap - - [ ] Validator (regular) + - [x] Validator (regular) - [ ] RPC nodes - [ ] Client - [x] Check Bootstrap is deployed and running diff --git a/src/genesis.rs b/src/genesis.rs index e692a0a..03c47da 100644 --- a/src/genesis.rs +++ b/src/genesis.rs @@ -12,10 +12,10 @@ use { pub const DEFAULT_FAUCET_LAMPORTS: u64 = 500000000000000000; // from agave/ pub const DEFAULT_MAX_GENESIS_ARCHIVE_UNPACKED_SIZE: u64 = 1073741824; // from agave/ -pub const DEFAULT_INTERNAL_NODE_STAKE_SOL: f64 = 1.0; -pub const DEFAULT_INTERNAL_NODE_SOL: f64 = 10.0; -pub const DEFAULT_BOOTSTRAP_NODE_STAKE_SOL: f64 = 1.0; -pub const DEFAULT_BOOTSTRAP_NODE_SOL: f64 = 10.0; +pub const DEFAULT_INTERNAL_NODE_STAKE_SOL: f64 = 10.0; +pub const DEFAULT_INTERNAL_NODE_SOL: f64 = 100.0; +pub const DEFAULT_BOOTSTRAP_NODE_STAKE_SOL: f64 = 10.0; +pub const DEFAULT_BOOTSTRAP_NODE_SOL: f64 = 100.0; fn fetch_spl(fetch_spl_file: &PathBuf) -> Result<(), Box> { let output = Command::new("bash") diff --git a/src/kubernetes.rs b/src/kubernetes.rs index 67203be..ed21c97 100644 --- a/src/kubernetes.rs +++ b/src/kubernetes.rs @@ -453,4 +453,12 @@ impl<'a> Kubernetes<'a> { self.pod_requests.requests.clone(), ) } + + pub fn create_validator_service( + &self, + service_name: &str, + label_selector: &BTreeMap, + ) -> Service { + k8s_helpers::create_service(service_name, self.namespace.as_str(), label_selector, false) + } } diff --git a/src/main.rs b/src/main.rs index e75a22c..ca58521 100644 --- a/src/main.rs +++ b/src/main.rs @@ -774,5 +774,17 @@ async fn main() { return; } }; + + // let service_name = format!("validator-service-{index}"); + let validator_service = kub_controller.create_validator_service( + &format!("validator-service-{validator_index}"), + validator.replica_set_labels(), + ); + match kub_controller.deploy_service(&validator_service).await { + Ok(_) => info!("validator service ({validator_index}) deployed successfully"), + Err(err) => { + error!("Error! Failed to deploy validator service: {validator_index}. err: {err}") + } + } } } diff --git a/src/release.rs b/src/release.rs index e173401..7314840 100644 --- a/src/release.rs +++ b/src/release.rs @@ -58,6 +58,10 @@ impl BuildConfig { } pub async fn prepare(&self) -> Result<(), Box> { + if self.build_type == BuildType::Skip { + info!("skipping build"); + return Ok(()); + } match &self.deploy_method { DeployMethod::ReleaseChannel(channel) => match self.setup_tar_deploy(channel).await { Ok(tar_directory) => { @@ -77,7 +81,7 @@ impl BuildConfig { async fn setup_tar_deploy(&self, release_channel: &String) -> Result> { let file_name = "solana-release"; let tar_filename = format!("{file_name}.tar.bz2"); - info!("tar file: {}", tar_filename); + info!("tar file: {tar_filename}"); self.download_release_from_channel(&tar_filename, release_channel) .await?; @@ -92,11 +96,7 @@ impl BuildConfig { } fn setup_local_deploy(&self) -> Result<(), Box> { - if self.build_type != BuildType::Skip { - self.build()?; - } else { - info!("Build skipped due to --build-type skip"); - } + self.build()?; Ok(()) } diff --git a/src/scripts/bootstrap-validator-startup-script.sh b/src/scripts/bootstrap-validator-startup-script.sh index 56e0a7e..f9c72d0 100755 --- a/src/scripts/bootstrap-validator-startup-script.sh +++ b/src/scripts/bootstrap-validator-startup-script.sh @@ -7,10 +7,24 @@ nohup solana-faucet --keypair bootstrap-accounts/faucet.json & # Start the bootstrap validator node # shellcheck disable=SC1091 source /home/solana/k8s-cluster-scripts/common.sh +no_restart=0 -program="agave-validator" +# Define the paths to the validator cli. pre 1.18 is `solana-validator`. post 1.18 is `agave-validator` +agave_validator="/home/solana/.cargo/bin/agave-validator" +solana_validator="/home/solana/.cargo/bin/solana-validator" -no_restart=0 +# Initialize program variable +program="" + +# Check if agave-validator exists and is executable +if [[ -x "$agave_validator" ]]; then + program="agave-validator" +elif [[ -x "$solana_validator" ]]; then + program="solana-validator" +else + echo "Neither agave-validator nor solana-validator could be found or is not executable." + exit 1 +fi echo "PROGRAM: $program" diff --git a/src/scripts/validator-startup-script.sh b/src/scripts/validator-startup-script.sh index 3e58b58..40295c4 100755 --- a/src/scripts/validator-startup-script.sh +++ b/src/scripts/validator-startup-script.sh @@ -9,7 +9,8 @@ args=( --no-os-network-limits-test ) airdrops_enabled=1 -# next two values will be overwritten based on command line args. default is set here: k8s-cluster/src/genesis.rs +node_sol= +stake_sol= identity=validator-accounts/identity.json vote_account=validator-accounts/vote.json no_restart=0 @@ -17,6 +18,25 @@ gossip_entrypoint=$BOOTSTRAP_GOSSIP_ADDRESS ledger_dir=/home/solana/ledger faucet_address=$LOAD_BALANCER_FAUCET_ADDRESS +# Define the paths to the validator cli. pre 1.18 is `solana-validator`. post 1.18 is `agave-validator` +agave_validator="/home/solana/.cargo/bin/agave-validator" +solana_validator="/home/solana/.cargo/bin/solana-validator" + +# Initialize program variable +program="" + +# Check if agave-validator exists and is executable +if [[ -x "$agave_validator" ]]; then + program="agave-validator" +elif [[ -x "$solana_validator" ]]; then + program="solana-validator" +else + echo "Neither agave-validator nor solana-validator could be found or is not executable." + exit 1 +fi + +echo "PROGRAM: $program" + usage() { if [[ -n $1 ]]; then echo "$*" @@ -236,9 +256,6 @@ default_arg --allow-private-addr default_arg --gossip-port 8001 default_arg --rpc-port 8899 -program="agave-validator" -echo "program: $program" - PS4="$(basename "$0"): " echo "PS4: $PS4"