Skip to content

Commit

Permalink
Merge branch 'main' into nhudson/multi-infer-svc
Browse files Browse the repository at this point in the history
  • Loading branch information
nhudson authored Oct 10, 2024
2 parents 536563a + afe564e commit fbda1c4
Show file tree
Hide file tree
Showing 24 changed files with 138 additions and 74 deletions.
3 changes: 2 additions & 1 deletion .github/actions/argocd-update/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ runs:
yq -i '(.spec.source.helm.parameters.[] | select(.name == "inferenceService.default.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "controller.image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-operator-gke-usc1.yaml
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai.yaml
yq -i '.spec.source.targetRevision= "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai-events-reporter.yaml
yq -i '(.spec.source.helm.parameters.[] | select(.name == "image.tag")).value = "${{ inputs.version }}"' ${{ inputs.clone_into }}/${{ inputs.subdirectory }}/tembo-ai-events-reporter.yaml
- name: Update for prod deployments
if: inputs.branch == 'prod-updates'
Expand Down
12 changes: 6 additions & 6 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.github/** @nhudson @ianstanton @vrmiguel
charts/** @nhudson @ianstanton
.github/** @nhudson @ianstanton @shahadarsh @vrmiguel
charts/** @nhudson @ianstanton @shahadarsh
dataplane-webserver/** @nhudson @ianstanton @vrmiguel
tembo-operator/** @nhudson @ianstanton @ChuckHend @vrmiguel
conductor/** @nhudson @ianstanton @ChuckHend @vrmiguel
tembo-operator/** @nhudson @ianstanton @ChuckHend @vrmiguel
conductor/** @nhudson @ianstanton @ChuckHend @vrmiguel
tembo-pod-init/** @nhudson @ianstanton
tembo-cli/** @shahadarsh @vrmiguel @DarrenBaldwin07
tembo-cli/** @shahadarsh @vrmiguel @DarrenBaldwin07 @joshuajerin
tembo-py/** @chuckhend
tembo-stacks/** @chuckhend @jasonmp85
inference-gateway/** @chuckhend @jasonmp85
inference-gateway/** @chuckhend @jasonmp85
2 changes: 1 addition & 1 deletion charts/tembo-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: tembo-operator
description: "Helm chart to deploy the tembo-operator"
type: application
icon: https://cloud.tembo.io/images/TemboElephant.png
version: 0.7.3
version: 0.7.4
home: https://tembo.io
sources:
- https://github.com/tembo-io/tembo
Expand Down
2 changes: 1 addition & 1 deletion charts/tembo-operator/templates/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ spec:
description: |-
Configure the load balancer to be public or private.
**Default**: false.
**Default**: true.
type: boolean
serviceType:
default: LoadBalancer
Expand Down
12 changes: 12 additions & 0 deletions conductor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ async fn run(metrics: CustomMetrics) -> Result<(), ConductorError> {
.unwrap_or_else(|_| "".to_owned())
.parse()
.expect("error parsing GCP_PROJECT_NUMBER");
let is_loadbalancer_public: bool = env::var("IS_LOADBALANCER_PUBLIC")
.unwrap_or_else(|_| "true".to_owned())
.parse()
.expect("error parsing IS_LOADBALANCER_PUBLIC");

// Error and exit if CF_TEMPLATE_BUCKET is not set when IS_CLOUD_FORMATION is enabled
if is_cloud_formation && cf_template_bucket.is_empty() {
Expand Down Expand Up @@ -279,6 +283,7 @@ async fn run(metrics: CustomMetrics) -> Result<(), ConductorError> {
&mut coredb_spec,
is_cloud_formation,
&client,
is_loadbalancer_public,
)
.await
{
Expand Down Expand Up @@ -801,6 +806,7 @@ async fn init_cloud_perms(
coredb_spec: &mut CoreDBSpec,
is_cloud_formation: bool,
_client: &Client,
is_loadbalancer_public: bool,
) -> Result<(), ConductorError> {
if !is_cloud_formation {
return Ok(());
Expand Down Expand Up @@ -860,6 +866,12 @@ async fn init_cloud_perms(
coredb_spec.backup = backup;
coredb_spec.serviceAccountTemplate = service_account_template;

if is_loadbalancer_public {
if let Some(ref mut dedicated_networking) = coredb_spec.dedicated_networking {
dedicated_networking.public = true;
}
}

Ok(())
}

Expand Down
12 changes: 6 additions & 6 deletions tembo-cli/Cargo.lock

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

8 changes: 4 additions & 4 deletions tembo-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
workspace = { members = ["temboclient", "tembodataclient"] }
[package]
name = "tembo-cli"
version = "0.20.7"
version = "0.20.8"
edition = "2021"
authors = ["Tembo.io"]
description = "The CLI for Tembo"
Expand Down Expand Up @@ -54,7 +54,7 @@ dateparser = "0.2.0"
log = "0.4.20"
tera = "1.18.1"
curl = "0.4.44"
temboclient = { version = "1.0.3", path = "temboclient" }
temboclient = { version = "1.0.4", path = "temboclient" }
tembodataclient = { version = "0.0.2", path = "tembodataclient" }
tokio = { version = "1.26.0", features = [
"rt",
Expand All @@ -65,7 +65,7 @@ tokio = { version = "1.26.0", features = [
tungstenite ="0.21.0"
futures-util = "0.3.30"
dirs = "5.0.1"
controller = "0.50.0"
controller = "0.50.1"
sqlx = { version = "0.8.2", features = ["runtime-tokio-native-tls", "postgres", "chrono", "json"] }
base64 = "0.21.5"
colorful = "0.2.2"
Expand All @@ -75,7 +75,7 @@ tiny-gradient = "0.1.0"
urlencoding = "2.1.3"
spinoff = "0.8.0"
k8s-openapi = { version = "0.18.0", features = ["v1_25", "schemars"], default-features = false }
tembo-stacks = "0.16.2"
tembo-stacks = "0.16.7"
itertools = "0.12.1"
random-string = "1.1.0"
test-case = "=2.0.0-rc2"
Expand Down
9 changes: 5 additions & 4 deletions tembo-cli/src/cli/context.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::fmt::Display;
use std::fs;

use anyhow::Error;
Expand Down Expand Up @@ -102,11 +103,11 @@ impl Profile {
}
}

impl ToString for Target {
fn to_string(&self) -> String {
impl Display for Target {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Docker => String::from("docker"),
Self::TemboCloud => String::from("tembo-cloud"),
Target::Docker => f.write_str("docker"),
Target::TemboCloud => f.write_str("tembo-cloud"),
}
}
}
Expand Down
16 changes: 13 additions & 3 deletions tembo-cli/src/cmd/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,6 @@ pub fn get_rendered_dockerfile(
_ => &stack.images.pg15,
};

// Sorts trunk_installs so the installation order is deterministic, also make sure vector is last
if let Some(mut installs) = trunk_installs.as_ref().cloned() {
// Sort by name, but ensure "vector" is always last
installs.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
Expand Down Expand Up @@ -1389,14 +1388,25 @@ async fn get_trunk_projects(name: &String) -> Result<Vec<TrunkProject>, Error> {
pub fn get_rendered_dockercompose(
instance_settings: HashMap<String, InstanceSettings>,
) -> Result<String, anyhow::Error> {
// Include the docker-compose template directly into the binary
let contents = include_str!("../../tembo/docker-compose.yml.template");

let mut tera = Tera::new("templates/**/*").unwrap();
let _ = tera.add_raw_template("docker-compose", contents);
let mut context = Context::new();

