Alberto Llamas 3 years ago
parent
commit
e31a408e1d

+ 0 - 3
deploy/charts/external-secrets/templates/deployment.yaml

@@ -69,9 +69,6 @@ spec:
           {{- if .Values.concurrent }}
           - --concurrent={{ .Values.concurrent }}
           {{- end }}
-          {{- if .Values.enableAWSSession }}
-          - --experimental-enable-aws-session-cache={{ .Values.enableAWSSession }}
-          {{- end }}
           {{- range $key, $value := .Values.extraArgs }}
             {{- if $value }}
           - --{{ $key }}={{ $value }}

+ 0 - 3
deploy/charts/external-secrets/values.yaml

@@ -48,9 +48,6 @@ createOperator: true
 # a time.
 concurrent: 1
 
-# -- If set External secret will reuse the AWS session without creating a new one on each request.
-enableAWSSession: false
-
 serviceAccount:
   # -- Specifies whether a service account should be created.
   create: true

+ 13 - 22
pkg/provider/aws/auth/auth.go

@@ -243,34 +243,21 @@ func DefaultSTSProvider(sess *session.Session) stsiface.STSAPI {
 // getAWSSession check if an AWS session should be reused
 // it returns the aws session or an error.
 func getAWSSession(config *aws.Config, store esv1beta1.GenericStore, namespace string) (*session.Session, error) {
-	if EnableCache {
-		tmpSession := SessionCache{
-			Name:            store.GetObjectMeta().Name,
-			Namespace:       namespace,
-			Kind:            store.GetTypeMeta().Kind,
-			ResourceVersion: store.GetObjectMeta().ResourceVersion,
-		}
-
-		_, ok := sessions[tmpSession]
+	tmpSession := SessionCache{
+		Name:            store.GetObjectMeta().Name,
+		Namespace:       namespace,
+		Kind:            store.GetTypeMeta().Kind,
+		ResourceVersion: store.GetObjectMeta().ResourceVersion,
+	}
 
+	if EnableCache {
+		sess, ok := sessions[tmpSession]
 		if ok {
 			log.Info("reusing aws session", "SecretStore", tmpSession.Name, "namespace", tmpSession.Namespace, "kind", tmpSession.Kind, "resourceversion", tmpSession.ResourceVersion)
-			sess := sessions[tmpSession]
 			return sess, nil
 		}
-		handlers := defaults.Handlers()
-		handlers.Build.PushBack(request.WithAppendUserAgent("external-secrets"))
-		sess, err := session.NewSessionWithOptions(session.Options{
-			Config:            *config,
-			Handlers:          handlers,
-			SharedConfigState: session.SharedConfigDisable,
-		})
-		if err != nil {
-			return nil, err
-		}
-		sessions[tmpSession] = sess
-		return sess, nil
 	}
+
 	handlers := defaults.Handlers()
 	handlers.Build.PushBack(request.WithAppendUserAgent("external-secrets"))
 	sess, err := session.NewSessionWithOptions(session.Options{
@@ -281,5 +268,9 @@ func getAWSSession(config *aws.Config, store esv1beta1.GenericStore, namespace s
 	if err != nil {
 		return nil, err
 	}
+
+	if EnableCache {
+		sessions[tmpSession] = sess
+	}
 	return sess, nil
 }