Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move Stacks objects to tembo-stacks #764

Merged
merged 9 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tembo-operator/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-operator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "controller"
description = "Tembo Operator for Postgres"
version = "0.46.0"
version = "0.47.0"
edition = "2021"
default-run = "controller"
license = "Apache-2.0"
Expand Down
25 changes: 18 additions & 7 deletions tembo-operator/src/defaults.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
use k8s_openapi::{
api::core::v1::ResourceRequirements,
apimachinery::pkg::{api::resource::Quantity, util::intstr::IntOrString},
};
use std::collections::BTreeMap;

use crate::apis::coredb_types::CoreDB;
use crate::{
apis::coredb_types::{
Expand All @@ -12,8 +6,25 @@ use crate::{
cloudnativepg::clusters::ClusterAffinity,
cloudnativepg::poolers::{PoolerPgbouncerPoolMode, PoolerTemplateSpecContainersResources},
extensions::types::{Extension, TrunkInstall},
stacks::types::ImagePerPgVersion,
};
use k8s_openapi::{
api::core::v1::ResourceRequirements,
apimachinery::pkg::{api::resource::Quantity, util::intstr::IntOrString},
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use utoipa::ToSchema;

#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, ToSchema)]
pub struct ImagePerPgVersion {
#[serde(rename = "14")]
pub pg14: String,
#[serde(rename = "15")]
pub pg15: String,
#[serde(rename = "16")]
pub pg16: String,
}

pub fn default_replicas() -> i32 {
1
Expand Down
1 change: 0 additions & 1 deletion tembo-operator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub mod app_service;
pub mod configmap;
pub mod extensions;
pub mod postgres_exporter;
pub mod stacks;
/// Log and trace integrations
pub mod telemetry;

Expand Down
3 changes: 0 additions & 3 deletions tembo-operator/src/stacks/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions tembo-operator/src/stacks/mod.rs

This file was deleted.

116 changes: 0 additions & 116 deletions tembo-operator/src/stacks/types.rs

This file was deleted.

11 changes: 5 additions & 6 deletions tembo-stacks/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions tembo-stacks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tembo-stacks"
description = "Tembo Stacks for Postgres"
version = "0.6.0"
version = "0.7.0"
authors = ["tembo.io"]
edition = "2021"
license = "Apache-2.0"
Expand All @@ -11,14 +11,15 @@ repository = "https://github.com/tembo-io/tembo"
[dependencies]
anyhow = "1.0.71"
futures = "0.3.28"
k8s-openapi = { version = "0.18.0", features = ["v1_25", "schemars"], default-features = false } # This version has to be in line with the same version we use in the controller
lazy_static = "1.4.0"
regex = "1.10.4"
schemars = {version = "0.8.12", features = ["chrono"]}
k8s-openapi = { version = "0.18.0", features = ["v1_25", "schemars"], default-features = false } # This version has to be in line with the same version we use in the controller
serde = "1.0.152"
serde_yaml = "0.9.21"
strum = "0.26.2"
strum_macros = "0.26.2"
tembo-controller = { package = "controller", version = "0.46.0" }
tembo-controller = { package = "controller" , version = "0.47.0" }
tracing = "0.1"
utoipa = { version = "3", features = ["actix_extras", "chrono"] }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

use crate::{
use crate::stacks::types::Stack;
use lazy_static::lazy_static;
use regex::Regex;
use tembo_controller::{
apis::postgres_parameters::{ConfigValue, PgConfig},
errors::ValueError,
stacks::types::Stack,
};

const DEFAULT_MAINTENANCE_WORK_MEM_MB: i32 = 64;
Expand Down Expand Up @@ -288,14 +290,10 @@ fn dynamic_effective_cache_size_mb(sys_mem_mb: i32) -> i32 {
(sys_mem_mb as f64 * EFFECTIVE_CACHE_SIZE).floor() as i32
}

use lazy_static::lazy_static;

lazy_static! {
static ref RE: Regex = Regex::new(r"^([0-9]*\.?[0-9]+)([a-zA-Z]+)$").unwrap();
}

use regex::Regex;

fn split_string(input: &str) -> Result<(f64, String), ValueError> {
if let Some(cap) = RE.captures(input) {
let num = cap[1].parse::<f64>()?;
Expand Down
4 changes: 2 additions & 2 deletions tembo-stacks/src/stacks/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod config_engines;
pub mod types;

use crate::stacks::types::StackType;
use tembo_controller::stacks::types::Stack;
use crate::stacks::types::{Stack, StackType};

use lazy_static::lazy_static;

Expand Down
Loading
Loading