From e1afd904534148fb321cb170d650af8f0d9b7534 Mon Sep 17 00:00:00 2001 From: Eguo Wang Date: Sun, 25 Feb 2024 03:17:10 +0800 Subject: [PATCH] chore: renmae pvc env name --- .env.sample | 7 +++++-- Cargo.lock | 16 ++++++++-------- Cargo.toml | 2 +- controllers/src/config.rs | 10 +++++++--- resources/src/containers/syncer.rs | 1 - resources/src/volume.rs | 5 +++-- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.env.sample b/.env.sample index 22380e7..281cc48 100644 --- a/.env.sample +++ b/.env.sample @@ -15,5 +15,8 @@ AMP_NATS_URL=nats://amp-nats.amp-system.svc:4222 # The workspace path. AMP_WORKSPACE=/workspace -# The storage class name. The default is `standard`. -AMP_STORAGE_CLASS_NAME=standard +# Persistent Volume storage class name, the default is `standard`. +AMP_PV_STORAGE_CLASS_NAME=standard + +# Persistent Volume access mode, the default is `ReadWriteOnce`. +AMP_PV_ACCESS_MODE=ReadWriteOnce diff --git a/Cargo.lock b/Cargo.lock index 7f3bf7e..aed44f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,7 +62,7 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "amp-apiserver" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-common", "amp-resources", @@ -89,7 +89,7 @@ dependencies = [ [[package]] name = "amp-builder" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-common", "amp-resources", @@ -131,7 +131,7 @@ dependencies = [ [[package]] name = "amp-controllers" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-common", "amp-resources", @@ -152,7 +152,7 @@ dependencies = [ [[package]] name = "amp-crdgen" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-common", "clap", @@ -164,7 +164,7 @@ dependencies = [ [[package]] name = "amp-resolver" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-common", "amp-resources", @@ -177,7 +177,7 @@ dependencies = [ [[package]] name = "amp-resources" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-common", "anyhow", @@ -197,7 +197,7 @@ dependencies = [ [[package]] name = "amp-syncer" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-common", "async-nats", @@ -213,7 +213,7 @@ dependencies = [ [[package]] name = "amp-workflow" -version = "0.8.22" +version = "0.8.23" dependencies = [ "amp-builder", "amp-common", diff --git a/Cargo.toml b/Cargo.toml index 0eb15eb..17b44fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.8.22" +version = "0.8.23" edition = "2021" license = "Apache-2.0" repository = "https://github.com/amphitheatre-app/amphitheatre" diff --git a/controllers/src/config.rs b/controllers/src/config.rs index 07c39c5..e26038f 100644 --- a/controllers/src/config.rs +++ b/controllers/src/config.rs @@ -42,7 +42,11 @@ pub struct Config { #[clap(long, env = "AMP_NATS_URL")] pub nats_url: String, - /// The storage class name. - #[clap(long, env = "AMP_STORAGE_CLASS_NAME", default_value = "standard")] - pub storage_class_name: String, + /// Persistent Volume storage class name, the default is `standard`. + #[clap(long, env = "AMP_PV_STORAGE_CLASS_NAME", default_value = "standard")] + pub pv_storage_class_name: String, + + /// Persistent Volume access mode, the default is `ReadWriteOnce`. + #[clap(long, env = "AMP_PV_ACCESS_MODE", default_value = "ReadWriteOnce")] + pub pv_access_mode: String, } diff --git a/resources/src/containers/syncer.rs b/resources/src/containers/syncer.rs index 3618128..f4b4a55 100644 --- a/resources/src/containers/syncer.rs +++ b/resources/src/containers/syncer.rs @@ -52,7 +52,6 @@ pub fn container(actor: &Actor, security_context: &Option) -> R ("once", once.as_str()), ]; - // FIXME: get the syncer image from the config of context. Ok(Container { name: "syncer".to_string(), image: Some(DEFAULT_SYNCER_IMAGE.to_string()), diff --git a/resources/src/volume.rs b/resources/src/volume.rs index 8269ce2..6cc5666 100644 --- a/resources/src/volume.rs +++ b/resources/src/volume.rs @@ -63,13 +63,14 @@ fn new(actor: &Actor) -> Result { ..Default::default() }, spec: Some(PersistentVolumeClaimSpec { - access_modes: Some(vec!["ReadWriteMany".into()]), + // @TODO: Make access modes configurable + access_modes: Some(vec![env::var("AMP_PV_ACCESS_MODE").unwrap_or("ReadWriteOnce".into())]), resources: Some(ResourceRequirements { requests: Some(BTreeMap::from([("storage".into(), Quantity("1Gi".into()))])), ..Default::default() }), // @TODO: Make storage class name configurable - storage_class_name: env::var("AMP_STORAGE_CLASS_NAME").ok(), + storage_class_name: env::var("AMP_PV_STORAGE_CLASS_NAME").ok(), volume_mode: Some("Filesystem".into()), ..Default::default() }),