pub struct K8sOptimizeConfig {Show 13 fields
pub min_severity: Severity,
pub waste_threshold_percent: u8,
pub safety_margin_percent: u8,
pub include_info: bool,
pub ignore_rules: Vec<String>,
pub exclude_namespaces: Vec<String>,
pub exclude_patterns: Vec<String>,
pub include_system: bool,
pub max_cpu_request_millicores: u32,
pub max_memory_request_mi: u32,
pub max_cpu_limit_ratio: f32,
pub max_memory_limit_ratio: f32,
pub generate_fixes: bool,
}Expand description
Configuration for resource optimization analysis.
Fields§
§min_severity: SeverityMinimum severity to report (default: Info)
waste_threshold_percent: u8Minimum waste percentage to report (default: 10)
safety_margin_percent: u8Safety margin percentage above recommended values (default: 20)
include_info: boolInclude info-level suggestions
ignore_rules: Vec<String>Rules to ignore (by rule code)
exclude_namespaces: Vec<String>Namespaces to exclude
exclude_patterns: Vec<String>Resource name patterns to exclude
include_system: boolInclude system namespaces (kube-system, etc.)
max_cpu_request_millicores: u32Maximum CPU request before flagging (in millicores, default: 1000)
max_memory_request_mi: u32Maximum memory request before flagging (in Mi, default: 2048)
max_cpu_limit_ratio: f32Maximum CPU limit to request ratio (default: 10)
max_memory_limit_ratio: f32Maximum memory limit to request ratio (default: 4)
generate_fixes: boolGenerate YAML fix snippets
Implementations§
Source§impl K8sOptimizeConfig
impl K8sOptimizeConfig
Sourcepub fn with_severity(self, severity: Severity) -> Self
pub fn with_severity(self, severity: Severity) -> Self
Set the minimum severity threshold.
Sourcepub fn with_threshold(self, threshold: u8) -> Self
pub fn with_threshold(self, threshold: u8) -> Self
Set the waste threshold percentage.
Sourcepub fn with_safety_margin(self, margin: u8) -> Self
pub fn with_safety_margin(self, margin: u8) -> Self
Set the safety margin percentage.
Sourcepub fn ignore_rule(self, rule: impl Into<String>) -> Self
pub fn ignore_rule(self, rule: impl Into<String>) -> Self
Add a rule to ignore.
Sourcepub fn exclude_namespace(self, namespace: impl Into<String>) -> Self
pub fn exclude_namespace(self, namespace: impl Into<String>) -> Self
Add a namespace to exclude.
Sourcepub fn with_system(self) -> Self
pub fn with_system(self) -> Self
Include system namespaces.
Sourcepub fn should_ignore_rule(&self, rule: &str) -> bool
pub fn should_ignore_rule(&self, rule: &str) -> bool
Check if a rule should be ignored.
Sourcepub fn should_exclude_namespace(&self, namespace: &str) -> bool
pub fn should_exclude_namespace(&self, namespace: &str) -> bool
Check if a namespace should be excluded.
Sourcepub fn should_ignore_path(&self, path: &Path) -> bool
pub fn should_ignore_path(&self, path: &Path) -> bool
Check if a path should be ignored.
Trait Implementations§
Source§impl Clone for K8sOptimizeConfig
impl Clone for K8sOptimizeConfig
Source§fn clone(&self) -> K8sOptimizeConfig
fn clone(&self) -> K8sOptimizeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for K8sOptimizeConfig
impl Debug for K8sOptimizeConfig
Source§impl Default for K8sOptimizeConfig
impl Default for K8sOptimizeConfig
Source§impl<'de> Deserialize<'de> for K8sOptimizeConfig
impl<'de> Deserialize<'de> for K8sOptimizeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for K8sOptimizeConfig
impl RefUnwindSafe for K8sOptimizeConfig
impl Send for K8sOptimizeConfig
impl Sync for K8sOptimizeConfig
impl Unpin for K8sOptimizeConfig
impl UnwindSafe for K8sOptimizeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more