airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (AIRFLOW-3381) KubernetesPodOperator: Use secretKeyRef or configMapKeyRef in env_vars
Date Thu, 22 Nov 2018 00:10:00 GMT


ASF GitHub Bot commented on AIRFLOW-3381:

abrenaut opened a new pull request #4221: [AIRFLOW-3381] Allow use of secretKeyRef or configMapKeyRef
in env_vars
   Make sure you have checked _all_ steps below.
   ### Jira
   - [x] My PR addresses the following [Airflow Jira](
issues and references them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
   ### Description
   - [x] Here are some details about my PR, including screenshots of any UI changes:
   Updated the KubernetesRequestFactory.extract_env_and_secrets() static method to support
`valueFrom` for environment variables.
   ### Tests
   - [x] My PR adds the following unit tests __OR__ does not need testing for this extremely
good reason:
   ### Commits
   - [x] My commits all reference Jira issues in their subject lines, and I have squashed
multiple commits if they address the same issue. In addition, my commits follow the guidelines
from "[How to write a good git commit message](":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   ### Documentation
   - [x] In case of new functionality, my PR adds documentation that describes how to use
     - When adding new operators/hooks/sensors, the autoclass documentation generation needs
to be added.
   ### Code Quality
   - [x] Passes `flake8`

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> KubernetesPodOperator: Use secretKeyRef or configMapKeyRef in env_vars
> ----------------------------------------------------------------------
>                 Key: AIRFLOW-3381
>                 URL:
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: kubernetes
>    Affects Versions: 1.10.0
>            Reporter: Arthur Brenaut
>            Priority: Major
> The env_vars attribute of the KubernetesPodOperator allows to pass environment variables
as string but it doesn't allows to pass a value from a configmap or a secret.
> I'd like to be able to do
> {code:java}
> modeling = KubernetesPodOperator(
>  ...
>  env_vars={
>   'MY_ENV_VAR': {
>    'valueFrom': {
>     'secretKeyRef': {
>      'name': 'an-already-existing-secret',
>      'key': 'key',
>    }
>   }
>  },
>  ...
> )
> {code}
> Right now if I do that, Airflow generates the following config
> {code:java}
> - name: MY_ENV_VAR
>   value:
>    valueFrom:
>     configMapKeyRef:
>      name: an-already-existing-secret
>      key: key
> {code}
> instead of 
> {code:java}
> - name: MY_ENV_VAR
>   valueFrom:
>    configMapKeyRef:
>     name: an-already-existing-secret
>     key: key
> {code}
> The _extract_env_and_secrets_ method of the _KubernetesRequestFactory_ could check if
the value is a dictionary and use it directly.

This message was sent by Atlassian JIRA

View raw message