Commit Diff


commit - 32b0846d719e8a715b7b75099e05436888193d89
commit + 1fa377d00e3160143dcf87e9ff87fbd42fbc5eae
blob - 1f87746fa55e94edf98a912f632ed8efa1bc8dc0
blob + a476f3b141c67924bd2e24dfbe31c642758df95b
--- crates/kops_aws_sso/Cargo.toml
+++ crates/kops_aws_sso/Cargo.toml
@@ -15,9 +15,9 @@ description.workspace = true
 [dependencies]
 anyhow.workspace = true
 aws-config.workspace = true
-aws-sdk-ssooidc.workspace = true
-aws-sdk-sso.workspace = true
 aws-credential-types.workspace = true
+aws-sdk-sso.workspace = true
+aws-sdk-ssooidc.workspace = true
 chrono.workspace = true
 tokio.workspace = true
 
blob - 17b4f765a1bd3553dbc1ec7228370f02c8261922
blob + 2c19e0b681afb8959610e668a41f2be2e5f590bb
--- crates/kops_aws_sso/src/lib.rs
+++ crates/kops_aws_sso/src/lib.rs
@@ -128,35 +128,43 @@ where
                     break;
                 }
                 Err(e) => {
-                let code = e.code().unwrap_or("Unknown");
-                let msg  = e.message().unwrap_or("");
+                    let code = e.code().unwrap_or("Unknown");
+                    let msg = e.message().unwrap_or("");
 
-                match code {
-                    "AuthorizationPendingException" => {
-                        sleep(std::time::Duration::from_secs(interval_secs)).await;
-                        continue;
+                    match code {
+                        "AuthorizationPendingException" => {
+                            sleep(std::time::Duration::from_secs(
+                                interval_secs,
+                            ))
+                            .await;
+                            continue;
+                        }
+                        "SlowDownException" => {
+                            interval_secs += 5;
+                            sleep(std::time::Duration::from_secs(
+                                interval_secs,
+                            ))
+                            .await;
+                            continue;
+                        }
+                        "ExpiredTokenException" => {
+                            return Err(anyhow::anyhow!(
+                                "Device authorization expired (ExpiredTokenException): {msg}"
+                            ));
+                        }
+                        _ => {
+                            return Err(anyhow::anyhow!(
+                                "CreateToken failed: {code}: {msg}"
+                            ));
+                        }
                     }
-                    "SlowDownException" => {
-                        interval_secs += 5;
-                        sleep(std::time::Duration::from_secs(interval_secs)).await;
-                        continue;
-                    }
-                    "ExpiredTokenException" => {
-                        return Err(anyhow::anyhow!(
-                            "Device authorization expired (ExpiredTokenException): {msg}"
-                        ));
-                    }
-                    _ => {
-                        return Err(anyhow::anyhow!(
-                            "CreateToken failed: {code}: {msg}"
-                        ));
-                    }
                 }
             }
-            }
         }
 
-        access_token.ok_or_else(|| anyhow!("did not obtain access_token before timeout"))?
+        access_token.ok_or_else(|| {
+            anyhow!("did not obtain access_token before timeout")
+        })?
     };
 
     let sso_client = sso::Client::new(sdk_config);
@@ -174,12 +182,13 @@ where
         .ok_or_else(|| anyhow!("missing roleCredentials"))?;
 
     let access_key_id = must(role_creds.access_key_id(), "accessKeyId")?;
-    let secret_access_key = must(role_creds.secret_access_key(), "secretAccessKey")?;
+    let secret_access_key =
+        must(role_creds.secret_access_key(), "secretAccessKey")?;
     let session_token = must(role_creds.session_token(), "sessionToken")?;
 
     let expires_ms = role_creds.expiration();
-    let expires_at =
-        DateTime::<Utc>::from(SystemTime::UNIX_EPOCH) + Duration::milliseconds(expires_ms);
+    let expires_at = DateTime::<Utc>::from(SystemTime::UNIX_EPOCH)
+        + Duration::milliseconds(expires_ms);
 
     let creds = Credentials::new(
         access_key_id,
@@ -198,6 +207,5 @@ where
 }
 
 fn must(v: Option<&str>, name: &str) -> Result<String> {
-    v.ok_or_else(|| anyhow!("missing {name}"))
-        .map(|s| s.to_string())
+    v.ok_or_else(|| anyhow!("missing {name}")).map(|s| s.to_string())
 }
blob - e4e220b13c5171d236cbb61100ac24acf7d1438e
blob + e6280c624983fb18db1dd07b68481404b8d6514a
--- crates/kops_eks/Cargo.toml
+++ crates/kops_eks/Cargo.toml
@@ -6,19 +6,19 @@ edition = "2024"
 [dependencies]
 anyhow = "1"
 aws-config = { version = "1", features = ["behavior-version-latest"] }
