genpolicy: add default implementation for use_sandbox_pidns

This patch adds a default implementation for the use_sandbox_pidns
and updates the structs that implement the K8sResource trait to use
the default.

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

View File

@@ -98,8 +98,4 @@ impl yaml::K8sResource for ConfigMap {
fn get_annotations(&self) -> &Option<BTreeMap<String, String>> {
&self.metadata.annotations
}
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}
}

View File

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

View File

@@ -34,8 +34,4 @@ impl yaml::K8sResource for NoPolicyResource {
fn serialize(&mut self, _policy: &str) -> String {
self.yaml.clone()
}
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}
}

View File

@@ -83,8 +83,4 @@ impl yaml::K8sResource for Secret {
fn serialize(&mut self, _policy: &str) -> String {
serde_yaml::to_string(&self.doc_mapping).unwrap()
}
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}
}

View File

@@ -82,7 +82,9 @@ pub trait K8sResource {
panic!("Unsupported");
}
fn use_sandbox_pidns(&self) -> bool;
fn use_sandbox_pidns(&self) -> bool {
panic!("Unsupported");
}
}
/// See Reference / Kubernetes API / Common Definitions / LabelSelector.