Skip to content

Commit 9cfaff2

Browse files
committed
Added more DEBUG messages
1 parent 52fe61d commit 9cfaff2

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

aws.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ func PullIamCredentialsFromAWSWithIMDSv2() (AWSCredentials, error) {
182182
return credentials, err
183183
}
184184

185-
// println("DEBUG: Got IMDSv2 token: " + string(token))
185+
if Verbose {
186+
println("DEBUG: Got IMDSv2 token: " + string(token))
187+
}
186188

187189
// REQUEST 2: Get the account/role name
188190
accountURL := "http://169.254.169.254/latest/meta-data/iam/security-credentials/"
@@ -208,7 +210,9 @@ func PullIamCredentialsFromAWSWithIMDSv2() (AWSCredentials, error) {
208210
fmt.Println("Error reading security credentials:", err)
209211
return credentials, err
210212
}
211-
// fmt.Println("DEBUG: Role Name:", string(accountName))
213+
if Verbose {
214+
fmt.Println("DEBUG: Role Name:", string(accountName))
215+
}
212216

213217
// REQUEST 3: Get the security credentials
214218
credURL := accountURL + string(accountName)
@@ -233,8 +237,9 @@ func PullIamCredentialsFromAWSWithIMDSv2() (AWSCredentials, error) {
233237
fmt.Println("Error reading security credentials:", err)
234238
return credentials, err
235239
}
236-
// fmt.Println("DEBUG Credentials:", string(temporaryCredentials))
237-
240+
if Verbose {
241+
fmt.Println("DEBUG Credentials:", string(temporaryCredentials))
242+
}
238243
// Parse result as an account, then construct a request asking for that account's credentials
239244

240245
err = json.Unmarshal(temporaryCredentials, &credentials)

kubectl_wrappers.go

+3
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ func runKubectlWithConfig(cfg ServerInfo, stdin io.Reader, stdout, stderr io.Wri
188188
connArgs = append(connArgs, "--client-key="+keyTmpFile.Name())
189189
}
190190

191+
if Verbose {
192+
println("DEBUG: Running kubectl with the following arguments: ", connArgs)
193+
}
191194
return runKubectl(stdin, stdout, stderr, append(connArgs, cmdArgs...)...)
192195
}
193196

peirates.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var UseAuthCanI bool = true
2727
// Main starts Peirates[]
2828
func Main() {
2929
// Peirates version string
30-
var version = "1.1.20"
30+
var version = "1.1.21a"
3131

3232
var err error
3333

service_account_utils.go

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ func assignAuthenticationCertificateAndKeyToConnection(keypair ClientCertificate
135135
info.ClientKeyData = keypair.ClientKeyData
136136
info.ClientCertName = keypair.Name
137137
info.APIServer = keypair.APIServer
138+
if Verbose {
139+
println("DEBUG: Switching API server to: " + info.APIServer)
140+
}
138141
info.Namespace = "default"
139142

140143
// Zero out any service account token, so it's clear what to authenticate with.

0 commit comments

Comments
 (0)