This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit cfde13a864462c24e8ba27e8054728ad9a1276f7
Author: github-actions[bot]
<41898282+github-actions[bot]@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 <[email protected]>
---
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"
)
)