You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2025/05/17 23:03:07 UTC

(airflow) branch v3-0-test updated: [v3-0-test] Use Github API to fetch K8S schemas to fix rate limiting (#50729) (#50731)

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

potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new 6873d55e8f9 [v3-0-test] Use Github API to fetch K8S schemas to fix rate limiting (#50729) (#50731)
6873d55e8f9 is described below

commit 6873d55e8f90d5d06485a406183001cddf1981ce
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Sat May 17 19:03:00 2025 -0400

    [v3-0-test] Use Github API to fetch K8S schemas to fix rate limiting (#50729) (#50731)
    
    (cherry picked from commit 41ddc9fc2a5b3894799087a81b0468c762dfdbf5)
    
    Co-authored-by: Amogh Desai <am...@gmail.com>
---
 helm-tests/tests/chart_utils/helm_template_generator.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/helm-tests/tests/chart_utils/helm_template_generator.py b/helm-tests/tests/chart_utils/helm_template_generator.py
index 3dd33fdbcfe..360c71e24bd 100644
--- a/helm-tests/tests/chart_utils/helm_template_generator.py
+++ b/helm-tests/tests/chart_utils/helm_template_generator.py
@@ -37,7 +37,7 @@ CHART_DIR = Path(__file__).resolve().parents[3] / "chart"
 
 DEFAULT_KUBERNETES_VERSION = "1.29.1"
 BASE_URL_SPEC = (
-    f"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/"
+    f"https://api.github.com/repos/yannh/kubernetes-json-schema/contents/"
     f"v{DEFAULT_KUBERNETES_VERSION}-standalone-strict"
 )
 
@@ -63,14 +63,17 @@ def get_schema_k8s(api_version, kind, kubernetes_version):
     else:
         url = f"{BASE_URL_SPEC}/{kind}-{api_version}.json"
 
-    headers = {}
+    headers = {
+        "Accept": "application/vnd.github.v3.raw",
+    }
     if GITHUB_TOKEN:
         headers["Authorization"] = f"Bearer {GITHUB_TOKEN}"
         headers["X-GitHub-Api-Version"] = "2022-11-28"
-    request = requests.get(url, headers=headers)
-    request.raise_for_status()
+
+    response = requests.get(url, headers=headers)
+    response.raise_for_status()
     schema = json.loads(
-        request.text.replace(
+        response.text.replace(
             "kubernetesjsonschema.dev", "raw.githubusercontent.com/yannh/kubernetes-json-schema/master"
         )
     )