From 335791057dc5a0a4d260e8ef2f72005509eaf00f Mon Sep 17 00:00:00 2001 From: Rahul Patil Date: Mon, 4 Mar 2024 16:17:24 +0100 Subject: [PATCH 1/3] fix: storage controller registration script --- .../scripts/register-storage-controller.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/neon-storage-controller/scripts/register-storage-controller.py b/charts/neon-storage-controller/scripts/register-storage-controller.py index ef33c17..efad5b6 100644 --- a/charts/neon-storage-controller/scripts/register-storage-controller.py +++ b/charts/neon-storage-controller/scripts/register-storage-controller.py @@ -65,7 +65,7 @@ def get_data(url, token, host=None): def get_pageserver_id(url, token): data = get_data(url, token, HOST) if "node_id" in data: - return data["node_id"] + return int(data["node_id"]) def get_pageserver_version(): @@ -97,7 +97,7 @@ def register(url, token, payload): response = json.loads(resp.read()) log.info(response) if "node_id" in response: - return response["node_id"] + return int(response["node_id"]) if __name__ == "__main__": @@ -152,8 +152,8 @@ def register(url, token, payload): log.info("check if pageserver already registered or not in cplane") node_id_in_cplane = get_pageserver_id(LOCAL_CPLANE_URL, LOCAL_CPLANE_JWT_TOKEN) - if node_id_in_cplane is None: - PAYLOAD.update(dict(node_id=str(node_id_in_console))) + if node_id_in_cplane is None and node_id_in_console is not None: + PAYLOAD.update(dict(node_id=node_id_in_console)) log.info("Registering storage controller in cplane") node_id_in_cplane = register(LOCAL_CPLANE_URL, LOCAL_CPLANE_JWT_TOKEN, PAYLOAD) log.info( From bf39a5c3401b506fa0b02a3d188f2215331656d9 Mon Sep 17 00:00:00 2001 From: Rahul Patil Date: Mon, 4 Mar 2024 16:20:25 +0100 Subject: [PATCH 2/3] fix python lint --- .../scripts/register-storage-controller.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/charts/neon-storage-controller/scripts/register-storage-controller.py b/charts/neon-storage-controller/scripts/register-storage-controller.py index efad5b6..3debdd9 100644 --- a/charts/neon-storage-controller/scripts/register-storage-controller.py +++ b/charts/neon-storage-controller/scripts/register-storage-controller.py @@ -132,7 +132,9 @@ def register(url, token, payload): PAYLOAD.update(dict(version=version)) log.info("check if pageserver already registered or not in console") - node_id_in_console = get_pageserver_id(GLOBAL_CPLANE_URL, GLOBAL_CPLANE_JWT_TOKEN) + node_id_in_console = get_pageserver_id( + GLOBAL_CPLANE_URL, GLOBAL_CPLANE_JWT_TOKEN + ) if node_id_in_console is None: log.info("Registering storage controller in console") @@ -150,12 +152,16 @@ def register(url, token, payload): ) log.info("check if pageserver already registered or not in cplane") - node_id_in_cplane = get_pageserver_id(LOCAL_CPLANE_URL, LOCAL_CPLANE_JWT_TOKEN) + node_id_in_cplane = get_pageserver_id( + LOCAL_CPLANE_URL, LOCAL_CPLANE_JWT_TOKEN + ) if node_id_in_cplane is None and node_id_in_console is not None: PAYLOAD.update(dict(node_id=node_id_in_console)) log.info("Registering storage controller in cplane") - node_id_in_cplane = register(LOCAL_CPLANE_URL, LOCAL_CPLANE_JWT_TOKEN, PAYLOAD) + node_id_in_cplane = register( + LOCAL_CPLANE_URL, LOCAL_CPLANE_JWT_TOKEN, PAYLOAD + ) log.info( f"Storage controller registered in cplane with node_id \ {node_id_in_cplane}" From 27fdafe10a0afbfbbdb85ccffa5f3da00ad1b5f5 Mon Sep 17 00:00:00 2001 From: Rahul Patil Date: Mon, 4 Mar 2024 16:21:36 +0100 Subject: [PATCH 3/3] auto-gen chart docs and update version --- charts/neon-storage-controller/Chart.yaml | 2 +- charts/neon-storage-controller/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/neon-storage-controller/Chart.yaml b/charts/neon-storage-controller/Chart.yaml index e979d73..86c18ab 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.0.2 +version: 1.0.3 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 9101a1c..e5f4550 100644 --- a/charts/neon-storage-controller/README.md +++ b/charts/neon-storage-controller/README.md @@ -1,6 +1,6 @@ # neon-storage-controller -![Version: 1.0.2](https://img.shields.io/badge/Version-1.0.2-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.0.3](https://img.shields.io/badge/Version-1.0.3-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