diff --git a/Cargo.toml b/Cargo.toml index 45584d84..48a27a86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,7 @@ members = [ "crates/kiss/monitor", "crates/kiss/operator", "crates/kubegraph/analyzer/llm", + "crates/kubegraph/annotator", "crates/kubegraph/api", "crates/kubegraph/connector/fake", "crates/kubegraph/connector/local", @@ -47,8 +48,11 @@ members = [ "crates/kubegraph/operator", "crates/kubegraph/parser", "crates/kubegraph/runner/simulator", + "crates/kubegraph/simulator", "crates/kubegraph/solver/ortools", + "crates/kubegraph/visualizer", "crates/kubegraph/vm/http", + "crates/kubegraph/vm/lazy", "crates/kubegraph/vm/local", "crates/straw/api", "crates/straw/provider", @@ -113,6 +117,9 @@ deltalake = { version = "0.17", features = [ ] } derivative = { version = "2.2" } dirs = { version = "5.0" } +eframe = { version = "0.27" } +egui = { version = "0.27" } +egui_graphs = { version = "0.20" } email_address = { version = "0.2" } futures = { version = "0.3" } gethostname = { version = "0.4" } @@ -176,6 +183,7 @@ ordered-float = { version = "4.2", default-features = false, features = [ "serde", "std", ] } +petgraph = { version = "0.6" } polars = { version = "0.40", features = [ "diagonal_concat", "diff", diff --git a/crates/kubegraph/annotator/Cargo.toml b/crates/kubegraph/annotator/Cargo.toml new file mode 100644 index 00000000..a666afff --- /dev/null +++ b/crates/kubegraph/annotator/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "kubegraph-annotator" + +authors = { workspace = true } +description = { workspace = true } +documentation = { workspace = true } +edition = { workspace = true } +include = { workspace = true } +keywords = { workspace = true } +license = { workspace = true } +readme = { workspace = true } +rust-version = { workspace = true } +homepage = { workspace = true } +repository = { workspace = true } +version = { workspace = true } + +[lints] +workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +kubegraph-api = { path = "../api" } +kubegraph-vm-lazy = { path = "../vm/lazy" } + +anyhow = { workspace = true } +async-trait = { workspace = true } diff --git a/crates/kubegraph/annotator/src/lib.rs b/crates/kubegraph/annotator/src/lib.rs new file mode 100644 index 00000000..a653c755 --- /dev/null +++ b/crates/kubegraph/annotator/src/lib.rs @@ -0,0 +1,22 @@ +use anyhow::Result; +use async_trait::async_trait; +use kubegraph_api::{annotator::NetworkAnnotationSpec, vm::Script}; + +pub struct NetworkAnnotator {} + +#[async_trait] +impl ::kubegraph_api::annotator::NetworkAnnotator for NetworkAnnotator +where + G: Send, +{ + async fn annotate( + &self, + graph: G, + spec: &NetworkAnnotationSpec, + ) -> Result> + where + G: 'async_trait, + { + todo!() + } +} diff --git a/crates/kubegraph/api/Cargo.toml b/crates/kubegraph/api/Cargo.toml index 4611b252..7fa506b2 100644 --- a/crates/kubegraph/api/Cargo.toml +++ b/crates/kubegraph/api/Cargo.toml @@ -42,7 +42,14 @@ df-polars = ["dep:polars"] function-full = ["function-dummy"] function-dummy = [] +# Virtual Machines +vm-entrypoint = ["ark-core"] + [dependencies] +ark-core = { path = "../../ark/core", optional = true, features = [ + "actix-web", + "signal", +] } ark-core-k8s = { path = "../../ark/core/k8s", features = ["data"] } anyhow = { workspace = true } diff --git a/crates/kubegraph/api/src/annotator.rs b/crates/kubegraph/api/src/annotator.rs new file mode 100644 index 00000000..c1379525 --- /dev/null +++ b/crates/kubegraph/api/src/annotator.rs @@ -0,0 +1,49 @@ +use anyhow::Result; +use async_trait::async_trait; +use kube::CustomResource; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::vm::Script; + +#[async_trait] +pub trait NetworkAnnotator +where + G: Send, +{ + async fn annotate( + &self, + graph: G, + spec: &NetworkAnnotationSpec, + ) -> Result> + where + G: 'async_trait; +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema, CustomResource)] +#[kube( + group = "kubegraph.ulagbulag.io", + version = "v1alpha1", + kind = "NetworkAnnotation", + root = "NetworkAnnotationCrd", + shortname = "nf", + namespaced, + printcolumn = r#"{ + "name": "created-at", + "type": "date", + "description": "created time", + "jsonPath": ".metadata.creationTimestamp" + }"#, + printcolumn = r#"{ + "name": "version", + "type": "integer", + "description": "annotation version", + "jsonPath": ".metadata.generation" + }"# +)] +#[serde(rename_all = "camelCase")] +pub struct NetworkAnnotationSpec