Expand description
§talos-api-rs
A typed, async, idiomatic Rust client for the Talos Linux gRPC API.
§Features
- 40+ APIs — Machine, etcd, system, files, diagnostics
- Async-first — Built on
tokioandtonic - Strongly typed — No stringly-typed API calls
- Production-ready — Retries, circuit breakers, connection pooling
- Observable — Prometheus metrics, OpenTelemetry tracing
- mTLS support — ED25519 certificates (Talos default)
§Quick Start
ⓘ
use talos_api_rs::{TalosClient, TalosClientConfig};
// Connect with mTLS
let config = TalosClientConfig::builder("https://10.0.0.1:50000")
.ca_cert("/path/to/ca.crt")
.client_cert("/path/to/client.crt")
.client_key("/path/to/client.key")
.build();
let client = TalosClient::new(config).await?;
// Get kubeconfig from cluster
let kubeconfig = client.kubeconfig().await?;
println!("Got kubeconfig for cluster");§Module Overview
client— Core client and connection managementconfig— Configuration file parsing (talosctl config)resources— Typed API request/response wrappersruntime— Resilience (retry, circuit breaker) and observabilityerror— Error typesapi— Generated protobuf types (low-level)testkit— Testing utilities
§Production Features
§Retry Policies
use talos_api_rs::runtime::{RetryConfig, ExponentialBackoff};
use std::time::Duration;
let retry = RetryConfig::builder()
.max_retries(3)
.backoff(ExponentialBackoff::new(Duration::from_millis(100)))
.build();§Circuit Breaker
use talos_api_rs::runtime::{CircuitBreaker, CircuitBreakerConfig};
use std::time::Duration;
let cb = CircuitBreaker::new(
CircuitBreakerConfig::new()
.with_failure_threshold(5)
.with_reset_timeout(Duration::from_secs(30))
);§Prometheus Metrics
use talos_api_rs::runtime::{MetricsCollector, MetricsConfig};
let metrics = MetricsCollector::new(
MetricsConfig::builder()
.namespace("talos")
.build()
);
// Export Prometheus format
let output = metrics.to_prometheus_text();§Disclaimer
This project is NOT affiliated with Sidero Labs or Talos Linux. Provided AS-IS, without warranty of any kind.
Re-exports§
pub use client::ConnectionPool;pub use client::ConnectionPoolConfig;pub use client::EndpointHealth;pub use client::HealthStatus;pub use client::LoadBalancer;pub use client::NodeTarget;pub use client::TalosClient;pub use client::TalosClientConfig;pub use client::TalosClientConfigBuilder;pub use client::NODE_METADATA_KEY;pub use config::TalosConfig;pub use config::TalosContext;pub use config::ENV_TALOSCONFIG;pub use config::ENV_TALOS_CONTEXT;pub use config::ENV_TALOS_ENDPOINTS;pub use config::ENV_TALOS_NODES;pub use error::TalosError;pub use resources::ApplyConfigurationRequest;pub use resources::ApplyConfigurationResponse;pub use resources::ApplyConfigurationResult;pub use resources::ApplyMode;pub use resources::BootstrapRequest;pub use resources::BootstrapResponse;pub use resources::BootstrapResult;pub use resources::ConnectionRecord;pub use resources::ConnectionState;pub use resources::ContainerDriver;pub use resources::ContainerdNamespace;pub use resources::CopyRequest;pub use resources::CopyResponse;pub use resources::CpuInfo;pub use resources::CpuInfoResponse;pub use resources::CpuInfoResult;pub use resources::DiskStat;pub use resources::DiskStatsResponse;pub use resources::DiskStatsResult;pub use resources::DiskUsageInfo;pub use resources::DiskUsageRequest;pub use resources::DiskUsageResponse;pub use resources::DmesgRequest;pub use resources::DmesgResponse;pub use resources::EtcdAlarmDisarmResponse;pub use resources::EtcdAlarmListResponse;pub use resources::EtcdAlarmType;pub use resources::EtcdDefragmentResponse;pub use resources::EtcdForfeitLeadershipRequest;pub use resources::EtcdForfeitLeadershipResponse;pub use resources::EtcdLeaveClusterRequest;pub use resources::EtcdLeaveClusterResponse;pub use resources::EtcdMember;pub use resources::EtcdMemberAlarm;pub use resources::EtcdMemberListRequest;pub use resources::EtcdMemberListResponse;pub use resources::EtcdMemberStatus;pub use resources::EtcdRemoveMemberByIdRequest;pub use resources::EtcdRemoveMemberByIdResponse;pub use resources::EtcdStatusResponse;pub use resources::FileInfo;pub use resources::FileType;pub use resources::GenerateClientConfigurationRequest;pub use resources::GenerateClientConfigurationResponse;pub use resources::GenerateClientConfigurationResult;pub use resources::ImageInfo;pub use resources::ImageListRequest;pub use resources::ImagePullRequest;pub use resources::ImagePullResponse;pub use resources::ImagePullResult;pub use resources::KubeconfigResponse;pub use resources::L4ProtoFilter;pub use resources::ListRequest;pub use resources::ListResponse;pub use resources::LoadAvgResponse;pub use resources::LoadAvgResult;pub use resources::LogsRequest;pub use resources::LogsResponse;pub use resources::MemoryResponse;pub use resources::MemoryResult;pub use resources::MountStat;pub use resources::MountsResponse;pub use resources::MountsResult;pub use resources::NetDevStat;pub use resources::NetstatFilter;pub use resources::NetstatRequest;pub use resources::NetstatResponse;pub use resources::NetstatResult;pub use resources::NetworkDeviceStatsResponse;pub use resources::NetworkDeviceStatsResult;pub use resources::PacketCaptureRequest;pub use resources::PacketCaptureResponse;pub use resources::ProcessInfo;pub use resources::ProcessesResponse;pub use resources::ProcessesResult;pub use resources::ReadRequest;pub use resources::ReadResponse;pub use resources::ResetPartitionSpec;pub use resources::ResetRequest;pub use resources::ResetResponse;pub use resources::ResetResult;pub use resources::RollbackResponse;pub use resources::RollbackResult;pub use resources::ServiceRestartRequest;pub use resources::ServiceRestartResponse;pub use resources::ServiceStartRequest;pub use resources::ServiceStartResponse;pub use resources::ServiceStopRequest;pub use resources::ServiceStopResponse;pub use resources::UpgradeRebootMode;pub use resources::UpgradeRequest;pub use resources::UpgradeResponse;pub use resources::UpgradeResult;pub use resources::WipeMode;pub use runtime::BackoffStrategy;pub use runtime::CircuitBreaker;pub use runtime::CircuitBreakerConfig;pub use runtime::CircuitState;pub use runtime::CustomRetryPolicy;pub use runtime::DefaultRetryPolicy;pub use runtime::ExponentialBackoff;pub use runtime::FixedBackoff;pub use runtime::InterceptorMetrics;pub use runtime::LinearBackoff;pub use runtime::LogLevel;pub use runtime::LoggingConfig;pub use runtime::LoggingInterceptor;pub use runtime::NoBackoff;pub use runtime::NoRetryPolicy;pub use runtime::RequestLogger;pub use runtime::RequestSpan;pub use runtime::RetryConfig;pub use runtime::RetryConfigBuilder;pub use runtime::RetryPolicy;
Modules§
- api
- client
- config
- Configuration management for Talos clients
- error
- resources
- Strongly typed domain wrappers for Talos resources.
- runtime
- Runtime utilities for resilience and observability.
- testkit
Macros§
- instrument_
talos - Helper macro for creating instrumented async functions.