feat: PostgreSQL score works, added postgresql example, tested on OKD 4.19, added note about incompatible default namespace settings
Some checks failed
Run Check Script / check (pull_request) Failing after 2m37s

This commit is contained in:
2025-12-11 22:54:57 -05:00
parent 9edc42a665
commit 2e367d88d4
4 changed files with 49 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize};
namespaced = true,
schema = "disabled"
)]
#[serde(rename_all = "camelCase")]
pub struct ClusterSpec {
pub instances: i32,
pub image_name: Option<String>,

View File

@@ -27,6 +27,9 @@ use k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
/// specific behavior
#[derive(Debug, Clone, Serialize)]
pub struct PostgreSQLScore {
pub name: String,
/// **Note :** on OpenShfit based clusters, the namespace `default` has security
/// settings incompatible with the default CNPG behavior.
pub namespace: String,
pub instances: i32,
pub storage_size: String,
@@ -36,7 +39,10 @@ pub struct PostgreSQLScore {
impl Default for PostgreSQLScore {
fn default() -> Self {
Self {
namespace: "default".to_string(),
name: "harmony-pg".to_string(),
// We are using the namespace harmony by default since some clusters (openshift family)
// have incompatible configuration of the default namespace with cnpg
namespace: "harmony".to_string(),
instances: 1,
storage_size: "1Gi".to_string(),
image_name: None, // This lets cnpg use its default image
@@ -56,7 +62,7 @@ impl PostgreSQLScore {
impl<T: Topology + K8sclient> Score<T> for PostgreSQLScore {
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
let metadata = ObjectMeta {
name: Some("postgres".to_string()),
name: Some(self.name.clone()),
namespace: Some(self.namespace.clone()),
..ObjectMeta::default()
};