Skip to content

Commit

Permalink
genpolicy: Add support for seccompProfile field
Browse files Browse the repository at this point in the history
Signed-off-by: Saul Paredes <[email protected]>
  • Loading branch information
Redent0r committed Jan 22, 2024
1 parent dae9db4 commit 177df23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/agent/samples/policy/yaml/configmap/pod-cm1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
image: "mcr.microsoft.com/aks/e2e/library-busybox:master.220314.1-linux-amd64"
securityContext:
privileged: true
seccompProfile:
type: RuntimeDefault
env:
- name: CONFIG_MAP_VALUE1
valueFrom:
Expand Down
12 changes: 12 additions & 0 deletions src/tools/genpolicy/src/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ struct SecurityContext {

#[serde(skip_serializing_if = "Option::is_none")]
runAsUser: Option<i64>,

#[serde(skip_serializing_if = "Option::is_none")]
seccompProfile: Option<SeccompProfile>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
struct SeccompProfile {
#[serde(rename = "type")]
profile_type: String,
#[serde(skip_serializing_if = "Option::is_none")]
localhostProfile: Option<String>,
}

/// See Reference / Kubernetes API / Workload Resources / Pod.
Expand Down Expand Up @@ -939,6 +950,7 @@ pub async fn add_pause_container(containers: &mut Vec<Container>, use_cache: boo
privileged: None,
capabilities: None,
runAsUser: None,
seccompProfile: None,
}),
..Default::default()
};
Expand Down

0 comments on commit 177df23

Please sign in to comment.