You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EKS Pod Identity support for pod level credentials (#458)
*Description of changes:* With this change, we will support the
configuration of pod level credentials with EKS Pod Identity. In EKS
clusters, this is an alternative to IRSA with an easier configuration
process.
*Key Changes:*
- Credential Provider
- In `provider_pod.go` the precedence is given to IRSA credentials. If
they are not configured, then EKS Pod Identity credentials are forwarded
to the Mountpoint process instead.
- Added unit tests
- Testing
- Added E2E tests covering EKS Pod Identity setup scenarios with IAM
roles of varying levels of S3 access
- Added one pod level IRSA E2E test to make sure driver level EKS Pod
Identity is not used instead
- Added E2E tests covering setup scenario of IRSA and EKS Pod Identity
- Manual testing performed on personal EKS cluster
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
---------
Signed-off-by: Renan Magagnin <renanmag@amazon.co.uk>
// TODO: Add a driver configuration flag to handle custom values of podIdentityCredURI. Currently we are assuming the default IPv4 address as determined in the references below:
klog.V(4).Infof("credentialprovider: Using pod identity")
37
43
44
+
podID:=provideCtx.GetCredentialPodID()
45
+
ifpodID=="" {
46
+
returnnil, status.Error(codes.InvalidArgument, "Missing Pod info. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage)
47
+
}
48
+
49
+
// 1. Parse ServiceAccountTokens map
38
50
tokensJson:=provideCtx.ServiceAccountTokens
39
51
iftokensJson=="" {
40
52
klog.Error("credentialprovider: `authenticationSource` configured to `pod` but no service account tokens are received. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage)
klog.Errorf("credentialprovider: `authenticationSource` configured to `pod` but no service account tokens for %s received. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage, serviceAccountTokenAudienceSTS)
63
+
klog.Errorf("credentialprovider: `authenticationSource` configured to `pod` but no service account token for %s received. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage, serviceAccountTokenAudienceSTS)
52
64
returnnil, status.Errorf(codes.InvalidArgument, "Missing service account token for %s", serviceAccountTokenAudienceSTS)
returnnil, status.Error(codes.InvalidArgument, "Missing Pod info. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage)
klog.Errorf("credentialprovider: `authenticationSource` configured to `pod` but no service account token for %s received. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage, serviceAccountTokenAudiencePodIdentity)
70
+
returnnil, status.Errorf(codes.InvalidArgument, "Missing service account token for %s", serviceAccountTokenAudiencePodIdentity)
81
71
}
82
72
73
+
// 2. Create environment to be returned with common variables (used in both cases: IRSA and EKS PI)
klog.Error("credentialprovider: `authenticationSource` configured to `pod` but no pod info found. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage)
125
169
return"", status.Error(codes.InvalidArgument, "Missing Pod info. Please make sure to enable `podInfoOnMountCompat`, see "+podLevelCredentialsDocsPage)
klog.Error("credentialprovider: `authenticationSource` configured to `pod` but pod's service account is not annotated with a role, see "+podLevelCredentialsDocsPage)
136
-
return"", status.Errorf(codes.InvalidArgument, "Missing role annotation on pod's service account %s/%s", podNamespace, podServiceAccount)
// createEKSPodIdentityCredentialsEnvironment creates an environment with the environment variables needed for pod-level authentication with EKS Pod Identity
0 commit comments