-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add chaosblade-io/chaosblade-operator
Signed-off-by: Sebastian Hoß <[email protected]>
- Loading branch information
Showing
7 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
crd-catalog/chaosblade-io/chaosblade-operator/chaosblade.io/v1alpha1/chaosblades.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
kube-custom-resources-rs/src/chaosblade_io_v1alpha1/chaosblades.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod chaosblades; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters