Implement base operator #1
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
.idea
|
1842
Cargo.lock
generated
Normal file
1842
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
Cargo.toml
Normal file
17
Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
||||
[package]
|
||||
name = "minio-operator"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
log = "0.4.17"
|
||||
env_logger = "0.10.0"
|
||||
anyhow = "1.0.71"
|
||||
serde = { version = "1.0.162", features = ["derive"] }
|
||||
serde_json = "1.0.96"
|
||||
schemars = "0.8.12"
|
||||
tokio = { version = "1.28.0", features = ["full"] }
|
||||
kube = { version = "0.82.2", features = ["runtime", "derive"] }
|
||||
k8s-openapi = { version = "0.18.0", features = ["v1_26"] } # TODO : switch to v1_27
|
49
src/crd.rs
Normal file
49
src/crd.rs
Normal file
@ -0,0 +1,49 @@
|
||||
use kube::CustomResource;
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(CustomResource, Debug, Serialize, Deserialize, Default, Clone, JsonSchema)]
|
||||
#[kube(
|
||||
group = "communiquons.org",
|
||||
version = "v1",
|
||||
kind = "MinioInstance",
|
||||
namespaced
|
||||
)]
|
||||
pub struct MinioInstanceSpec {
|
||||
pub endpoint: String,
|
||||
pub credentials: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, JsonSchema)]
|
||||
pub enum RetentionType {
|
||||
#[default]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
Compliance,
|
||||
#[serde(rename_all = "lowercase")]
|
||||
Governance,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, JsonSchema)]
|
||||
pub struct BucketRetention {
|
||||
pub validity: usize,
|
||||
pub r#type: RetentionType,
|
||||
}
|
||||
|
||||
#[derive(CustomResource, Debug, Serialize, Deserialize, Default, Clone, JsonSchema)]
|
||||
#[kube(
|
||||
group = "communiquons.org",
|
||||
version = "v1",
|
||||
kind = "MinioBucket",
|
||||
namespaced
|
||||
)]
|
||||
pub struct MinioBucketSpec {
|
||||
pub instance: String,
|
||||
pub name: String,
|
||||
pub secret: String,
|
||||
#[serde(default)]
|
||||
pub anonymous_read_access: bool,
|
||||
#[serde(default)]
|
||||
versioning: bool,
|
||||
quota: Option<usize>,
|
||||
retention: Option<BucketRetention>,
|
||||
}
|
1
src/lib.rs
Normal file
1
src/lib.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod crd;
|
10
src/main.rs
Normal file
10
src/main.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use kube::Client;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
let client = Client::try_default().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
@ -60,7 +60,7 @@ spec:
|
||||
type: integer
|
||||
description: The number of days the data shall be kept
|
||||
example: 180
|
||||
mode:
|
||||
type:
|
||||
type: string
|
||||
description: Retention type. In governance mode, some privileged user can bypass retention policy, while in governance policy, no one, including root user, can delete the data
|
||||
enum:
|
||||
|
Loading…
Reference in New Issue
Block a user