This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 1fbd8893952 Remove leftovers of `kubernetes_environment_variables` 
(#44804)
1fbd8893952 is described below

commit 1fbd889395239fbeed528eb08a6d86f6393ae7cc
Author: Jed Cunningham <[email protected]>
AuthorDate: Tue Dec 10 00:29:52 2024 -0700

    Remove leftovers of `kubernetes_environment_variables` (#44804)
    
    Support for configuring env vars this way was removed before Airflow
    2.0, so we can safely remove this without a newsfragment even!
---
 airflow/configuration.py         |  7 +------
 tests/core/test_configuration.py | 28 ----------------------------
 2 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/airflow/configuration.py b/airflow/configuration.py
index c2f84551250..76e2690ffe1 100644
--- a/airflow/configuration.py
+++ b/airflow/configuration.py
@@ -1505,12 +1505,7 @@ class AirflowConfigParser(ConfigParser):
                 opt = (opt, "env var")
 
             section = section.lower()
-            # if we lower key for kubernetes_environment_variables section,
-            # then we won't be able to set any Airflow environment
-            # variables. Airflow only parse environment variables starts
-            # with AIRFLOW_. Therefore, we need to make it a special case.
-            if section != "kubernetes_environment_variables":
-                key = key.lower()
+            key = key.lower()
             config_sources.setdefault(section, {}).update({key: opt})
 
     def _filter_by_source(
diff --git a/tests/core/test_configuration.py b/tests/core/test_configuration.py
index f43fdece8d4..b19d6ff0cf2 100644
--- a/tests/core/test_configuration.py
+++ b/tests/core/test_configuration.py
@@ -146,27 +146,16 @@ class TestConf:
 
         assert conf.has_option("testsection", "testkey")
 
-        with mock.patch.dict(
-            "os.environ", 
AIRFLOW__KUBERNETES_ENVIRONMENT_VARIABLES__AIRFLOW__TESTSECTION__TESTKEY="nested"
-        ):
-            opt = conf.get("kubernetes_environment_variables", 
"AIRFLOW__TESTSECTION__TESTKEY")
-            assert opt == "nested"
-
-    @mock.patch.dict(
-        "os.environ", 
AIRFLOW__KUBERNETES_ENVIRONMENT_VARIABLES__AIRFLOW__TESTSECTION__TESTKEY="nested"
-    )
     @conf_vars({("core", "percent"): "with%%inside"})
     def test_conf_as_dict(self):
         cfg_dict = conf.as_dict()
 
         # test that configs are picked up
         assert cfg_dict["core"]["unit_test_mode"] == "True"
-
         assert cfg_dict["core"]["percent"] == "with%inside"
 
         # test env vars
         assert cfg_dict["testsection"]["testkey"] == "testvalue"
-        assert 
cfg_dict["kubernetes_environment_variables"]["AIRFLOW__TESTSECTION__TESTKEY"] 
== "nested"
 
     def test_conf_as_dict_source(self):
         # test display_source
@@ -611,23 +600,6 @@ key3 = value3
         content = conf.getsection("webserver")
         assert content["secret_key"] == "difficult_unpredictable_cat_password"
 
-    def test_kubernetes_environment_variables_section(self):
-        test_config = """
-[kubernetes_environment_variables]
-key1 = hello
-AIRFLOW_HOME = /root/airflow
-"""
-        test_config_default = """
-[kubernetes_environment_variables]
-"""
-        test_conf = 
AirflowConfigParser(default_config=parameterized_config(test_config_default))
-        test_conf.read_string(test_config)
-
-        assert test_conf.getsection("kubernetes_environment_variables") == {
-            "key1": "hello",
-            "AIRFLOW_HOME": "/root/airflow",
-        }
-
     @pytest.mark.parametrize(
         "key, type",
         [

Reply via email to