You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/20 23:36:36 UTC
[GitHub] [airflow] melugoyal opened a new pull request, #28511: allow a configurable prefix to pod names created for kubernetes executor
melugoyal opened a new pull request, #28511:
URL: https://github.com/apache/airflow/pull/28511
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
Allow worker pods created by Kubernetes Executor to be prefixed by a configurable string. The prefix defaults to the empty string.
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #28511: allow a configurable prefix to pod names created for kubernetes executor
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #28511:
URL: https://github.com/apache/airflow/pull/28511#issuecomment-1360476012
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]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) 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](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) 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](https://www.apache.org/foundation/policies/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]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
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
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] steveyz-astro commented on pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
steveyz-astro commented on PR #28511:
URL: https://github.com/apache/airflow/pull/28511#issuecomment-1361775059
> Hi @melugoyal
>
> Thanks for the PR
>
> This seems like something you could use [task policy](https://airflow.apache.org/docs/apache-airflow/stable/concepts/cluster-policies.html#task-policies) to accomplish. What do you think?
How would task policy apply in this case if the goal is to apply a prefix to the pod name generated by the kubernetes executor? Seems to me that is a property of what executor is being used, rather than a property of a task itself?
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] melugoyal commented on a diff in pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
melugoyal commented on code in PR #28511:
URL: https://github.com/apache/airflow/pull/28511#discussion_r1053849270
##########
airflow/config_templates/config.yml:
##########
@@ -2544,6 +2544,13 @@
type: boolean
example: ~
default: "True"
+ - name: worker_pods_name_prefix
+ description: |
+ Prefix to be added to the beginning of worker pods' names
+ version_added: 2.6.0
Review Comment:
i'm unsure if this is correct. @jedcunningham @dstandish
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] melugoyal commented on pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
melugoyal commented on PR #28511:
URL: https://github.com/apache/airflow/pull/28511#issuecomment-1361906771
@dstandish is the suggestion to use TaskPolicy to mutate the dag_id or task_id which is currently used to construct the pod names? i think that technically could be achieved since the DAG object has knowledge of the executor. but it feels slightly hacky to modify the dag_id rather than explicitly add a prefix when needed
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] melugoyal commented on a diff in pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
melugoyal commented on code in PR #28511:
URL: https://github.com/apache/airflow/pull/28511#discussion_r1053848453
##########
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py:
##########
@@ -91,6 +91,7 @@ def _add_pod_suffix(*, pod_name, rand_len=8, max_len=253):
def _create_pod_id(
dag_id: str | None = None,
task_id: str | None = None,
+ prefix: str | None = None,
Review Comment:
had to copy the changes to this file since we run the same set of unit tests against both modules: https://github.com/apache/airflow/blob/b213f4fd2627bb2a2a4c96fe2845471db430aa5d/tests/kubernetes/test_kubernetes_helper_functions.py#L35
##########
airflow/config_templates/config.yml:
##########
@@ -2544,6 +2544,13 @@
type: boolean
example: ~
default: "True"
+ - name: worker_pods_name_prefix
+ description: |
+ Prefix to be added to the beginning of worker pods' names
+ version_added: 2.6.0
Review Comment:
i'm unsure if this is correct. cc @jedcunningham @dstandish
##########
airflow/kubernetes/kube_config.py:
##########
@@ -26,7 +26,6 @@ class KubeConfig:
core_section = "core"
kubernetes_section = "kubernetes_executor"
- logging_section = "logging"
Review Comment:
this was unused
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dstandish commented on pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
dstandish commented on PR #28511:
URL: https://github.com/apache/airflow/pull/28511#issuecomment-1360641959
Hi @melugoyal
Thanks for the PR
This seems like something you could use [task policy](https://airflow.apache.org/docs/apache-airflow/stable/concepts/cluster-policies.html#task-policies) to accomplish. What do you think?
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dstandish commented on pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
dstandish commented on PR #28511:
URL: https://github.com/apache/airflow/pull/28511#issuecomment-1362097555
> @dstandish is the suggestion to use TaskPolicy to mutate the dag_id or task_id which is currently used to construct the pod names? i think that technically could be achieved since the DAG object has knowledge of the executor. but it feels slightly hacky to modify the dag_id rather than explicitly add a prefix when needed
@jedcunningham had better suggestion: pod mutation hook. you could do it there.
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb closed pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
ashb closed pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
URL: https://github.com/apache/airflow/pull/28511
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dstandish commented on pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
dstandish commented on PR #28511:
URL: https://github.com/apache/airflow/pull/28511#issuecomment-1362157961
just for the sake of evaluation, the code you would use in mutation hook would probably be something like this
```
def add_prefix(name):
prefix = "my-prefix-"
prefix_len = len(prefix)
return prefix + name[-(63 - prefix_len):]
def pod_mutation_hook(pod):
if 'AIRFLOW_IS_K8S_EXECUTOR_POD' in pod.metadata.labels:
pod.metadata.name = add_prefix(pod.matadata.name)
```
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb commented on pull request #28511: allow a configurable prefix for pod names created by kubernetes executor
Posted by GitBox <gi...@apache.org>.
ashb commented on PR #28511:
URL: https://github.com/apache/airflow/pull/28511#issuecomment-1363285671
Given pod mutation hook exists this just adds config sprawl for a very uncommon use case - I'm closing this PR
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org