Skip to content

Commit

Permalink
[AIRFLOW-2532] Support logs_volume_subpath for KubernetesExecutor
Browse files Browse the repository at this point in the history
The kubernetes section in the configuration file
supports
logs_volume_subpath for KubernetesExecutor.

Closes apache#3430 from imroc/AIRFLOW-2532
  • Loading branch information
imroc authored and Fokko Driesprong committed May 30, 2018
1 parent 0e892cc commit 7945854
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions airflow/config_templates/default_airflow.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ dags_volume_subpath =
# For DAGs mounted via a volume claim (mutually exclusive with volume claim)
dags_volume_claim =

# For volume mounted logs, the worker will look in this subpath for logs
logs_volume_subpath =

# A shared volume claim for the logs
logs_volume_claim =

Expand Down
5 changes: 5 additions & 0 deletions airflow/contrib/executors/kubernetes_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ def __init__(self):
self.dags_volume_subpath = conf.get(
self.kubernetes_section, 'dags_volume_subpath')

# This prop may optionally be set for PV Claims and is used to locate logs
# on a SubPath
self.logs_volume_subpath = conf.get(
self.kubernetes_section, 'logs_volume_subpath')

# This prop may optionally be set for PV Claims and is used to write logs
self.base_log_folder = configuration.get(self.core_section, 'base_log_folder')

Expand Down
3 changes: 2 additions & 1 deletion airflow/contrib/kubernetes/worker_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def _construct_volume(name, claim, subpath=None):
),
_construct_volume(
logs_volume_name,
self.kube_config.logs_volume_claim
self.kube_config.logs_volume_claim,
self.kube_config.logs_volume_subpath
)
]
volume_mounts = [{
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/kubernetes/kube/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ data:
git_user =
git_password =
dags_volume_claim = airflow-dags
dags_volume_subpath =
logs_volume_claim = airflow-logs
logs_volume_subpath =
in_cluster = True
namespace = default
gcp_service_account_keys =
Expand Down

0 comments on commit 7945854

Please sign in to comment.