-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(kubernetes_logs source): Adds tests for checkpointing regressio…
…ns in k8s (#6564) * Adds tests for checkpointing regressions in k8s Signed-off-by: Ian Henry <ianjhenry00@gmail.com> * Identified problem with checkpoint test, unable to properly time out the test now Signed-off-by: Spencer Gilbert <spencer.gilbert@gmail.com> * Rewrote and fixed checkpoint test Signed-off-by: Spencer Gilbert <spencer.gilbert@gmail.com> Co-authored-by: Spencer Gilbert <spencer.gilbert@gmail.com>
- Loading branch information
Showing
4 changed files
with
174 additions
and
2 deletions.
There are no files selected for viewing
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,37 @@ | ||
//! Restart a resource rollout. | ||
use super::Result; | ||
use crate::util::run_command; | ||
use std::{ffi::OsStr, process::Stdio}; | ||
use tokio::process::Command; | ||
|
||
/// Restart a rollout of a `resource` within a `namespace` to complete | ||
/// via the specified `kubectl_command`. | ||
/// Use the `extra` field to pass additional args to `kubectl` | ||
pub async fn run<Cmd, NS, R, EX>( | ||
kubectl_command: Cmd, | ||
namespace: NS, | ||
resource: R, | ||
extra: impl IntoIterator<Item = EX>, | ||
) -> Result<()> | ||
where | ||
Cmd: AsRef<OsStr>, | ||
NS: AsRef<OsStr>, | ||
R: AsRef<OsStr>, | ||
EX: AsRef<OsStr>, | ||
{ | ||
let mut command = Command::new(kubectl_command); | ||
|
||
command | ||
.stdin(Stdio::null()) | ||
.stdout(Stdio::inherit()) | ||
.stderr(Stdio::inherit()); | ||
|
||
command.arg("rollout").arg("restart"); | ||
command.arg("-n").arg(namespace); | ||
command.arg(resource); | ||
command.args(extra); | ||
|
||
run_command(command).await?; | ||
Ok(()) | ||
} |