genpolicy: add default implementation for use_host_network

- Provide default implementation for use_host_network
- Remove default implementation from structs implementing the trait K8sResource

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
This commit is contained in:
Archana Choudhary 2024-04-21 12:18:08 +00:00
parent 9a3eac5306
commit d5d3f9cda7
5 changed files with 4 additions and 17 deletions

View File

@ -99,10 +99,6 @@ impl yaml::K8sResource for ConfigMap {
&self.metadata.annotations
}
fn use_host_network(&self) -> bool {
panic!("Unsupported");
}
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}

View File

@ -81,10 +81,6 @@ impl yaml::K8sResource for List {
serde_yaml::to_string(&self).unwrap()
}
fn use_host_network(&self) -> bool {
panic!("Unsupported");
}
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}

View File

@ -35,10 +35,6 @@ impl yaml::K8sResource for NoPolicyResource {
self.yaml.clone()
}
fn use_host_network(&self) -> bool {
panic!("Unsupported");
}
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}

View File

@ -84,10 +84,6 @@ impl yaml::K8sResource for Secret {
serde_yaml::to_string(&self.doc_mapping).unwrap()
}
fn use_host_network(&self) -> bool {
panic!("Unsupported");
}
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}

View File

@ -78,7 +78,10 @@ pub trait K8sResource {
panic!("Unsupported");
}
fn use_host_network(&self) -> bool;
fn use_host_network(&self) -> bool {
panic!("Unsupported");
}
fn use_sandbox_pidns(&self) -> bool;
}