original_docstring: 
          Initializes a new environment object based on the GKE instance in
          the current kubectl context
          
docstring: Initializes a new environment object based on the GKE instance in
  the current kubectl context
docstring_tokens: Initializes a new environment object based on the GKE instance in the current kubectl context
code: def from_current_context(cls) -> ComposerEnv:
          """
          Initializes a new environment object based on the GKE instance in
          the current kubectl context
          """
          k8s_client = gke_utils.create_client()
  
          namespace = gke_utils.extract_composer_namespace(k8s_client)
          worker_pod = gke_utils.extract_worker_pod_by_namespace(
              k8s_client, namespace)
  
          namespace_secrets = gke_utils.extract_airflow_secrets_by_namespace(
              k8s_client, namespace)
  
          worker_pod_vars = gke_utils.extract_worker_env_vars(
              k8s_client, namespace, worker_pod['pod_name'])
          sql_proxy_pod_ip = gke_utils.extract_sql_proxy_pod_id(k8s_client)
          worker_pod_vars['AIRFLOW__CORE__FERNET__KEY'] = namespace_secrets[
              'fernet_key']
          worker_pod_vars['SQL_PASSWORD'] = namespace_secrets['sql_password']
  
          composer_env_instance = cls.__new__(cls)
          composer_env_instance.namespace = namespace
          composer_env_instance.worker_pod = worker_pod
          composer_env_instance.worker_pod_vars = worker_pod_vars
          composer_env_instance.sql_proxy_pod_ip = sql_proxy_pod_ip
  
          return composer_env_instance
code_tokens: def from_current_context ( cls ) -> ComposerEnv : k8s_client = gke_utils . create_client ( ) namespace = gke_utils . extract_composer_namespace ( k8s_client ) worker_pod = gke_utils . extract_worker_pod_by_namespace ( k8s_client , namespace ) namespace_secrets = gke_utils . extract_airflow_secrets_by_namespace ( k8s_client , namespace ) worker_pod_vars = gke_utils . extract_worker_env_vars ( k8s_client , namespace , worker_pod [ 'pod_name' ] ) sql_proxy_pod_ip = gke_utils . extract_sql_proxy_pod_id ( k8s_client ) worker_pod_vars [ 'AIRFLOW__CORE__FERNET__KEY' ] = namespace_secrets [ 'fernet_key' ] worker_pod_vars [ 'SQL_PASSWORD' ] = namespace_secrets [ 'sql_password' ] composer_env_instance = cls . __new__ ( cls ) composer_env_instance . namespace = namespace composer_env_instance . worker_pod = worker_pod composer_env_instance . worker_pod_vars = worker_pod_vars composer_env_instance . sql_proxy_pod_ip = sql_proxy_pod_ip return composer_env_instance
short_docstring: Initializes a new environment object based on the GKE instance in
  the current kubectl context
short_docstring_tokens: Initializes a new environment object based on the GKE instance in the current kubectl context
comment: """
          Initializes a new environment object based on the GKE instance in
          the current kubectl context
          """