galuszkak commented on a change in pull request #4772: [AIRFLOW-3937]
KubernetesPodOperator support for envFrom configMapRef…
URL: https://github.com/apache/airflow/pull/4772#discussion_r264168560
##########
File path:
airflow/contrib/kubernetes/kubernetes_request_factory/kubernetes_request_factory.py
##########
@@ -140,6 +140,27 @@ def extract_env_and_secrets(pod, req):
KubernetesRequestFactory.add_secret_to_env(env, secret)
req['spec']['containers'][0]['env'] = env
+ if pod.envs_from_configmaps or pod.envs_from_secrets:
+ req['spec']['containers'][0]['envFrom'] = []
+
+ for configmap in pod.envs_from_configmaps:
+ req['spec']['containers'][0]['envFrom'].append(
+ {
+ 'configMapRef': {
+ 'name': configmap
+ }
+ }
+ )
+
+ for secret in pod.envs_from_secrets:
+ req['spec']['containers'][0]['envFrom'].append(
Review comment:
It isn't big change for me. I'm new to project so I can do whatever works
for people.
My idea initially was having 2 classes ConfigMapObject and SecretObject with
names, as they were representing K8S objects, and it was pointed out, this was
also leading to confusion why we need super simple classes. I see now, Secret
is used in at least 2 different ways (volumes, envs etc.). My fear is that this
will create some confusion for people how to use Secret.
But I will apply this change, I believe @ashb and @pgagnon You have much
better knowledge about airflow than me ;) .
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services