Skip to content

Conversation

@dimon222
Copy link
Contributor

@dimon222 dimon222 commented Jul 13, 2021

closes: #16611

Affects - KubernetesPodOperator's pod id naming notation

Fix for various issues related to container's IP self-resolution in Kubernetes. Period is typically interpreted as current container is having some level domain instead of dummy hostname that cannot be resolved from outside.
Previously, the container already had hyphen in name, but now period caused regressions.

See #16611 for more clarification and exact line references.

@dimon222 dimon222 requested a review from dimberman as a code owner July 13, 2021 21:31
@boring-cyborg boring-cyborg bot added the provider:cncf-kubernetes Kubernetes (k8s) provider related issues label Jul 13, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Jul 13, 2021

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@potiuk
Copy link
Member

potiuk commented Jul 19, 2021

Could you please rebase to latest main?

@jedcunningham
Copy link
Member

@dimon222, this effort is already underway in #16636. Maybe you could coordinate with @SimonOsipov to see if you can collaborate?

@uranusjr
Copy link
Member

Actually I think the final solution implemented in #17057 happens to also cover this?

@uranusjr uranusjr closed this Jul 21, 2021
@uranusjr uranusjr reopened this Jul 21, 2021
@uranusjr
Copy link
Member

Oh, not really, this addresses some cases not covered by #17057 (nor #16636!) so we still need this PR.

trimmed_pod_id = pod_id[:MAX_LABEL_LEN].rstrip('-.')

safe_pod_id = f"{trimmed_pod_id}.{safe_uuid}"
safe_pod_id = f"{trimmed_pod_id}-{safe_uuid}"
Copy link
Contributor

@wyattshapiro wyattshapiro Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case that the pod_id is long enough, then there will be an error even with the trimming introduced to prevent this error from occurring. This is because the safe_pod_id name appends the safe_uuid after trimming, which would make the returned label greater than the allowable label length MAX_LABEL_LEN.

Should the trimming occur after the safe pod id is constructed?

Copy link
Contributor Author

@dimon222 dimon222 Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid point, but we also can't trim the result name, since it might cause collisions. Since we ensure that trimmed_pod_id is limited, all we need to ensure is that uuid is limited too. Now, knowing that safe_uuid is static length, we can calculate the exact leftover space for trimmed_pod_id.

In other words, if length is the initial problem of nearby ticket, I would go with something like:

trimmed_pod_id = pod_id[:MAX_LABEL_LEN-len(safe_uuid)].rstrip('-.')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like the right solution to me. Could you update the PR to use this?

A comment explaining why the various cleanups are needed would also be nice.

@github-actions
Copy link

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

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Sep 18, 2021
@dimon222
Copy link
Contributor Author

Anything specific is required on this?

@github-actions github-actions bot removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Sep 19, 2021
@github-actions
Copy link

github-actions bot commented Nov 9, 2021

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

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Nov 9, 2021
@dimon222
Copy link
Contributor Author

dimon222 commented Nov 9, 2021

Closing in favor of better written #19036

@dimon222 dimon222 closed this Nov 9, 2021
@dimon222 dimon222 deleted the patch-2 branch November 9, 2021 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider:cncf-kubernetes Kubernetes (k8s) provider related issues stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pod name with period is causing issues for some apps in k8s

5 participants