Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion policy-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ where
.await;
tracing::trace!(?ns);
tokio::time::timeout(
tokio::time::Duration::from_secs(60),
tokio::time::Duration::from_secs(15),
await_service_account(&client, &ns.name_unchecked(), "default"),
)
.await
Expand Down Expand Up @@ -758,6 +758,17 @@ pub async fn await_service_account(client: &kube::Client, ns: &str, name: &str)
use futures::StreamExt;

tracing::trace!(%name, %ns, "Waiting for serviceaccount");

// First check if it already exists
if kube::Api::<k8s::ServiceAccount>::namespaced(client.clone(), ns)
.get(name)
.await
.is_ok()
{
return;
}
tracing::trace!("The serviceaccount does not yet exist; watching");

tokio::pin! {
let sas = kube::runtime::watcher(
kube::Api::<k8s::ServiceAccount>::namespaced(client.clone(), ns),
Expand Down