Skip to content

Commit

Permalink
add chaosblade-io/chaosblade-operator
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Hoß <[email protected]>
  • Loading branch information
sebhoss committed Nov 12, 2023
1 parent 412847d commit 36ed0c5
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ Files: crd-catalog/change-metrics/monocle-operator/*
Copyright: The change-metrics/monocle-operator Authors
License: Apache-2.0

Files: crd-catalog/chaosblade-io/chaosblade-operator/*
Copyright: The chaosblade-io/chaosblade-operator Authors
License: Apache-2.0

Files: crd-catalog/chaos-mesh/chaos-mesh/*
Copyright: The chaos-mesh/chaos-mesh Authors
License: Apache-2.0
Expand Down
7 changes: 7 additions & 0 deletions code-generator/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,13 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[
"https://github.com/change-metrics/monocle-operator/blob/master/config/crd/bases/monocle.monocle.change-metrics.io_monocles.yaml",
],
},
UpstreamSource {
project_name: "chaosblade-io/chaosblade-operator",
license: APACHE_V2,
urls: &[
"https://github.com/chaosblade-io/chaosblade-operator/blob/master/deploy/crds/chaosblade.io_chaosblades_crd.yaml",
],
},
UpstreamSource {
project_name: "chaos-mesh/chaos-mesh",
license: APACHE_V2,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: chaosblades.chaosblade.io
spec:
group: chaosblade.io
names:
kind: ChaosBlade
listKind: ChaosBladeList
plural: chaosblades
singular: chaosblade
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ChaosBlade is the Schema for the chaosblades API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ChaosBladeSpec defines the desired state of ChaosBlade
properties:
experiments:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
items:
properties:
action:
description: Action is the experiment scenario of the target, such as delay, load
type: string
desc:
description: Desc is the experiment description
type: string
matchers:
description: Matchers is the experiment rules
items:
properties:
name:
description: Name is the name of flag
type: string
value:
description: 'TODO: Temporarily defined as an array for all flags Value is the value of flag'
items:
type: string
type: array
required:
- name
- value
type: object
type: array
scope:
description: Scope is the area of the experiments, currently support node, pod and container
type: string
target:
description: Target is the experiment target, such as cpu, network
type: string
required:
- action
- scope
- target
type: object
type: array
required:
- experiments
type: object
status:
description: ChaosBladeStatus defines the observed state of ChaosBlade
properties:
expStatuses:
description: 'Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
items:
properties:
action:
type: string
error:
type: string
resStatuses:
description: ResStatuses is the details of the experiment
items:
properties:
error:
description: experiment error
type: string
id:
description: experiment uid in chaosblade
type: string
identifier:
description: 'Resource identifier, rules as following: container: Namespace/NodeName/PodName/ContainerName pod: Namespace/NodeName/PodName'
type: string
kind:
description: Kind
type: string
state:
description: experiment state
type: string
success:
description: success
type: boolean
required:
- kind
- state
- success
type: object
type: array
scope:
description: experiment scope for cache
type: string
state:
description: State is used to describe the experiment result
type: string
success:
description: Success is used to judge the experiment result
type: boolean
target:
type: string
required:
- action
- scope
- state
- success
- target
type: object
type: array
phase:
description: Phase indicates the state of the experiment Initial -> Running -> Updating -> Destroying -> Destroyed
type: string
required:
- expStatuses
type: object
type: object
served: true
storage: true
subresources:
status: {}
1 change: 1 addition & 0 deletions kube-custom-resources-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ capsule_clastix_io_v1beta2 = []
ceph_rook_io_v1 = []
cert_manager_io_v1 = []
chaos_mesh_org_v1alpha1 = []
chaosblade_io_v1alpha1 = []
che_eclipse_org_v1alpha1 = []
cilium_io_v2 = []
cilium_io_v2alpha1 = []
Expand Down
89 changes: 89 additions & 0 deletions kube-custom-resources-rs/src/chaosblade_io_v1alpha1/chaosblades.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --filename=./crd-catalog/chaosblade-io/chaosblade-operator/chaosblade.io/v1alpha1/chaosblades.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.2

use kube::CustomResource;
use serde::{Serialize, Deserialize};

/// ChaosBladeSpec defines the desired state of ChaosBlade
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "chaosblade.io", version = "v1alpha1", kind = "ChaosBlade", plural = "chaosblades")]
#[kube(namespaced)]
#[kube(status = "ChaosBladeStatus")]
#[kube(schema = "disabled")]
pub struct ChaosBladeSpec {
/// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
pub experiments: Vec<ChaosBladeExperiments>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ChaosBladeExperiments {
/// Action is the experiment scenario of the target, such as delay, load
pub action: String,
/// Desc is the experiment description
#[serde(default, skip_serializing_if = "Option::is_none")]
pub desc: Option<String>,
/// Matchers is the experiment rules
#[serde(default, skip_serializing_if = "Option::is_none")]
pub matchers: Option<Vec<ChaosBladeExperimentsMatchers>>,
/// Scope is the area of the experiments, currently support node, pod and container
pub scope: String,
/// Target is the experiment target, such as cpu, network
pub target: String,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ChaosBladeExperimentsMatchers {
/// Name is the name of flag
pub name: String,
/// TODO: Temporarily defined as an array for all flags Value is the value of flag
pub value: Vec<String>,
}

/// ChaosBladeStatus defines the observed state of ChaosBlade
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ChaosBladeStatus {
/// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
#[serde(rename = "expStatuses")]
pub exp_statuses: Vec<ChaosBladeStatusExpStatuses>,
/// Phase indicates the state of the experiment Initial -> Running -> Updating -> Destroying -> Destroyed
#[serde(default, skip_serializing_if = "Option::is_none")]
pub phase: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ChaosBladeStatusExpStatuses {
pub action: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
/// ResStatuses is the details of the experiment
#[serde(default, skip_serializing_if = "Option::is_none", rename = "resStatuses")]
pub res_statuses: Option<Vec<ChaosBladeStatusExpStatusesResStatuses>>,
/// experiment scope for cache
pub scope: String,
/// State is used to describe the experiment result
pub state: String,
/// Success is used to judge the experiment result
pub success: bool,
pub target: String,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ChaosBladeStatusExpStatusesResStatuses {
/// experiment error
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
/// experiment uid in chaosblade
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Resource identifier, rules as following: container: Namespace/NodeName/PodName/ContainerName pod: Namespace/NodeName/PodName
#[serde(default, skip_serializing_if = "Option::is_none")]
pub identifier: Option<String>,
/// Kind
pub kind: String,
/// experiment state
pub state: String,
/// success
pub success: bool,
}

1 change: 1 addition & 0 deletions kube-custom-resources-rs/src/chaosblade_io_v1alpha1/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod chaosblades;
9 changes: 9 additions & 0 deletions kube-custom-resources-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,13 @@ kinds:
- `WorkflowNode`
- `Workflow`
## chaosblade_io_v1alpha1
apiVersion: `chaosblade.io/v1alpha1`
kinds:
- `ChaosBlade`
## che_eclipse_org_v1alpha1
apiVersion: `che.eclipse.org/v1alpha1`
Expand Down Expand Up @@ -2843,6 +2850,8 @@ pub mod ceph_rook_io_v1;
pub mod cert_manager_io_v1;
#[cfg(feature = "chaos_mesh_org_v1alpha1")]
pub mod chaos_mesh_org_v1alpha1;
#[cfg(feature = "chaosblade_io_v1alpha1")]
pub mod chaosblade_io_v1alpha1;
#[cfg(feature = "che_eclipse_org_v1alpha1")]
pub mod che_eclipse_org_v1alpha1;
#[cfg(feature = "cilium_io_v2")]
Expand Down

0 comments on commit 36ed0c5

Please sign in to comment.