(client *http.Client, endpoint string, tokenFile string)
| 331 | } |
| 332 | |
| 333 | func getEKSPodIdentityCredentials(client *http.Client, endpoint string, tokenFile string) (ec2RoleCredRespBody, error) { |
| 334 | if tokenFile != "" { |
| 335 | bytes, err := os.ReadFile(tokenFile) |
| 336 | if err != nil { |
| 337 | return ec2RoleCredRespBody{}, fmt.Errorf("getEKSPodIdentityCredentials: failed to read token file:%s", err) |
| 338 | } |
| 339 | token := string(bytes) |
| 340 | return getEcsTaskCredentials(client, endpoint, token) |
| 341 | } |
| 342 | return ec2RoleCredRespBody{}, fmt.Errorf("getEKSPodIdentityCredentials: no tokenFile found") |
| 343 | } |
| 344 | |
| 345 | func fetchIMDSToken(client *http.Client, endpoint string) (string, error) { |
| 346 | ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
no test coverage detected