Skip to content

Commit

Permalink
Add docstring generation, schemars derive and ObjectReference inherit…
Browse files Browse the repository at this point in the history
…ance (#56)

Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
  • Loading branch information
Danil-Grigorev authored Jun 6, 2024
1 parent bf38c37 commit 2f85f9e
Show file tree
Hide file tree
Showing 9 changed files with 2,020 additions and 205 deletions.
29 changes: 15 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rand = { version = "0.8", features = ["small_rng"] }
actix-web = "4.4.0"
futures = "0.3.28"
tokio = { version = "1.32.0", features = ["macros", "rt-multi-thread"] }
k8s-openapi = { version = "0.22", features = ["latest"] }
k8s-openapi = { version = "0.22", features = ["latest", "schemars"] }
kube = { version = "0.91", features = ["runtime", "client", "derive"]}
schemars = { version = "0.8.12", features = ["chrono"] }
serde = { version = "1.0.202", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ generate-crds: _create-out-dir _install-kopium _download-yq

[private]
_generate-kopium-url kpath="" source="" dest="" yqexp="." condition="":
curl -sSL {{source}} | yq '{{yqexp}}' | {{kpath}} -D Default {{condition}} -f - > {{dest}}
curl -sSL {{source}} | yq '{{yqexp}}' | {{kpath}} -D Default {{condition}} -A -d -f - > {{dest}}

generate-addon-crds features="":
cargo run --features={{features}} --bin crdgen > config/crds/fleet-addon-config.yaml
Expand Down Expand Up @@ -190,7 +190,7 @@ _install-kopium:
#!/usr/bin/env bash
set -euxo pipefail
[ -z `which kopium` ] || [ {{REFRESH_BIN}} != "0" ] || exit 0
cargo install --git https://github.com/kube-rs/kopium.git --tag 0.19.0 --root {{OUT_DIR}}
cargo install --git https://github.com/kube-rs/kopium.git --root {{OUT_DIR}}
download-kustomize: _download-kustomize

Expand Down
533 changes: 492 additions & 41 deletions src/api/capi_cluster.rs

Large diffs are not rendered by default.

891 changes: 824 additions & 67 deletions src/api/capi_clusterclass.rs

Large diffs are not rendered by default.

629 changes: 571 additions & 58 deletions src/api/fleet_cluster.rs

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/api/fleet_cluster_registration_token.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -D Default -f -
// kopium version: 0.19.0
// kopium command: kopium -D Default -A -d -f -
// kopium version: 0.20.1

#[allow(unused_imports)]
mod prelude {
pub use kube::CustomResource;
pub use schemars::JsonSchema;
pub use serde::{Serialize, Deserialize};
}
use self::prelude::*;

#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default)]
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, JsonSchema)]
#[kube(group = "fleet.cattle.io", version = "v1alpha1", kind = "ClusterRegistrationToken", plural = "clusterregistrationtokens")]
#[kube(namespaced)]
#[kube(status = "ClusterRegistrationTokenStatus")]
#[kube(schema = "disabled")]
#[kube(derive="Default")]
pub struct ClusterRegistrationTokenSpec {
/// TTL is the time to live for the token. It is used to calculate the
/// expiration time. If the token expires, it will be deleted.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ttl: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default)]
#[derive(Serialize, Deserialize, Clone, Debug, Default, JsonSchema)]
pub struct ClusterRegistrationTokenStatus {
/// Expires is the time when the token expires.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub expires: Option<String>,
/// SecretName is the name of the secret containing the token.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "secretName")]
pub secret_name: Option<String>,
}
Expand Down
Loading

0 comments on commit 2f85f9e

Please sign in to comment.