Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-5215] Add sidecar containers support to Pod class #5824

Closed
wants to merge 1 commit into from

Conversation

pgagnon
Copy link
Contributor

@pgagnon pgagnon commented Aug 14, 2019

Make sure you have checked all steps below.

Jira

  • My PR addresses the following Airflow Jira issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"
    • https://issues.apache.org/jira/browse/AIRFLOW-XXX
    • In case you are fixing a typo in the documentation you can prepend your commit with [AIRFLOW-XXX], code changes always need a Jira issue.
    • In case you are proposing a fundamental code change, you need to create an Airflow Improvement Proposal (AIP).
    • In case you are adding a dependency, check if the license complies with the ASF 3rd Party License Policy.

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Adds a sidecar_containers argument to Pod, allowing users to pass a list of sidecar container definitions to add to the Pod. This is notably useful with the pod mutation hook.

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

  • test_extract_sidecar_containers.

Commits

  • 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
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

Pod's docstring is currently not up to date. Will address in a subsequent PR.

Code Quality

  • Passes flake8

@pgagnon
Copy link
Contributor Author

pgagnon commented Aug 14, 2019

@ashb @dimberman

@pgagnon
Copy link
Contributor Author

pgagnon commented Aug 15, 2019

Test failure seems unrelated.

@cBournhonesque
Copy link
Contributor

Do we want to treat sidecar containers differently then the main container?
Shouldn't the API allow for the creation of multiple containers? (for instance by passing lists for each argument)

@pgagnon
Copy link
Contributor Author

pgagnon commented Aug 15, 2019

@cBournhonesque At this time I am trying keep this as API-compatible as possible. Changing the Pod interface to accept a list of containers would indeed be preferable but this would be a breaking change since the main container is built by combining other arguments (i.e. image).

@pgagnon
Copy link
Contributor Author

pgagnon commented Aug 29, 2019

@dimberman PTAL when you have a chance.

@ashb
Copy link
Member

ashb commented Sep 6, 2019

Does this have the problem where the task won't finish as long as the sidecar container is still alive? Do we need an option to kill the sidecar when the main pod finishes?

@pgagnon
Copy link
Contributor Author

pgagnon commented Sep 6, 2019

Does this have the problem where the task won't finish as long as the sidecar container is still alive? Do we need an option to kill the sidecar when the main pod finishes?

@ashb Yes, it does. This PR is basically a bandaid to allow users to add sidecars with the pod mutation hook.

Users have a couple of options to kill the sidecar when the main container exits:

  • Give the sidecar API access and check the pod's status;
  • Have the main container write a heartbeat to a volume shared with the sidecar

Obviously both these methods are rather hackish, but I can't immediately think of a straightforward way to kill the sidecar when the main container exits, that would support both KubernetesPodOperator and KubernetesExecutor.

@stale
Copy link

stale bot commented Nov 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Nov 20, 2019
@pgagnon pgagnon closed this Nov 20, 2019
@pgagnon pgagnon deleted the AIRFLOW-5215 branch June 19, 2021 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale PRs per the .github/workflows/stale.yml policy file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants