o-nikolas commented on code in PR #35771:
URL: https://github.com/apache/airflow/pull/35771#discussion_r1401293160


##########
airflow/providers/amazon/aws/hooks/eks.py:
##########
@@ -521,6 +521,33 @@ def generate_config_file(
         :param eks_cluster_name: The name of the cluster to generate 
kubeconfig file for.
         :param pod_namespace: The namespace to run within kubernetes.
         """
+        args = ""
+        if self.region_name is not None:
+            args = args + f" --region-name {self.region_name}"
+
+        if self.aws_conn_id is not None:
+            args = args + f" --aws-conn-id {self.aws_conn_id}"
+
+        python_executable = 
f"python{sys.version_info[0]}.{sys.version_info[1]}"

Review Comment:
   Can you leave a comment here explaining why this is necessary



##########
tests/providers/amazon/aws/hooks/test_eks.py:
##########
@@ -1198,6 +1198,27 @@ def test_create_fargate_selectors(self, cluster_builder, 
selectors, expected_mes
 
 
 class TestEksHook:
+    python_executable = f"python{sys.version_info[0]}.{sys.version_info[1]}"
+    COMMAND = """

Review Comment:
   Can we move the `COMMAND` declaration to the module level of the Hook and 
then use `EksHook.COMMAND` here, otherwise that script and the copy here may 
drift from each other if someone changes the script in src and forgets to 
update this one.



##########
airflow/providers/amazon/aws/utils/eks_get_token.py:
##########
@@ -58,13 +57,7 @@ def main():
     eks_hook = EksHook(aws_conn_id=args.aws_conn_id, 
region_name=args.region_name)
     access_token = eks_hook.fetch_access_token_for_cluster(args.cluster_name)
     access_token_expiration = get_expiration_time()
-    exec_credential_object = {
-        "kind": "ExecCredential",
-        "apiVersion": "client.authentication.k8s.io/v1alpha1",
-        "spec": {},
-        "status": {"expirationTimestamp": access_token_expiration, "token": 
access_token},
-    }
-    print(json.dumps(exec_credential_object))
+    print(f"expirationTimestamp: {access_token_expiration}, token: 
{access_token}")

Review Comment:
   Printing the timestamp and token on separate lines would make your 
grepping/regex a little easier in the wrapper script. But just a suggestion, no 
need to change if you're happy with how it's implemented now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to