mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-16 07:05:14 +00:00
genpolicy: detect empty string in ns as default
In Kubernetes, the following values for namespace are equivalent and all refer to the default namespace: - ` ` (namespace field missing) - `namespace: ""` (namespace field is the empty string) - `namespace: "default"`(namespace field has the explicit value `default`) Genpolicy currently does not handle the empty string case correctly. Signed-Off-By: Malte Poll <1780588+malt3@users.noreply.github.com>
This commit is contained in:
parent
9a6d8d8330
commit
babdab9078
@ -481,14 +481,14 @@ impl AgentPolicy {
|
|||||||
let mut root = c_settings.Root.clone();
|
let mut root = c_settings.Root.clone();
|
||||||
root.Readonly = yaml_container.read_only_root_filesystem();
|
root.Readonly = yaml_container.read_only_root_filesystem();
|
||||||
|
|
||||||
let namespace = if let Some(ns) = resource.get_namespace() {
|
let namespace = match resource.get_namespace() {
|
||||||
ns
|
Some(ns) if !ns.is_empty() => ns,
|
||||||
} else {
|
_ => self
|
||||||
self.config
|
.config
|
||||||
.settings
|
.settings
|
||||||
.cluster_config
|
.cluster_config
|
||||||
.default_namespace
|
.default_namespace
|
||||||
.clone()
|
.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let use_host_network = resource.use_host_network();
|
let use_host_network = resource.use_host_network();
|
||||||
|
Loading…
Reference in New Issue
Block a user