kaxil commented on a change in pull request #10393:
URL: https://github.com/apache/airflow/pull/10393#discussion_r477517592
##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -70,116 +69,25 @@ class KubeConfig: # pylint:
disable=too-many-instance-attributes
def __init__(self): # pylint: disable=too-many-statements
configuration_dict = conf.as_dict(display_sensitive=True)
self.core_configuration = configuration_dict['core']
- self.kube_secrets = configuration_dict.get('kubernetes_secrets', {})
- self.kube_env_vars =
configuration_dict.get('kubernetes_environment_variables', {})
- self.env_from_configmap_ref = conf.get(self.kubernetes_section,
- 'env_from_configmap_ref')
- self.env_from_secret_ref = conf.get(self.kubernetes_section,
- 'env_from_secret_ref')
self.airflow_home = settings.AIRFLOW_HOME
self.dags_folder = conf.get(self.core_section, 'dags_folder')
self.parallelism = conf.getint(self.core_section, 'parallelism')
- self.worker_container_repository = conf.get(
- self.kubernetes_section, 'worker_container_repository')
- self.worker_container_tag = conf.get(
- self.kubernetes_section, 'worker_container_tag')
- self.kube_image = '{}:{}'.format(
- self.worker_container_repository, self.worker_container_tag)
- self.kube_image_pull_policy = conf.get(
- self.kubernetes_section, "worker_container_image_pull_policy"
- )
- self.kube_node_selectors =
configuration_dict.get('kubernetes_node_selectors', {})
self.pod_template_file = conf.get(self.kubernetes_section,
'pod_template_file',
fallback=None)
- kube_worker_annotations = conf.get(self.kubernetes_section,
'worker_annotations')
- if kube_worker_annotations:
- self.kube_annotations = json.loads(kube_worker_annotations)
- else:
- self.kube_annotations = None
-
- self.kube_labels = configuration_dict.get('kubernetes_labels', {})
self.delete_worker_pods = conf.getboolean(
self.kubernetes_section, 'delete_worker_pods')
self.delete_worker_pods_on_failure = conf.getboolean(
self.kubernetes_section, 'delete_worker_pods_on_failure')
self.worker_pods_creation_batch_size = conf.getint(
self.kubernetes_section, 'worker_pods_creation_batch_size')
- self.worker_service_account_name = conf.get(
- self.kubernetes_section, 'worker_service_account_name')
- self.image_pull_secrets = conf.get(self.kubernetes_section,
'image_pull_secrets')
-
- # NOTE: user can build the dags into the docker image directly,
- # this will set to True if so
- self.dags_in_image = conf.getboolean(self.kubernetes_section,
'dags_in_image')
- # Run as user for pod security context
- self.worker_run_as_user = self._get_security_context_val('run_as_user')
- self.worker_fs_group = self._get_security_context_val('fs_group')
-
- kube_worker_resources = conf.get(self.kubernetes_section,
'worker_resources')
- if kube_worker_resources:
- self.worker_resources = json.loads(kube_worker_resources)
- else:
- self.worker_resources = None
-
- # NOTE: `git_repo` and `git_branch` must be specified together as a
pair
- # The http URL of the git repository to clone from
- self.git_repo = conf.get(self.kubernetes_section, 'git_repo')
- # The branch of the repository to be checked out
- self.git_branch = conf.get(self.kubernetes_section, 'git_branch')
- # Clone depth for git sync
- self.git_sync_depth = conf.get(self.kubernetes_section,
'git_sync_depth')
- # Optionally, the directory in the git repository containing the dags
- self.git_subpath = conf.get(self.kubernetes_section, 'git_subpath')
- # Optionally, the root directory for git operations
- self.git_sync_root = conf.get(self.kubernetes_section, 'git_sync_root')
- # Optionally, the name at which to publish the checked-out files under
--root
- self.git_sync_dest = conf.get(self.kubernetes_section, 'git_sync_dest')
- # Optionally, the tag or hash to checkout
- self.git_sync_rev = conf.get(self.kubernetes_section, 'git_sync_rev')
- # Optionally, if git_dags_folder_mount_point is set the worker will use
- # {git_dags_folder_mount_point}/{git_sync_dest}/{git_subpath} as
dags_folder
- self.git_dags_folder_mount_point = conf.get(self.kubernetes_section,
-
'git_dags_folder_mount_point')
-
- # Optionally a user may supply a (`git_user` AND `git_password`) OR
- # (`git_ssh_key_secret_name` AND `git_ssh_key_secret_key`) for private
repositories
- self.git_user = conf.get(self.kubernetes_section, 'git_user')
- self.git_password = conf.get(self.kubernetes_section, 'git_password')
- self.git_ssh_key_secret_name = conf.get(self.kubernetes_section,
'git_ssh_key_secret_name')
- self.git_ssh_known_hosts_configmap_name =
conf.get(self.kubernetes_section,
-
'git_ssh_known_hosts_configmap_name')
- self.git_sync_credentials_secret = conf.get(self.kubernetes_section,
-
'git_sync_credentials_secret')
-
- # NOTE: The user may optionally use a volume claim to mount a PV
containing
- # DAGs directly
- self.dags_volume_claim = conf.get(self.kubernetes_section,
'dags_volume_claim')
-
- self.dags_volume_mount_point = conf.get(self.kubernetes_section,
'dags_volume_mount_point')
-
- # This prop may optionally be set for PV Claims and is used to write
logs
- self.logs_volume_claim = conf.get(self.kubernetes_section,
'logs_volume_claim')
-
- # This prop may optionally be set for PV Claims and is used to locate
DAGs
- # on a SubPath
- 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')
-
- # Optionally, hostPath volume containing DAGs
- self.dags_volume_host = conf.get(self.kubernetes_section,
'dags_volume_host')
-
- # Optionally, write logs to a hostPath Volume
- self.logs_volume_host = conf.get(self.kubernetes_section,
'logs_volume_host')
-
- # This prop may optionally be set for PV Claims and is used to write
logs
- self.base_log_folder = conf.get(self.logging_section,
'base_log_folder')
+ self.worker_container_repository = conf.get(
+ self.kubernetes_section, 'worker_container_repository')
+ self.worker_container_tag = conf.get(
+ self.kubernetes_section, 'worker_container_tag')
+ self.kube_image = '{}:{}'.format(
+ self.worker_container_repository, self.worker_container_tag)
Review comment:
```suggestion
self.kube_image =
f'{self.worker_container_repository}:{self.worker_container_tag}'
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]