From 2af96b0876b5230b4a40163c4a09f23dbcfbc1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Ho=C3=9F?= Date: Sat, 4 Nov 2023 13:50:27 +0100 Subject: [PATCH] add b3scale-operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sebastian Hoß --- .reuse/dep5 | 4 + code-generator/src/catalog.rs | 7 ++ .../b3scale.infra.run/v1/bbbfrontends.yaml | 116 ++++++++++++++++++ kube-custom-resources-rs/Cargo.toml | 1 + .../src/b3scale_infra_run_v1/bbbfrontends.rs | 107 ++++++++++++++++ .../src/b3scale_infra_run_v1/mod.rs | 1 + kube-custom-resources-rs/src/lib.rs | 2 + 7 files changed, 238 insertions(+) create mode 100644 crd-catalog/b3scale/b3scale-operator/b3scale.infra.run/v1/bbbfrontends.yaml create mode 100644 kube-custom-resources-rs/src/b3scale_infra_run_v1/bbbfrontends.rs create mode 100644 kube-custom-resources-rs/src/b3scale_infra_run_v1/mod.rs diff --git a/.reuse/dep5 b/.reuse/dep5 index 32d852e90..185f45dbb 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -119,6 +119,10 @@ Files: crd-catalog/aws-controllers-k8s/sfn-controller/* Copyright: The aws-controllers-k8s/sfn-controller Authors License: Apache-2.0 +Files: crd-catalog/b3scale/b3scale-operator/* +Copyright: The b3scale/b3scale-operator Authors +License: Apache-2.0 + Files: crd-catalog/bitnami-labs/sealed-secrets/* Copyright: The bitnami-labs/sealed-secrets Authors License: Apache-2.0 diff --git a/code-generator/src/catalog.rs b/code-generator/src/catalog.rs index 75b4ca5fc..7df17dbf6 100644 --- a/code-generator/src/catalog.rs +++ b/code-generator/src/catalog.rs @@ -294,6 +294,13 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[ "https://github.com/aws-controllers-k8s/sfn-controller/blob/main/config/crd/bases/sfn.services.k8s.aws_statemachines.yaml", ], }, + UpstreamSource { + project_name: "b3scale/b3scale-operator", + license: APACHE_V2, + urls: &[ + "https://github.com/b3scale/b3scale-operator/blob/main/kubernetes/crd.yaml", + ], + }, UpstreamSource { project_name: "bitnami-labs/sealed-secrets", license: APACHE_V2, diff --git a/crd-catalog/b3scale/b3scale-operator/b3scale.infra.run/v1/bbbfrontends.yaml b/crd-catalog/b3scale/b3scale-operator/b3scale.infra.run/v1/bbbfrontends.yaml new file mode 100644 index 000000000..78c703abb --- /dev/null +++ b/crd-catalog/b3scale/b3scale-operator/b3scale.infra.run/v1/bbbfrontends.yaml @@ -0,0 +1,116 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: bbbfrontends.b3scale.infra.run +spec: + group: b3scale.infra.run + names: + kind: BBBFrontend + listKind: BBBFrontendList + plural: bbbfrontends + singular: bbbfrontend + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + properties: + spec: + description: Desired state of the BBBFrontend resource. + properties: + credentials: + description: Predefined credentials for the B3scale instance + nullable: true + properties: + key: + description: Predefined key for B3scale instance, will be defined if not set + type: string + secretRef: + description: SecretRef is a reference to a key in a Secret resource containing the key to connect to the BBB instance. + properties: + key: + description: The key of the entry in the Secret resource's `data` field to be used. + type: string + name: + description: 'Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + required: + - name + - key + type: object + type: object + settings: + description: Settings defines the B3Scale instance settings + properties: + create_default_params: + additionalProperties: + type: string + description: See https://github.com/b3scale/b3scale#configure-create-parameter-defaults-and-overrides + nullable: true + type: object + create_override_params: + additionalProperties: + type: string + description: See https://github.com/b3scale/b3scale#configure-create-parameter-defaults-and-overrides + nullable: true + type: object + default_presentation: + description: See https://github.com/b3scale/b3scale#middleware-configuration + nullable: true + properties: + force: + type: boolean + url: + type: string + type: object + required_tags: + description: See https://github.com/b3scale/b3scale#middleware-configuration + items: + type: string + nullable: true + type: array + type: object + type: object + status: + description: Status of the BBBFrontend. This is set and managed automatically. + properties: + conditions: + description: List of status conditions to indicate the status of the BBB frontend. Known condition types are `Ready`. + items: + description: BBBFrontendCondition contains condition information for an BBBFrontend. + properties: + lastTransitionTime: + description: LastTransitionTime is the timestamp corresponding to the last status change of this condition. + format: date-time + type: string + message: + description: Message is a human readable description of the details of the last transition, complementing reason. + type: string + observedGeneration: + description: If set, this represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date with respect to the current state of the BBBFrontend. + format: int64 + type: integer + reason: + description: Reason is a brief machine readable explanation for the condition's last transition. + type: string + status: + description: Status of the condition, one of (`True`, `False`, `Unknown`). + enum: + - 'True' + - 'False' + - Unknown + type: string + type: + description: Type of the condition, known values are (`Ready`). + type: string + required: + - status + - type + type: object + type: array + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/kube-custom-resources-rs/Cargo.toml b/kube-custom-resources-rs/Cargo.toml index 285de6c88..18bf694fa 100644 --- a/kube-custom-resources-rs/Cargo.toml +++ b/kube-custom-resources-rs/Cargo.toml @@ -57,6 +57,7 @@ asdb_aerospike_com_v1beta1 = [] autoscaling_k8s_io_v1 = [] autoscaling_k8s_io_v1beta2 = [] autoscaling_karmada_io_v1alpha1 = [] +b3scale_infra_run_v1 = [] batch_volcano_sh_v1alpha1 = [] beat_k8s_elastic_co_v1beta1 = [] binding_operators_coreos_com_v1alpha1 = [] diff --git a/kube-custom-resources-rs/src/b3scale_infra_run_v1/bbbfrontends.rs b/kube-custom-resources-rs/src/b3scale_infra_run_v1/bbbfrontends.rs new file mode 100644 index 000000000..78f8a2435 --- /dev/null +++ b/kube-custom-resources-rs/src/b3scale_infra_run_v1/bbbfrontends.rs @@ -0,0 +1,107 @@ +// WARNING: generated by kopium - manual changes will be overwritten +// kopium command: kopium --docs --filename ./crd-catalog/b3scale/b3scale-operator/b3scale.infra.run/v1/bbbfrontends.yaml +// kopium version: 0.16.1 + +use kube::CustomResource; +use serde::{Serialize, Deserialize}; +use std::collections::BTreeMap; + +/// Desired state of the BBBFrontend resource. +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug)] +#[kube(group = "b3scale.infra.run", version = "v1", kind = "BBBFrontend", plural = "bbbfrontends")] +#[kube(namespaced)] +#[kube(status = "BBBFrontendStatus")] +#[kube(schema = "disabled")] +pub struct BBBFrontendSpec { + /// Predefined credentials for the B3scale instance + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + /// Settings defines the B3Scale instance settings + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, +} + +/// Predefined credentials for the B3scale instance +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct BBBFrontendCredentials { + /// Predefined key for B3scale instance, will be defined if not set + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, + /// SecretRef is a reference to a key in a Secret resource containing the key to connect to the BBB instance. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "secretRef")] + pub secret_ref: Option, +} + +/// SecretRef is a reference to a key in a Secret resource containing the key to connect to the BBB instance. +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct BBBFrontendCredentialsSecretRef { + /// The key of the entry in the Secret resource's `data` field to be used. + pub key: String, + /// Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: String, +} + +/// Settings defines the B3Scale instance settings +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct BBBFrontendSettings { + /// See https://github.com/b3scale/b3scale#configure-create-parameter-defaults-and-overrides + #[serde(default, skip_serializing_if = "Option::is_none")] + pub create_default_params: Option>, + /// See https://github.com/b3scale/b3scale#configure-create-parameter-defaults-and-overrides + #[serde(default, skip_serializing_if = "Option::is_none")] + pub create_override_params: Option>, + /// See https://github.com/b3scale/b3scale#middleware-configuration + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default_presentation: Option, + /// See https://github.com/b3scale/b3scale#middleware-configuration + #[serde(default, skip_serializing_if = "Option::is_none")] + pub required_tags: Option>, +} + +/// See https://github.com/b3scale/b3scale#middleware-configuration +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct BBBFrontendSettingsDefaultPresentation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub force: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, +} + +/// Status of the BBBFrontend. This is set and managed automatically. +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct BBBFrontendStatus { + /// List of status conditions to indicate the status of the BBB frontend. Known condition types are `Ready`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conditions: Option>, +} + +/// BBBFrontendCondition contains condition information for an BBBFrontend. +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct BBBFrontendStatusConditions { + /// LastTransitionTime is the timestamp corresponding to the last status change of this condition. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastTransitionTime")] + pub last_transition_time: Option, + /// Message is a human readable description of the details of the last transition, complementing reason. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + /// If set, this represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date with respect to the current state of the BBBFrontend. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "observedGeneration")] + pub observed_generation: Option, + /// Reason is a brief machine readable explanation for the condition's last transition. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Status of the condition, one of (`True`, `False`, `Unknown`). + pub status: BBBFrontendStatusConditionsStatus, + /// Type of the condition, known values are (`Ready`). + #[serde(rename = "type")] + pub r#type: String, +} + +/// BBBFrontendCondition contains condition information for an BBBFrontend. +#[derive(Serialize, Deserialize, Clone, Debug)] +pub enum BBBFrontendStatusConditionsStatus { + True, + False, + Unknown, +} + diff --git a/kube-custom-resources-rs/src/b3scale_infra_run_v1/mod.rs b/kube-custom-resources-rs/src/b3scale_infra_run_v1/mod.rs new file mode 100644 index 000000000..54091104f --- /dev/null +++ b/kube-custom-resources-rs/src/b3scale_infra_run_v1/mod.rs @@ -0,0 +1 @@ +pub mod bbbfrontends; diff --git a/kube-custom-resources-rs/src/lib.rs b/kube-custom-resources-rs/src/lib.rs index a700922a2..93c5bf214 100644 --- a/kube-custom-resources-rs/src/lib.rs +++ b/kube-custom-resources-rs/src/lib.rs @@ -60,6 +60,8 @@ pub mod autoscaling_k8s_io_v1; pub mod autoscaling_k8s_io_v1beta2; #[cfg(feature = "autoscaling_karmada_io_v1alpha1")] pub mod autoscaling_karmada_io_v1alpha1; +#[cfg(feature = "b3scale_infra_run_v1")] +pub mod b3scale_infra_run_v1; #[cfg(feature = "batch_volcano_sh_v1alpha1")] pub mod batch_volcano_sh_v1alpha1; #[cfg(feature = "beat_k8s_elastic_co_v1beta1")]