dstandish commented on a change in pull request #19726: URL: https://github.com/apache/airflow/pull/19726#discussion_r763429100
########## File path: airflow/providers/cncf/kubernetes/backcompat/backwards_compat_converters.py ########## @@ -21,18 +21,16 @@ from kubernetes.client import ApiClient, models as k8s from airflow.exceptions import AirflowException -from airflow.providers.cncf.kubernetes.backcompat.pod import Port, Resources -from airflow.providers.cncf.kubernetes.backcompat.pod_runtime_info_env import PodRuntimeInfoEnv -def _convert_kube_model_object(obj, old_class, new_class): +def _convert_kube_model_object(obj, old_class_name, new_class): Review comment: OK I think I get it now. We used to use our own classes representing k8s objects. Now we use the "official" ones. For _our_ versions, we have a conversion method `to_k8s_client_obj` And we want a deprecation warning raised when and only when we actually have to convert the object. Ok so here's my suggestion. I can think of three approaches (i like the earlier ones better than the later ones) 1. add depreciation just before line 29 where `obj. to_k8s_client_obj()` is called. In this case we know we are converting and can appropriately raise the warning. or... 2. Add a deprecation warning to every `to_k8s_client_obj` so that whenever it is called, there's a warning. or 3. add a base K8sObject class with a `to_k8s_client_obj` that emits the warning and ensure every backcompat airflow object inherits from it and calls `super(). to_k8s_client_obj` With either of these approaches, we don't need to import the backcompat modules. We don't really need to know (or specify) the specific backcompat class expected in `_convert_kube_model_object` -- we can just explain we expected the k8s object X or a backcompat class appropriately convertible to X. this would be my suggestion. -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org