Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions providers/cncf/kubernetes/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,29 @@ config:
type: string
example: ~
default: ""
deprecated: true
deprecation_reason: |
This configuration is deprecated. Use `pod_template_file` to specify container image instead.
worker_container_tag:
description: |
The tag of the Kubernetes Image for the Worker to Run
version_added: ~
type: string
example: ~
default: ""
deprecated: true
deprecation_reason: |
This configuration is deprecated. Use `pod_template_file` to specify the image tag instead.
namespace:
description: |
The Kubernetes namespace where airflow workers should be created. Defaults to ``default``
version_added: ~
type: string
example: ~
default: "default"
deprecated: true
deprecation_reason: |
This configuration is deprecated. Use `pod_template_file` to specify namespace instead.
delete_worker_pods:
description: |
If True, all worker pods will be deleted upon termination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,26 @@ def get_provider_info():
"type": "string",
"example": None,
"default": "",
"deprecated": True,
"deprecation_reason": "This configuration is deprecated. Use `pod_template_file` to specify container image instead.\n",
},
"worker_container_tag": {
"description": "The tag of the Kubernetes Image for the Worker to Run\n",
"version_added": None,
"type": "string",
"example": None,
"default": "",
"deprecated": True,
"deprecation_reason": "This configuration is deprecated. Use `pod_template_file` to specify the image tag instead.\n",
},
"namespace": {
"description": "The Kubernetes namespace where airflow workers should be created. Defaults to ``default``\n",
"version_added": None,
"type": "string",
"example": None,
"default": "default",
"deprecated": True,
"deprecation_reason": "This configuration is deprecated. Use `pod_template_file` to specify namespace instead.\n",
},
"delete_worker_pods": {
"description": "If True, all worker pods will be deleted upon termination\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
# under the License.
from __future__ import annotations

import warnings

from airflow.configuration import conf
from airflow.exceptions import AirflowConfigException
from airflow.exceptions import AirflowConfigException, AirflowProviderDeprecationWarning
from airflow.settings import AIRFLOW_HOME


Expand Down Expand Up @@ -53,7 +55,21 @@ def __init__(self):
self.kubernetes_section, "worker_pods_creation_batch_size"
)
self.worker_container_repository = conf.get(self.kubernetes_section, "worker_container_repository")
if self.worker_container_repository:
warnings.warn(
"Configuration 'worker_container_repository' is deprecated. "
"Use 'pod_template_file' to specify the container image repository instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
self.worker_container_tag = conf.get(self.kubernetes_section, "worker_container_tag")
if self.worker_container_tag:
warnings.warn(
"Configuration 'worker_container_tag' is deprecated. "
"Use 'pod_template_file' to specify the container image tag instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
if self.worker_container_repository and self.worker_container_tag:
self.kube_image = f"{self.worker_container_repository}:{self.worker_container_tag}"
else:
Expand All @@ -64,6 +80,13 @@ def __init__(self):
# cluster has RBAC enabled, your scheduler may need service account permissions to
# create, watch, get, and delete pods in this namespace.
self.kube_namespace = conf.get(self.kubernetes_section, "namespace")
if self.kube_namespace and self.kube_namespace != "default":
warnings.warn(
"Configuration 'namespace' is deprecated. "
"Use 'pod_template_file' to specify the namespace instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
self.multi_namespace_mode = conf.getboolean(self.kubernetes_section, "multi_namespace_mode")
if self.multi_namespace_mode and conf.get(
self.kubernetes_section, "multi_namespace_mode_namespace_list"
Expand Down