Expand description
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
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(())
}Re-exports§
pub use config::KubernetesConfig;pub use error::KubernetesError;pub use kubernetes_manager::KubernetesManager;
Modules§
- config
- Configuration for production safety features
- error
- Error types for SAL Kubernetes operations
- kubernetes_
manager - Kubernetes Manager - Core functionality for namespace-scoped Kubernetes operations
- rhai
- Rhai wrappers for Kubernetes module functions
Structs§
- Deployment
- Deployment enables declarative updates for Pods and ReplicaSets.
- Namespace
- Namespace provides a scope for Names. Use of multiple namespaces is optional.
- Pod
- Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.
- Replica
Set - ReplicaSet ensures that a specified number of pod replicas are running at any given time.
- Service
- Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.