-
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
[AIRFLOW-6025] Add label to uniquely identify creator of Pod #6621
Conversation
It seems that we have a flaky test:
|
@nuclearpinguin Yeah, restarting the test worked :) |
# And a label to identify that pod is launched by KubernetesPodOperator | ||
self.labels.update( | ||
{ | ||
'airflow_version': airflow_version.replace('+', '-'), |
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.
Does Kube recommend that we qualify our labels, like org.apache.airflow.version
?
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.
Or is that for annotations? When should we use one over another?
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.
https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ recommend some but given we already use labels and don't follow such conventions, I made this change :
airflow/airflow/kubernetes/worker_configuration.py
Lines 372 to 378 in fab957e
labels={ | |
'airflow-worker': worker_uuid, | |
'dag_id': dag_id, | |
'task_id': task_id, | |
'execution_date': execution_date, | |
'try_number': str(try_number), | |
}, |
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.
Re. labels vs annotations:
You can use either labels or annotations to attach metadata to Kubernetes objects. Labels can be used to select objects and to find collections of objects that satisfy certain conditions. In contrast, annotations are not used to identify and select objects. The metadata in an annotation can be small or large, structured or unstructured, and can include characters not permitted by labels.
So labels make more sense for e.g to select all the pods that are created by Kube Pod Operator
(cherry picked from commit 5e5685a)
(cherry picked from commit 5e5685a)
(cherry picked from commit 5e5685a)
Make sure you have checked all steps below.
Jira
Description
2 Components natively create Kubernetes Pods.
It would be ideal to add a label that identifies which of the two launches pod.
Tests
Commits
Documentation