-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: working open vscode ide and check install extension
- Loading branch information
Showing
6 changed files
with
196 additions
and
5 deletions.
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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use k8s_openapi::api::core::v1::Pod; | ||
|
||
#[tracing::instrument(level = "trace")] | ||
pub fn select_pod(target_name: Option<String>, pod: Pod) -> Option<String> { | ||
match target_name { | ||
Some(container_named) => { | ||
if !pod | ||
.spec | ||
.clone() | ||
.unwrap() | ||
.containers | ||
.into_iter() | ||
.any(|c| c.name == container_named) | ||
{ | ||
tracing::error!( | ||
"Pod does not have container : {}", | ||
container_named.to_string() | ||
); | ||
return None; | ||
} | ||
Some(container_named) | ||
} | ||
None => match pod.spec.unwrap().containers.first() { | ||
Some(container) => { | ||
tracing::info!("Using first container : {}", container.name.to_string()); | ||
Some(container.name.to_string()) | ||
} | ||
None => { | ||
tracing::error!("No container in the pod ? what did you do?"); | ||
return None; | ||
} | ||
}, | ||
} | ||
} |