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

Replace Stacks ComputeTemplate with ComputeConstraint #760

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 24 additions & 1 deletion tembo-operator/Cargo.lock

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

3 changes: 2 additions & 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.45.1"
version = "0.46.0"
edition = "2021"
default-run = "controller"
license = "Apache-2.0"
Expand Down Expand Up @@ -53,6 +53,7 @@ anyhow = "1.0.72"
rand = "0.8.5"
reqwest = { version = "0.11.20", features = ["json", "trust-dns"] }
utoipa = "3.5.0"
strum = { version = "0.26.2", features = ["derive"] }

[dev-dependencies]
assert-json-diff = "2.0.2"
Expand Down
19 changes: 8 additions & 11 deletions tembo-operator/src/stacks/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ use utoipa::ToSchema;
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, ToSchema)]
pub struct Stack {
pub name: String,
pub compute_templates: Option<Vec<ComputeTemplate>>,
/// specifies any resource constraints that should be applied to an instance of the Stack
pub compute_constraints: Option<ComputeConstraint>,
ChuckHend marked this conversation as resolved.
Show resolved Hide resolved
pub description: Option<String>,
/// Organization hosting the Docker images used in this stack
/// Default: "tembo"
Expand Down Expand Up @@ -94,18 +95,14 @@ fn default_storage() -> String {
}

#[derive(Clone, Debug, Serialize, Deserialize, ToSchema, JsonSchema, PartialEq)]
pub struct ComputeTemplate {
pub cpu: String,
pub memory: String,
pub instance_class: InstanceClass,
pub struct ComputeConstraint {
jasonmp85 marked this conversation as resolved.
Show resolved Hide resolved
pub min: Option<ComputeResource>,
}

#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, ToSchema)]
pub enum InstanceClass {
#[default]
GeneralPurpose,
MemoryOptimized,
ComputeOptimized,
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema, JsonSchema, PartialEq)]
pub struct ComputeResource {
pub cpu: Option<String>,
pub memory: Option<String>,
}

#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, ToSchema)]
Expand Down
Loading