- Add Kubernetes cluster management and operations - Include pod, service, and deployment management - Implement pattern-based resource deletion - Support namespace creation and management - Provide Rhai scripting wrappers for all functions - Include production safety features (timeouts, retries, rate limiting)
50 lines
1.5 KiB
Rust
50 lines
1.5 KiB
Rust
//! SAL Kubernetes: Kubernetes cluster management and operations
|
|
//!
|
|
//! This package provides Kubernetes cluster management functionality including:
|
|
//! - Namespace-scoped resource management via KubernetesManager
|
|
//! - Pod listing and management
|
|
//! - Resource deletion with PCRE pattern matching
|
|
//! - Namespace creation and management
|
|
//! - Support for various Kubernetes resources (pods, services, deployments, etc.)
|
|
//!
|
|
//! # Example
|
|
//!
|
|
//! ```rust
|
|
//! use sal_kubernetes::KubernetesManager;
|
|
//!
|
|
//! #[tokio::main]
|
|
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
//! // Create a manager for the "default" namespace
|
|
//! let km = KubernetesManager::new("default").await?;
|
|
//!
|
|
//! // List all pods in the namespace
|
|
//! let pods = km.pods_list().await?;
|
|
//! println!("Found {} pods", pods.len());
|
|
//!
|
|
//! // Create a namespace (idempotent)
|
|
//! km.namespace_create("my-namespace").await?;
|
|
//!
|
|
//! // Delete resources matching a pattern
|
|
//! km.delete("test-.*").await?;
|
|
//!
|
|
//! Ok(())
|
|
//! }
|
|
//! ```
|
|
|
|
pub mod config;
|
|
pub mod error;
|
|
pub mod kubernetes_manager;
|
|
|
|
// Rhai integration module
|
|
#[cfg(feature = "rhai")]
|
|
pub mod rhai;
|
|
|
|
// Re-export main types for convenience
|
|
pub use config::KubernetesConfig;
|
|
pub use error::KubernetesError;
|
|
pub use kubernetes_manager::KubernetesManager;
|
|
|
|
// Re-export commonly used Kubernetes types
|
|
pub use k8s_openapi::api::apps::v1::{Deployment, ReplicaSet};
|
|
pub use k8s_openapi::api::core::v1::{Namespace, Pod, Service};
|