-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Fix KubernetesPodOperator pod name length validation #8829
Fix KubernetesPodOperator pod name length validation #8829
Conversation
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/master/CONTRIBUTING.rst)
|
@@ -322,5 +322,5 @@ def _set_resources(resources): | |||
def _set_name(self, name): | |||
if self.pod_template_file or self.full_pod_spec: | |||
return None | |||
validate_key(name, max_length=63) | |||
validate_key(name, max_length=220) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, we can keep it on 220 also for v1.10, as preparation for the longer suffix added in v2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any further action needed from my side? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what else is needed for this fix to get on the v1.10 merge train 🚂
merging is blocked as long as there are unticked TODOs in the PR description btw.
maybe @kaxil: anything else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests too, please?
@dimberman Can you take a look please at this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just would like to see some tests.
@@ -322,5 +322,5 @@ def _set_resources(resources): | |||
def _set_name(self, name): | |||
if self.pod_template_file or self.full_pod_spec: | |||
return None | |||
validate_key(name, max_length=63) | |||
validate_key(name, max_length=220) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just would like to see some tests.
thank you @ddelange! Once tests pass I'll merge. |
2dd9a6f
to
a83b9ef
Compare
All tests passed @dimberman =) Any further feedback welcome. |
Awesome work, congrats on your first merged pull request! |
Thank you @dsaiztc ! |
* Fix KubernetesPodOperator pod name length validation * Add test, verify Exception is raised (cherry picked from commit f82ad45)
* Fix KubernetesPodOperator pod name length validation * Add test, verify Exception is raised (cherry picked from commit f82ad45)
* Fix KubernetesPodOperator pod name length validation * Add test, verify Exception is raised (cherry picked from commit f82ad45)
* Fix KubernetesPodOperator pod name length validation * Add test, verify Exception is raised (cherry picked from commit f82ad45)
In #6523 a validation was added to
KubernetesPodOperator
that verifies the providedname
conforms to the maximum number of characters for Kubernetes pods.The provided character limit in such PR is not correct as it's using the maximum number of characters for a Kubernetes label, which is
63
, instead of the maximum number of characters for Kubernetes name, which is253
[1].However, the char limit set in this module depends on the implementation of
airflow.kubernetes.pod_generator.PodGenerator
. Upon the commit this PR is based, whatever the length of the given name, such name will be shortened to conform to the norm (253
characters). In the referenced commit an additional33
characters are added (-
+32
random), which in turns means that this should validate that the name is no longer that220
characters (the value proposed).Bear also in mind that current v.10.10 does not have the implementation of the commit mentioned but a different one where the name is not shortened but directly concatenated to another
9
characters (-
+ 8 random) and thus the name this limit could be set to244
(instead of the220
characters proposed).[1] Identifiers and Names in Kubernetes
Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.