diff --git a/aws.go b/aws.go index 346f667..9249d69 100644 --- a/aws.go +++ b/aws.go @@ -182,7 +182,9 @@ func PullIamCredentialsFromAWSWithIMDSv2() (AWSCredentials, error) { return credentials, err } - // println("DEBUG: Got IMDSv2 token: " + string(token)) + if Verbose { + println("DEBUG: Got IMDSv2 token: " + string(token)) + } // REQUEST 2: Get the account/role name accountURL := "http://169.254.169.254/latest/meta-data/iam/security-credentials/" @@ -208,7 +210,9 @@ func PullIamCredentialsFromAWSWithIMDSv2() (AWSCredentials, error) { fmt.Println("Error reading security credentials:", err) return credentials, err } - // fmt.Println("DEBUG: Role Name:", string(accountName)) + if Verbose { + fmt.Println("DEBUG: Role Name:", string(accountName)) + } // REQUEST 3: Get the security credentials credURL := accountURL + string(accountName) @@ -233,8 +237,9 @@ func PullIamCredentialsFromAWSWithIMDSv2() (AWSCredentials, error) { fmt.Println("Error reading security credentials:", err) return credentials, err } - // fmt.Println("DEBUG Credentials:", string(temporaryCredentials)) - + if Verbose { + fmt.Println("DEBUG Credentials:", string(temporaryCredentials)) + } // Parse result as an account, then construct a request asking for that account's credentials err = json.Unmarshal(temporaryCredentials, &credentials) diff --git a/kubectl_wrappers.go b/kubectl_wrappers.go index c094a60..539919f 100644 --- a/kubectl_wrappers.go +++ b/kubectl_wrappers.go @@ -188,6 +188,9 @@ func runKubectlWithConfig(cfg ServerInfo, stdin io.Reader, stdout, stderr io.Wri connArgs = append(connArgs, "--client-key="+keyTmpFile.Name()) } + if Verbose { + println("DEBUG: Running kubectl with the following arguments: ", connArgs) + } return runKubectl(stdin, stdout, stderr, append(connArgs, cmdArgs...)...) } diff --git a/peirates.go b/peirates.go index acb4838..d291c3c 100644 --- a/peirates.go +++ b/peirates.go @@ -27,7 +27,7 @@ var UseAuthCanI bool = true // Main starts Peirates[] func Main() { // Peirates version string - var version = "1.1.20" + var version = "1.1.21a" var err error diff --git a/service_account_utils.go b/service_account_utils.go index 2e42d11..891006c 100644 --- a/service_account_utils.go +++ b/service_account_utils.go @@ -135,6 +135,9 @@ func assignAuthenticationCertificateAndKeyToConnection(keypair ClientCertificate info.ClientKeyData = keypair.ClientKeyData info.ClientCertName = keypair.Name info.APIServer = keypair.APIServer + if Verbose { + println("DEBUG: Switching API server to: " + info.APIServer) + } info.Namespace = "default" // Zero out any service account token, so it's clear what to authenticate with.