-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kubegraph): begin implementation of visualizer
- Loading branch information
Showing
25 changed files
with
464 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<G> ::kubegraph_api::annotator::NetworkAnnotator<G> for NetworkAnnotator | ||
where | ||
G: Send, | ||
{ | ||
async fn annotate( | ||
&self, | ||
graph: G, | ||
spec: &NetworkAnnotationSpec, | ||
) -> Result<NetworkAnnotationSpec<Script>> | ||
where | ||
G: 'async_trait, | ||
{ | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<G> | ||
where | ||
G: Send, | ||
{ | ||
async fn annotate( | ||
&self, | ||
graph: G, | ||
spec: &NetworkAnnotationSpec, | ||
) -> Result<NetworkAnnotationSpec<Script>> | ||
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<Script = String> { | ||
#[serde(default)] | ||
pub filter: Option<Script>, | ||
pub script: Script, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
use anyhow::Result; | ||
|
||
#[cfg(feature = "vm-local")] | ||
pub async fn try_init() -> Result<::kubegraph_vm_local::NetworkVirtualMachine> { | ||
::kubegraph_vm_local::NetworkVirtualMachine::try_default().await | ||
} | ||
pub type NetworkVirtualMachine = ::kubegraph_vm_local::NetworkVirtualMachine; |
Oops, something went wrong.