This repository was archived by the owner on Feb 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
add bootstrap kubernetes labels and validator management structs #9
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f025ae7
add bootstrap validator selector
gregcusack 9596709
address chido: hard code startup scripts
gregcusack 8d5f9a3
add library and validator structs
gregcusack d5a071a
upgrade rustls
gregcusack 68ac58f
address Jon comments from PR #7
gregcusack 565c8f0
Jon nit from PR #8. rm build_path
gregcusack 146a546
chido. change up secret handling to be more flexible
gregcusack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,19 @@ | ||
| use { | ||
| k8s_openapi::{api::core::v1::Secret, ByteString}, | ||
| kube::api::ObjectMeta, | ||
| std::{collections::BTreeMap, error::Error, path::PathBuf}, | ||
| std::{ | ||
| collections::{BTreeMap, HashMap}, | ||
| error::Error, | ||
| path::PathBuf, | ||
| }, | ||
| }; | ||
|
|
||
| fn create_secret(name: &str, data: BTreeMap<String, ByteString>) -> Secret { | ||
| pub enum SecretType { | ||
| Value { v: String }, | ||
| File { path: PathBuf }, | ||
| } | ||
|
|
||
| fn build_secret(name: &str, data: BTreeMap<String, ByteString>) -> Secret { | ||
| Secret { | ||
| metadata: ObjectMeta { | ||
| name: Some(name.to_string()), | ||
|
|
@@ -15,16 +24,28 @@ fn create_secret(name: &str, data: BTreeMap<String, ByteString>) -> Secret { | |
| } | ||
| } | ||
|
|
||
| pub fn create_secret_from_files( | ||
| pub fn create_secret( | ||
| secret_name: &str, | ||
| key_files: &[(PathBuf, &str)], //[pathbuf, key type] | ||
| secrets: HashMap<String, SecretType>, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Since |
||
| ) -> Result<Secret, Box<dyn Error>> { | ||
| let mut data = BTreeMap::new(); | ||
| for (file_path, key_type) in key_files { | ||
| let file_content = std::fs::read(file_path) | ||
| .map_err(|err| format!("Failed to read file '{:?}': {}", file_path, err))?; | ||
| data.insert(format!("{}.json", key_type), ByteString(file_content)); | ||
| let mut data: BTreeMap<String, ByteString> = BTreeMap::new(); | ||
| for (label, value) in secrets { | ||
| match value { | ||
| SecretType::Value { v } => { | ||
| data.insert(label, ByteString(v.into_bytes())); | ||
| } | ||
| SecretType::File { path } => { | ||
| let file_content = std::fs::read(&path) | ||
| .map_err(|err| format!("Failed to read file '{:?}': {}", path, err))?; | ||
| data.insert(label, ByteString(file_content)); | ||
| } | ||
| } | ||
|
Comment on lines
+31
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: you might be able to do this in one statement by collecting into a |
||
| } | ||
| Ok(build_secret(secret_name, data)) | ||
| } | ||
|
|
||
| Ok(create_secret(secret_name, data)) | ||
| pub fn create_selector(key: &str, value: &str) -> BTreeMap<String, String> { | ||
| let mut btree = BTreeMap::new(); | ||
| btree.insert(key.to_string(), value.to_string()); | ||
| btree | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
push_imageis usingCommand::spawninternally, it creates a new process anyway, so thepar_iteris a little overkill. You could havepush_imagereturn theprocess::Childand then iterate through them here withwait_with_output, and completely remove rayon