Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

add and deploy bootstrap secrets#8

Merged
gregcusack merged 3 commits intoanza-xyz:mainfrom
gregcusack:secrets
Apr 18, 2024
Merged

add and deploy bootstrap secrets#8
gregcusack merged 3 commits intoanza-xyz:mainfrom
gregcusack:secrets

Conversation

@gregcusack
Copy link
Copy Markdown
Contributor

@gregcusack gregcusack commented Apr 1, 2024

Summary of Changes

  1. create and deploy kubernetes secret for bootstrap accounts
  2. fix some of @joncinque nits and remove dependency on CARGO_MANIGEST_PATH

8th PR in a series of PRs that will build out the monogon testing framework for deploying validator clusters on Kubernetes
Previous PRs:

  1. PR: add PROGRESS.md and connect to k8s endpoint to check namespace exists #1
  2. PR: Add in ability to build solana binary from local repo on host #2
  3. PR: Add pull specific solana-release version #3
  4. PR: Create genesis struct. and generate bootstrap and faucet accounts #4
  5. PR: Build genesis and add genesis cli flags #5
  6. PR: Build docker bootstrap image #6
  7. PR: Push docker image to registry #7

Comment thread src/k8s_helpers.rs
Comment on lines +18 to +21
pub fn create_secret_from_files(
secret_name: &str,
key_files: &[(PathBuf, &str)], //[pathbuf, key type]
) -> Result<Secret, Box<dyn Error>> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm thinking about whether it would be better to make this func more generic. I mean we pass the real key instead of key type.

Copy link
Copy Markdown
Contributor Author

@gregcusack gregcusack Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we do have a generic create_secret() method that is called by create_secret_from_files. Is that what you mean? Or you want something different?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh. sorry for the confusion. I mean we have

data.insert(format!("{}.json", key_type), ByteString(file_content));

perhaps we could have the caller handle the key name instead of hardcoding it here 🤔

then we can have this one easier

pub enum SecretType {
    Value { v: String },
    File { path: PathBuf },
}

pub fn THE_PUB_CREATE_SECRET_FN_NAME (name: &str, hm: HashMap<String, SecretType>) {
    let mut m: BTreeMap<String, String> = BTreeMap::new();
    for (key, value) in &hm {
        match value {
            SecretType::Value { v: _ } => // insert into the btreemap directly
            SecretType::File { path: _ } => // single file version of create_secret_from_files
        }
    }
    create_secret(name, m)
}

It's just an idea that came to mind. There's no need to update it unless we have such requests in our code 🙈

Copy link
Copy Markdown
Contributor Author

@gregcusack gregcusack Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good idea. i have changed it up in PR: #9 in this commit: 146a546, lmk your thoughts

Comment thread src/main.rs
Comment on lines +53 to +60
.arg(
Arg::with_name("validator_lab_directory")
.long("validator-lab-dir")
.takes_value(true)
.required(true)
.help("Absolute path to validator lab directory.
e.g. /home/sol/validator-lab"),
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're solving the issue of using this tool by an executable file. If we have this one, it also means we will always need to clone validator-labs. If we have a path cargo install for this tool in the future, it will be a little bit confused haha.

I'm thinking maybe just like the Dockerfile, we get those files in line 🙈

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking maybe just like the Dockerfile, we get those files in line

oooh can you elaborate a little more please? Are you saying we should add those startup scripts inline? Like in the rust code much like the dockerfile is created inline?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this PR: #9. I hardcoded the scripts. Think what you're saying makes sense slash is the right approach. See: https://github.com/anza-xyz/validator-lab/pull/9/files#diff-42d26d9f54d52fc46e96e03003a53843bea5e35c56ce03ade3ee30d0654b2320

@gregcusack gregcusack merged commit 1a22c6c into anza-xyz:main Apr 18, 2024
@gregcusack gregcusack deleted the secrets branch April 18, 2024 22:45
Copy link
Copy Markdown

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Comment thread src/release.rs
solana_root_path: PathBuf,
docker_build: bool,
build_path: PathBuf,
_build_path: PathBuf,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be used in future PRs?

Copy link
Copy Markdown
Contributor Author

@gregcusack gregcusack Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! EDIT: actually it can be taken out pretty easily. Will update.

gregcusack added a commit to gregcusack/validator-lab that referenced this pull request Apr 21, 2024
gregcusack added a commit that referenced this pull request Apr 23, 2024
* add bootstrap validator selector

* address chido: hard code startup scripts

* add library and validator structs

* upgrade rustls

* address Jon comments from PR #7

* Jon nit from PR #8. rm build_path

* chido. change up secret handling to be more flexible
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants