Skip to content

Commit

Permalink
hardcoded storage controller version
Browse files Browse the repository at this point in the history
Nothing seems to be checking this version so we just hardcode it instead of looking up the most
recent Pageserver version in the region.
  • Loading branch information
fcdm committed Nov 21, 2024
1 parent 4696c02 commit 00ba92b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
2 changes: 1 addition & 1 deletion charts/neon-storage-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/neon-storage-controller/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python

import os
import sys
import json
import logging
import urllib.request
Expand All @@ -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"
Expand All @@ -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,
)


Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 00ba92b

Please sign in to comment.