context.insert("instance_settings", &instance_settings);
// replace the image for VectorDB
let mut updated_instance_settings = instance_settings.clone();
for (_key, instance) in updated_instance_settings.iter_mut() {
if instance.stack_type == Some("VectorDB".to_string()) {
if let Some(app_services) = &mut instance.controller_app_services {
if let Some(embeddings) = app_services.get_mut("embeddings") {
embeddings.image = "quay.io/tembo/vector-serve:latest".to_string();
}
}
}
}

context.insert("instance_settings", &updated_instance_settings);

let rendered_dockercompose = tera.render("docker-compose", &context).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion tembo-cli/temboclient/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "temboclient"
version = "1.0.3"
version = "1.0.4"
authors = ["OpenAPI Generator team and contributors"]
description = "Platform API for Tembo Cloud </br> </br> To find a Tembo Data API, please find it here: </br> </br> [AWS US East 1](https://api.data-1.use1.tembo.io/swagger-ui/) "
# Override this license by providing a License Object in the OpenAPI.
Expand Down
2 changes: 2 additions & 0 deletions tembo-cli/temboclient/src/models/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ impl FromStr for Memory {
"8Gi" => Ok(Memory::Variant8Gi),
"16Gi" => Ok(Memory::Variant16Gi),
"32Gi" => Ok(Memory::Variant32Gi),
"64Gi" => Ok(Memory::Variant64Gi),
_ => Err(()),
}
}
Expand Down Expand Up @@ -83,6 +84,7 @@ impl FromStr for StackType {
"MongoAlternative" => Ok(StackType::MongoAlternative),
"RAG" => Ok(StackType::Rag),
"Timeseries" => Ok(StackType::Timeseries),
"ParadeDB" => Ok(StackType::ParadeDB),
_ => Err(()),
}
}
Expand Down
3 changes: 3 additions & 0 deletions tembo-cli/temboclient/src/models/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pub enum Memory {
Variant16Gi,
#[serde(rename = "32Gi")]
Variant32Gi,
#[serde(rename = "64Gi")]
Variant64Gi,
}

