diff --git a/justfile b/justfile index ac80faa..182afab 100644 --- a/justfile +++ b/justfile @@ -5,6 +5,8 @@ TAG := "dev" HOME_DIR := env_var('HOME') YQ_VERSION := "v4.43.1" YQ_BIN := "_out/yq" +OUT_DIR := "_out" +KOPIUM_BIN := "_out/bin/kopium" KUSTOMIZE_VERSION := "v5.4.1" KUSTOMIZE_BIN := "_out/kustomize" ARCH := if arch() == "aarch64" { "arm64"} else { "amd64" } @@ -21,10 +23,10 @@ generate: # generates files for CRDS generate-crds: _create-out-dir _install-kopium _download-yq - just _generate-kopium-url {{home_directory()}}/.cargo/bin/kopium "https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/config/crd/bases/cluster.x-k8s.io_clusters.yaml" "src/api/capi_cluster.rs" "" - just _generate-kopium-url {{home_directory()}}/.cargo/bin/kopium "https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml" "src/api/capi_clusterclass.rs" "" - just _generate-kopium-url {{home_directory()}}/.cargo/bin/kopium "https://raw.githubusercontent.com/rancher/fleet/main/charts/fleet-crd/templates/crds.yaml" "src/api/fleet_cluster.rs" "select(.spec.names.singular==\"cluster\")" "--no-condition" - just _generate-kopium-url {{home_directory()}}/.cargo/bin/kopium "https://raw.githubusercontent.com/rancher/fleet/main/charts/fleet-crd/templates/crds.yaml" "src/api/fleet_clustergroup.rs" "select(.spec.names.singular==\"clustergroup\")" "--no-condition" + just _generate-kopium-url {{KOPIUM_BIN}} "https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/config/crd/bases/cluster.x-k8s.io_clusters.yaml" "src/api/capi_cluster.rs" "" + just _generate-kopium-url {{KOPIUM_BIN}} "https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/main/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml" "src/api/capi_clusterclass.rs" "" + just _generate-kopium-url {{KOPIUM_BIN}} "https://raw.githubusercontent.com/rancher/fleet/main/charts/fleet-crd/templates/crds.yaml" "src/api/fleet_cluster.rs" "select(.spec.names.singular==\"cluster\")" "--no-condition" + just _generate-kopium-url {{KOPIUM_BIN}} "https://raw.githubusercontent.com/rancher/fleet/main/charts/fleet-crd/templates/crds.yaml" "src/api/fleet_clustergroup.rs" "select(.spec.names.singular==\"clustergroup\")" "--no-condition" [private] _generate-kopium-url kpath="" source="" dest="" yqexp="." condition="": @@ -139,7 +141,7 @@ test-import: start-dev deploy deploy-child-cluster deploy-crs # Install kopium [private] _install-kopium: - cargo install kopium + cargo install --git https://github.com/kube-rs/kopium.git --branch main --root {{OUT_DIR}} # Download kustomize [private] diff --git a/src/api/capi_cluster.rs b/src/api/capi_cluster.rs index ef7de7c..f745c9b 100644 --- a/src/api/capi_cluster.rs +++ b/src/api/capi_cluster.rs @@ -2,11 +2,15 @@ // kopium command: kopium -D Default -f - // kopium version: 0.18.0 -use kube::CustomResource; -use serde::{Serialize, Deserialize}; -use std::collections::BTreeMap; -use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString; -use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition; +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; + pub use std::collections::BTreeMap; + pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString; + pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition; +} +use self::prelude::*; #[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default)] #[kube(group = "cluster.x-k8s.io", version = "v1beta1", kind = "Cluster", plural = "clusters")] @@ -179,7 +183,7 @@ pub struct ClusterTopologyVariables { #[serde(default, skip_serializing_if = "Option::is_none", rename = "definitionFrom")] pub definition_from: Option, pub name: String, - pub value: BTreeMap, + pub value: serde_json::Value, } #[derive(Serialize, Deserialize, Clone, Debug, Default)] @@ -308,7 +312,7 @@ pub struct ClusterTopologyWorkersMachineDeploymentsVariablesOverrides { #[serde(default, skip_serializing_if = "Option::is_none", rename = "definitionFrom")] pub definition_from: Option, pub name: String, - pub value: BTreeMap, + pub value: serde_json::Value, } #[derive(Serialize, Deserialize, Clone, Debug, Default)] @@ -352,7 +356,7 @@ pub struct ClusterTopologyWorkersMachinePoolsVariablesOverrides { #[serde(default, skip_serializing_if = "Option::is_none", rename = "definitionFrom")] pub definition_from: Option, pub name: String, - pub value: BTreeMap, + pub value: serde_json::Value, } #[derive(Serialize, Deserialize, Clone, Debug, Default)] diff --git a/src/api/capi_clusterclass.rs b/src/api/capi_clusterclass.rs index 15005d3..2ed2cef 100644 --- a/src/api/capi_clusterclass.rs +++ b/src/api/capi_clusterclass.rs @@ -2,11 +2,15 @@ // kopium command: kopium -D Default -f - // kopium version: 0.18.0 -use kube::CustomResource; -use serde::{Serialize, Deserialize}; -use std::collections::BTreeMap; -use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString; -use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition; +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; + pub use std::collections::BTreeMap; + pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString; + pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition; +} +use self::prelude::*; #[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default)] #[kube(group = "cluster.x-k8s.io", version = "v1beta1", kind = "ClusterClass", plural = "clusterclasses")] @@ -191,7 +195,7 @@ pub struct ClusterClassPatchesDefinitionsJsonPatches { pub op: String, pub path: String, #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option>, + pub value: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "valueFrom")] pub value_from: Option, } @@ -275,15 +279,15 @@ pub struct ClusterClassVariablesSchema { #[derive(Serialize, Deserialize, Clone, Debug, Default)] pub struct ClusterClassVariablesSchemaOpenApiv3Schema { #[serde(default, skip_serializing_if = "Option::is_none", rename = "additionalProperties")] - pub additional_properties: Option>, + pub additional_properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub default: Option>, + pub default: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "enum")] pub r#enum: Option>>, #[serde(default, skip_serializing_if = "Option::is_none")] - pub example: Option>, + pub example: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "exclusiveMaximum")] pub exclusive_maximum: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "exclusiveMinimum")] @@ -291,7 +295,7 @@ pub struct ClusterClassVariablesSchemaOpenApiv3Schema { #[serde(default, skip_serializing_if = "Option::is_none")] pub format: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub items: Option>, + pub items: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxItems")] pub max_items: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxLength")] @@ -307,7 +311,7 @@ pub struct ClusterClassVariablesSchemaOpenApiv3Schema { #[serde(default, skip_serializing_if = "Option::is_none")] pub pattern: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option>, + pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub required: Option>, #[serde(rename = "type")] @@ -621,15 +625,15 @@ pub struct ClusterClassStatusVariablesDefinitionsSchema { #[derive(Serialize, Deserialize, Clone, Debug, Default)] pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3Schema { #[serde(default, skip_serializing_if = "Option::is_none", rename = "additionalProperties")] - pub additional_properties: Option>, + pub additional_properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub default: Option>, + pub default: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "enum")] pub r#enum: Option>>, #[serde(default, skip_serializing_if = "Option::is_none")] - pub example: Option>, + pub example: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "exclusiveMaximum")] pub exclusive_maximum: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "exclusiveMinimum")] @@ -637,7 +641,7 @@ pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3Schema { #[serde(default, skip_serializing_if = "Option::is_none")] pub format: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub items: Option>, + pub items: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxItems")] pub max_items: Option, #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxLength")] @@ -653,7 +657,7 @@ pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3Schema { #[serde(default, skip_serializing_if = "Option::is_none")] pub pattern: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option>, + pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub required: Option>, #[serde(rename = "type")] diff --git a/src/api/fleet_cluster.rs b/src/api/fleet_cluster.rs index e71f88b..8b45c27 100644 --- a/src/api/fleet_cluster.rs +++ b/src/api/fleet_cluster.rs @@ -2,10 +2,14 @@ // kopium command: kopium -D Default --no-condition -f - // kopium version: 0.18.0 -use kube::CustomResource; -use serde::{Serialize, Deserialize}; -use std::collections::BTreeMap; -use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString; +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; + pub use std::collections::BTreeMap; + pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString; +} +use self::prelude::*; #[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default)] #[kube(group = "fleet.cattle.io", version = "v1alpha1", kind = "Cluster", plural = "clusters")] diff --git a/src/api/fleet_clustergroup.rs b/src/api/fleet_clustergroup.rs index 3c35840..9bcc5e4 100644 --- a/src/api/fleet_clustergroup.rs +++ b/src/api/fleet_clustergroup.rs @@ -2,9 +2,13 @@ // kopium command: kopium -D Default --no-condition -f - // kopium version: 0.18.0 -use kube::CustomResource; -use serde::{Serialize, Deserialize}; -use std::collections::BTreeMap; +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; + pub use std::collections::BTreeMap; +} +use self::prelude::*; #[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default)] #[kube(group = "fleet.cattle.io", version = "v1alpha1", kind = "ClusterGroup", plural = "clustergroups")]