NotYuki commented on code in PR #33680:
URL: https://github.com/apache/airflow/pull/33680#discussion_r1399693498


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -706,10 +715,51 @@ def post_complete_action(self, *, pod, remote_pod, 
**kwargs):
             remote_pod=remote_pod,
         )
 
+    def setup_connection_secrets(self, context):
+        """Create Kubernetes secrets based on Airflow connections."""
+        for s in self.connection_secrets:
+            name = 
f"{context['dag'].dag_id}-{context['task_instance'].task_id}-{_rand_str(8)}"
+            s.secret = name
+            self.log.info("Creating kubernetes secret %s based on connection 
%s", name, s.conn_id)
+            conn = Connection.get_connection_from_secrets(s.conn_id)
+            secret_body = {
+                "extra": conn.extra,
+                "host": conn.host,
+                "login": conn.login,
+                "password": conn.password,
+                "port": conn.port,
+                "schema": conn.schema,
+            }
+            # create secret
+            self.client.create_namespaced_secret(

Review Comment:
   What would happen if we pass multiple Secret objects with the same conn_id 
but different keys to KPO? Is it accurate to say that, for each Secret, this 
code will generate a complete Kubernetes secret with six keys, mapping only one 
key from each secret to a specific environment variable in the pod?



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to