From 00ba92b9c3533f8b6c203bf667d46cc661e4e23f Mon Sep 17 00:00:00 2001 From: Cihan Demirci <128653800+fcdm@users.noreply.github.com> Date: Thu, 21 Nov 2024 19:54:45 +0000 Subject: [PATCH] hardcoded storage controller version Nothing seems to be checking this version so we just hardcode it instead of looking up the most recent Pageserver version in the region. --- charts/neon-storage-controller/Chart.yaml | 2 +- charts/neon-storage-controller/README.md | 2 +- .../scripts/register-storage-controller.py | 25 ++----------------- .../templates/secrets-registration.yaml | 1 - 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/charts/neon-storage-controller/Chart.yaml b/charts/neon-storage-controller/Chart.yaml index 35d505a..6e416d8 100644 --- a/charts/neon-storage-controller/Chart.yaml +++ b/charts/neon-storage-controller/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: neon-storage-controller description: Neon storage controller type: application -version: 1.1.5 +version: 1.2.0 appVersion: "0.1.0" kubeVersion: "^1.18.x-x" home: https://neon.tech diff --git a/charts/neon-storage-controller/README.md b/charts/neon-storage-controller/README.md index e643a82..082f26a 100644 --- a/charts/neon-storage-controller/README.md +++ b/charts/neon-storage-controller/README.md @@ -1,6 +1,6 @@ # neon-storage-controller -![Version: 1.1.5](https://img.shields.io/badge/Version-1.1.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml) +![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml) Neon storage controller diff --git a/charts/neon-storage-controller/scripts/register-storage-controller.py b/charts/neon-storage-controller/scripts/register-storage-controller.py index 57104db..2bf209c 100644 --- a/charts/neon-storage-controller/scripts/register-storage-controller.py +++ b/charts/neon-storage-controller/scripts/register-storage-controller.py @@ -1,7 +1,6 @@ #!/usr/bin/env python import os -import sys import json import logging import urllib.request @@ -15,7 +14,6 @@ PORT = os.getenv("PORT", 50051) CPLANE_JWT_TOKEN = os.environ["CONTROL_PLANE_JWT_TOKEN"] -CONSOLE_API_KEY = os.environ["CONSOLE_API_KEY"] # To register new pageservers URL_PATH = "management/api/v2/pageservers" @@ -38,6 +36,8 @@ register_reason="Storage Controller Virtual Pageserver", active=False, is_storage_controller=True, + # Hardcoded because nothing is checking this version. + version=0, ) @@ -74,17 +74,6 @@ def get_pageserver_id(url, token): return int(data["node_id"]) -def get_pageserver_version(): - data = get_data(CONSOLE_URL, CONSOLE_API_KEY) - if "data" not in data: - return -1 - for pageserver in data["data"]: - region_id = pageserver["region_id"] - if region_id == REGION or region_id == f"{REGION}-new": - return pageserver["version"] - return -1 - - def register(url, token, payload): data = str(json.dumps(payload)).encode() response = get_data(url, token, data=data, method="POST") @@ -113,16 +102,6 @@ def register(url, token, payload): ) ) - log.info("get version from existing deployed pageserver") - version = get_pageserver_version() - - if version == -1: - log.error(f"Unable to find pageserver version from {CONSOLE_URL}") - sys.exit(1) - - log.info(f"found latest version={version} for region={REGION}") - PAYLOAD.update(dict(version=version)) - log.info("check if pageserver already registered") node_id = get_pageserver_id( CPLANE_MANAGEMENT_URL, CPLANE_JWT_TOKEN diff --git a/charts/neon-storage-controller/templates/secrets-registration.yaml b/charts/neon-storage-controller/templates/secrets-registration.yaml index 36194ac..e1c3af9 100644 --- a/charts/neon-storage-controller/templates/secrets-registration.yaml +++ b/charts/neon-storage-controller/templates/secrets-registration.yaml @@ -8,5 +8,4 @@ metadata: type: Opaque data: CONTROL_PLANE_JWT_TOKEN: {{ .Values.registerControlPlane.controlPlaneJwtToken | b64enc | quote }} - CONSOLE_API_KEY: {{ .Values.registerControlPlane.apiKey | b64enc | quote }} {{- end }}