-aws-sdk-eks = "1"
 aws-credential-types = "1"
+aws-sdk-eks = "1"
+aws-sdk-sts = "1.94.0"
 aws-sigv4 = "1"
-http = "1"
+aws-smithy-runtime-api = "1.9.2"
 base64 = "0.22"
-kube = { version = "0.91", features = ["client", "rustls-tls"] }
+http = "1"
 k8s-openapi = { version = "0.22", features = ["v1_30"] }
-tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
-aws-smithy-runtime-api = "1.9.2"
+kube = { version = "0.91", features = ["client", "rustls-tls"] }
+pem = "3.0.6"
+percent-encoding = "2.3"
 rustls = { version = "0.23", default-features = false, features = ["ring"] }
 rustls-pemfile = "2"
-aws-sdk-sts = "1.94.0"
-urlencoding = "2.1"
-percent-encoding = "2.3"
+tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
 url = "2.5.7"
-pem = "3.0.6"
+urlencoding = "2.1"
blob - cc56ce3257a24b2db2485fb4ab0d4875dea69737
blob + af49952d19701b111d829f21a24b2bcc32addb14
--- crates/kops_eks/src/main.rs
+++ crates/kops_eks/src/main.rs
@@ -33,7 +33,8 @@ async fn main() -> Result<()> {
 
     let token = main2(cluster_name, region).await?;
 
-    let (eks_cluster_url, eks_cluster_cert) = eks_k8s_cluster_info(cluster_name).await?;
+    let (eks_cluster_url, eks_cluster_cert) =
+        eks_k8s_cluster_info(cluster_name).await?;
 
     let kubeconfig = kube::Config {
         cluster_url: eks_cluster_url,
@@ -60,8 +61,11 @@ async fn main() -> Result<()> {
     Ok(())
 }
 
-pub async fn eks_k8s_cluster_info(cluster_name: &str) -> Result<(http::Uri, Vec<Vec<u8>>)> {
-    let sdk_config = aws_config::load_defaults(BehaviorVersion::latest()).await;
+pub async fn eks_k8s_cluster_info(
+    cluster_name: &str,
+) -> Result<(http::Uri, Vec<Vec<u8>>)> {
+    let sdk_config =
+        aws_config::load_defaults(BehaviorVersion::latest()).await;
     let client = eks::Client::new(&sdk_config);
 
     let resp = client.describe_cluster().name(cluster_name).send().await?;
@@ -82,7 +86,8 @@ pub async fn eks_k8s_cluster_info(cluster_name: &str) 
 }
 
 pub async fn main2(cluster_name: &str, region: &str) -> Result<String> {
-    let sdk_config = aws_config::load_defaults(BehaviorVersion::latest()).await;
+    let sdk_config =
+        aws_config::load_defaults(BehaviorVersion::latest()).await;
     let credentials = sdk_config
         .credentials_provider()
         .ok_or_else(|| anyhow!("no credentials provider in sdk_config"))?
@@ -110,8 +115,9 @@ pub async fn main2(cluster_name: &str, region: &str) -
         }
     };
 
-    let url =
-        format!("https://sts.{region}.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15");
+    let url = format!(
+        "https://sts.{region}.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15"
+    );
     let headers = vec![("x-k8s-aws-id", cluster_name)];
     let signable_request = SignableRequest::new(
         "GET",
blob - 886d58d7faf23ec9cba9edc69fc1f45459d48b42
blob + 43432947585484fa38e8a33be74f46bd0634e198
--- kopsctl/src/cmd/pods.rs
+++ kopsctl/src/cmd/pods.rs
@@ -48,7 +48,12 @@ fn print_pods(pods: &Vec<PodSummary>, failed_only: boo
             if let Some(msg) = &p.message {
                 println!(
                     "{:<20} {:<20} {:<30} {:<10} {:<10} {:<10}",
-                    p.cluster, p.namespace, p.name, p.ready, p.restart_count, msg
+                    p.cluster,
+                    p.namespace,
+                    p.name,
+                    p.ready,
+                    p.restart_count,
+                    msg
                 );
             } else {
                 println!(
@@ -56,7 +61,6 @@ fn print_pods(pods: &Vec<PodSummary>, failed_only: boo
                     p.cluster, p.namespace, p.name, p.ready, p.restart_count,
                 );
             }
-
         } else {
             println!(
                 "{:<20} {:<20} {:<30} {:<10} {:<10}",