impl ToString for Memory {
Expand All @@ -34,6 +36,7 @@ impl ToString for Memory {
Self::Variant8Gi => String::from("8Gi"),
Self::Variant16Gi => String::from("16Gi"),
Self::Variant32Gi => String::from("32Gi"),
Self::Variant64Gi => String::from("64Gi"),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions tembo-cli/temboclient/src/models/stack_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub enum StackType {
Rag,
#[serde(rename = "Timeseries")]
Timeseries,
#[serde(rename = "ParadeDB")]
ParadeDB,
}

impl ToString for StackType {
Expand All @@ -52,6 +54,7 @@ impl ToString for StackType {
Self::MongoAlternative => String::from("MongoAlternative"),
Self::Rag => String::from("RAG"),
Self::Timeseries => String::from("Timeseries"),
Self::ParadeDB => String::from("ParadeDB"),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tembo-cli/tests/integration_tests_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ async fn minimal_cloud() -> Result<(), Box<dyn Error>> {
// tembo apply
let mut cmd = Command::cargo_bin(CARGO_BIN).unwrap();
cmd.arg("apply");
cmd.assert().success();

let output = cmd.output()?;
assert!(output.status.success(), "`tembo apply` did not succeed");

if output
.stdout
Expand Down
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.50.1"
version = "0.50.2"
edition = "2021"
default-run = "controller"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion tembo-operator/src/apis/coredb_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ pub struct DedicatedNetworking {

/// Configure the load balancer to be public or private.
///
/// **Default**: false.
/// **Default**: true.
#[serde(default)]
pub public: bool,

Expand Down
25 changes: 17 additions & 8 deletions tembo-operator/src/dedicated_networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,6 @@ async fn reconcile_dedicated_networking_service(
"cnpg.io/cluster".to_string(),
serde_json::Value::String(cdb_name.to_string()),
);
if is_public {
labels.insert(
"public".to_string(),
serde_json::Value::String("true".to_string()),
);
}

let mut service_spec = serde_json::Map::new();
service_spec.insert(
Expand All @@ -427,8 +421,23 @@ async fn reconcile_dedicated_networking_service(
service_spec.insert("type".to_string(), json!(service_type));
let ip_allow_list = cdb.spec.ip_allow_list.clone().unwrap_or_else(|| vec![]);

if service_type == "LoadBalancer" && !ip_allow_list.is_empty() {
service_spec.insert("loadBalancerSourceRanges".to_string(), json!(ip_allow_list));
// Allow ip_allow_list to allow all entries are in CIDR notation
let ip_allow_list_cidr: Vec<String> = ip_allow_list
.iter()
.map(|ip| {
if ip.contains('/') {
ip.clone()
} else {
format!("{}/32", ip)
}
})
.collect();

if service_type == "LoadBalancer" && !ip_allow_list_cidr.is_empty() {
service_spec.insert(
"loadBalancerSourceRanges".to_string(),
json!(ip_allow_list_cidr),
);
}

let service = json!({
Expand Down
20 changes: 0 additions & 20 deletions tembo-operator/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2153,16 +2153,6 @@ mod test {
service.spec.as_ref().unwrap().type_,
Some("LoadBalancer".to_string())
);
assert_eq!(
service
.metadata
.labels
.as_ref()
.expect("Labels should be present")
.get("public")
.expect("Public label should be present"),
"true"
);

let annotations = service
.metadata
Expand Down Expand Up @@ -2226,16 +2216,6 @@ mod test {
service.spec.as_ref().unwrap().type_,
Some("LoadBalancer".to_string())
);
assert_eq!(
service
.metadata
.labels
.as_ref()
.expect("Labels should be present")
.get("public")
.expect("Public label should be present"),
"true"
);

let annotations = service
.metadata
Expand Down
2 changes: 1 addition & 1 deletion tembo-stacks/Cargo.lock

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

Loading

0 comments on commit fbda1c4

Please sign in to comment.