mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 01:12:56 +00:00
Introduce new V2 spec file format.
This includes code that can still read the old V1 format, and convert it to the new ComputeSpecV2 struct. For better test coverage of the upgrade function, update the sample V1 cluster spec file in the tests to match more closely what the control plane actually generates. The intention is to change the real web console to also use the V2 format, and then remove the support for V1 format altogether.
This commit is contained in:
@@ -6,6 +6,7 @@ license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
chrono.workspace = true
|
||||
clap.workspace = true
|
||||
comfy-table.workspace = true
|
||||
git-version.workspace = true
|
||||
|
||||
@@ -55,7 +55,7 @@ use crate::pageserver::PageServerNode;
|
||||
use crate::postgresql_conf::PostgresConf;
|
||||
|
||||
use compute_api::responses::{ComputeState, ComputeStatus};
|
||||
use compute_api::spec::{Cluster, ComputeSpec};
|
||||
use compute_api::spec::ComputeSpecV2;
|
||||
|
||||
// contents of a endpoint.json file
|
||||
#[serde_as]
|
||||
@@ -402,26 +402,29 @@ impl Endpoint {
|
||||
}
|
||||
|
||||
// Create spec file
|
||||
let spec = ComputeSpec {
|
||||
format_version: 1.0,
|
||||
let spec = ComputeSpecV2 {
|
||||
format_version: 2,
|
||||
|
||||
project_id: None,
|
||||
endpoint_id: Some(self.endpoint_id.clone()),
|
||||
operation_uuid: None,
|
||||
cluster: Cluster {
|
||||
cluster_id: "FIXME".to_string(),
|
||||
name: "FIXME".to_string(),
|
||||
state: None,
|
||||
roles: vec![],
|
||||
databases: vec![],
|
||||
settings: None,
|
||||
postgresql_conf: Some(postgresql_conf),
|
||||
},
|
||||
delta_operations: None,
|
||||
tenant_id: Some(self.tenant_id),
|
||||
timeline_id: Some(self.timeline_id),
|
||||
|
||||
startup_tracing_context: None,
|
||||
|
||||
tenant_id: self.tenant_id,
|
||||
timeline_id: self.timeline_id,
|
||||
lsn: self.lsn,
|
||||
pageserver_connstring: Some(pageserver_connstring),
|
||||
pageserver_connstring,
|
||||
safekeeper_connstrings,
|
||||
storage_auth_token: auth_token.clone(),
|
||||
startup_tracing_context: None,
|
||||
|
||||
postgresql_conf: Some(postgresql_conf),
|
||||
settings: None,
|
||||
|
||||
roles: vec![],
|
||||
databases: vec![],
|
||||
extensions: vec![],
|
||||
delta_operations: None,
|
||||
};
|
||||
let spec_path = self.endpoint_path().join("spec.json");
|
||||
std::fs::write(spec_path, serde_json::to_string_pretty(&spec)?)?;
|
||||
|
||||
Reference in New Issue
Block a user