Skip to content

Commit

Permalink
Add policy for file ops.
Browse files Browse the repository at this point in the history
  • Loading branch information
meowjesty committed Dec 31, 2024
1 parent 9917374 commit a679987
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mirrord/operator/src/crd/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ pub struct MirrordPolicySpec {
/// target.
#[serde(default)]
pub env: EnvPolicy,

#[serde(default)]
pub fs: FsPolicy,
}

/// Custom cluster-wide resource for policies that limit what mirrord features users can use.
Expand Down Expand Up @@ -90,6 +93,9 @@ pub struct MirrordClusterPolicySpec {
/// target.
#[serde(default)]
pub env: EnvPolicy,

#[serde(default)]
pub fs: FsPolicy,
}

/// Policy for controlling environment variables access from mirrord instances.
Expand All @@ -104,9 +110,26 @@ pub struct EnvPolicy {
/// Variable names can be matched using `*` and `?` where `?` matches exactly one occurrence of
/// any character and `*` matches arbitrary many (including zero) occurrences of any character,
/// e.g. `DATABASE_*` will match `DATABASE_URL` and `DATABASE_PORT`.
#[serde(default)]
pub exclude: HashSet<String>,
}

#[derive(Clone, Default, Debug, Deserialize, Eq, PartialEq, Serialize, JsonSchema)]
#[serde(rename_all = "kebab-case")]
pub struct FsPolicy {
#[serde(default)]
pub read_only: HashSet<String>,

#[serde(default)]
pub read_write: HashSet<String>,

#[serde(default)]
pub local: HashSet<String>,

#[serde(default)]
pub not_found: HashSet<String>,
}

#[test]
fn check_one_api_group() {
use kube::Resource;
Expand Down

0 comments on commit a679987

Please sign in to comment.