Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
301be35
[#158]: moved map_handlers module from identity crate to common crate
LorenzoTettamanti Jan 16, 2026
1385bcf
[#158]: simplified identity logic. removed duplicated code and functions
LorenzoTettamanti Jan 16, 2026
b9edd1d
[#158]: added program handlers function in the common crate. Remove d…
LorenzoTettamanti Jan 22, 2026
d3a5342
[#168]: added load from program-handlers in identity user space imple…
LorenzoTettamanti Jan 22, 2026
b8449a3
[#158]: fixed typos in the map names
LorenzoTettamanti Jan 23, 2026
52cab4c
[#158]: fixed bpf error: Error: the program is already loaded.Improve…
LorenzoTettamanti Jan 23, 2026
2bd44b6
[#174]: added open telemetry (otel) logger for logs. Added otel daemo…
LorenzoTettamanti Jan 25, 2026
cd4687f
[#158]: improved docs for the conntracker data structures. removed us…
LorenzoTettamanti Jan 25, 2026
b21a58a
[#174]: Added otel libraries and features in the common crate. .updat…
LorenzoTettamanti Jan 25, 2026
69863bb
[#158]: imroved documentation in the user space for the identity (Vet…
LorenzoTettamanti Jan 25, 2026
af85614
[#158]: restored blocklist map initialization
LorenzoTettamanti Jan 26, 2026
1cbd9f5
[#158]: added better docs. Updated while true pattern with "loop" pat…
LorenzoTettamanti Jan 27, 2026
440d44d
[#174]: added prettify to logger
LorenzoTettamanti Jan 27, 2026
84c4efa
[fix]: solved merge conflicts
LorenzoTettamanti Jan 27, 2026
c0afdf4
[#181]: added command to repair blocklist configmaps
LorenzoTettamanti Jan 27, 2026
c3e47b1
[#182]: added GetTrackedVeth grpc endpoint definition
LorenzoTettamanti Jan 30, 2026
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
84 changes: 83 additions & 1 deletion cli/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ use crate::errors::CliError;
use crate::essential::{BASE_COMMAND, connect_to_client, create_config_file, create_configs};
use clap::{Args, Subcommand};
use colored::Colorize;
use kube::Error;
use k8s_openapi::api::core::v1::ConfigMap;
use kube::core::ErrorResponse;
use kube::{Api, Client, Error};
use std::thread::sleep;
use std::{process::Command, thread, time::Duration};

// docs:
Expand Down Expand Up @@ -38,6 +40,8 @@ pub enum InstallCommands {
about = "Deploys a simple example contained in deploy-test-pod.yaml"
)]
TestPods,
#[command(name = "blocklist", about = "Install or Repair blocklist configmap")]
Blocklist,
}

//install args
Expand Down Expand Up @@ -206,6 +210,84 @@ async fn install_simple_example_component() -> Result<(), CliError> {
}
}

// docs:
pub async fn install_blocklist_configmap() -> Result<(), CliError> {
match connect_to_client().await {
Ok(client) => {
println!(
"{} {}",
"=====>".blue().bold(),
"Checking if the Blocklist configmap exists"
);
sleep(Duration::from_secs(1));
let blocklist_exists = check_if_blocklist_exists(client).await?;
if !blocklist_exists {
println!(
"{} {}",
"=====>".blue().bold(),
"Blocklist configmap does not exist".red().bold()
);
sleep(Duration::from_secs(1));
println!("{} {}", "=====>".bold().blue(), "Creating configmap");
let metdata_configs = create_configs();
sleep(Duration::from_secs(1));
match create_config_file(metdata_configs).await {
Ok(_) => {
println!(
"{} {}",
"=====>".bold().blue(),
"Configmap created/repaired successfully".bold().green()
)
}
Err(e) => {
return Err(CliError::InstallerError {
reason: e.to_string(),
});
}
}
return Ok(());
} else {
println!()
}

Ok(())
}
Err(e) => {
return Err(CliError::ClientError(Error::Api(ErrorResponse {
status: "failed".to_string(),
message: "Failed to connect to kubernetes client".to_string(),
reason: e.to_string(),
code: 404,
})));
}
}
}

// docs:
async fn check_if_blocklist_exists(client: Client) -> Result<bool, CliError> {
let namespace = "cortexflow";
let name = "cortexbrain-client-config";
let api: Api<ConfigMap> = Api::namespaced(client, namespace);
match api.get(name).await {
Ok(_) => {
println!(
"{} {}",
"=====>".bold().blue(),
"Blocklist configmap exists".green().bold()
);
Ok(true)
}
Err(_) => {
println!(
"{} {}",
"=====>".bold().blue(),
"Blocklist configmap doesn not exists".red().bold(),
);
Ok(false)
}
}
}

//docs:
//
// This is an auxiliary function to help manage the cortexflow components during the installation
Expand Down
6 changes: 5 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ enum Commands {
struct SetArgs {
val: String,
}

//TODO: add command for monitoring veth interfaces
async fn args_parser() -> Result<(), CliError> {
let args = Cli::parse();
debug!("Arguments {:?}", args.cmd);
Expand All @@ -80,6 +80,10 @@ async fn args_parser() -> Result<(), CliError> {
InstallCommands::TestPods => {
install_simple_example().await?;
}
InstallCommands::Blocklist => {
//install or repair blocklist configmap
let _ = install::install_blocklist_configmap().await?;
}
},
Some(Commands::Uninstall) => {
uninstall().await?;
Expand Down
Loading