moomman commented on code in PR #286:
URL: 
https://github.com/apache/shardingsphere-on-cloud/pull/286#discussion_r1156676921


##########
shardingsphere-operator/api/v1alpha1/shardingsphere_chaos_types.go:
##########
@@ -36,12 +38,202 @@ type ShardingSphereChaos struct {
        metav1.ObjectMeta `json:"metadata,omitempty"`
 
        Spec ShardingSphereChaosSpec `json:"spec,omitempty"`
-       // +optional
+
        Status ShardingSphereChaosStatus `json:"status,omitempty"`
 }
 
 // ShardingSphereChaosSpec defines the desired state of ShardingSphereChaos
-type ShardingSphereChaosSpec struct{}
+type ShardingSphereChaosSpec struct {
+       //InjectJob batchV1Beta1.JobTemplateSpec `json:"InjectJob,omitempty"`
+
+       ChaosKind ChaosKind `json:"chaosKind,omitempty"`
+
+       EmbedChaos `json:",inline"`
+
+       //Verify batchV1Beta1.JobTemplateSpec `json:"Verify,omitempty"`
+}
+
+type ChaosKind string
+
+const (
+       NetworkChaosKind ChaosKind = "networkChaos"
+
+       PodChaosKind ChaosKind = "podChaos"
+)
+
+type EmbedChaos struct {
+       // +optional
+       NetworkChaos *NetworkChaosSpec `json:"networkChaos,omitempty"`
+       // +optional
+       PodChaos *PodChaosSpec `json:"podChaos,omitempty"`
+}
+
+type DeploymentCondition string
+
+const (
+       Creating     DeploymentCondition = "Creating"
+       AllRecovered DeploymentCondition = "AllRecovered"
+       Paused       DeploymentCondition = "Paused"
+       AllInjected  DeploymentCondition = "AllInjected"
+)
+
+type Jobschedule string
+
+const (
+       JobCreating Jobschedule = "JobCreating"
+       JobFailed   Jobschedule = "JobFailed"
+       JobFinish   Jobschedule = "JobFinish"
+)
 
 // ShardingSphereChaosStatus defines the actual state of ShardingSphereChaos
-type ShardingSphereChaosStatus struct{}
+type ShardingSphereChaosStatus struct {
+       ChaosCondition DeploymentCondition `json:"deploymentCondition"`
+       InjectStatus   Jobschedule         `json:"InjectStatus"`
+       VerifyStatus   Jobschedule         `json:"VerifyStatus"`
+}
+
+// pod chaos
+
+type PodChaosAction string
+
+var (
+       PodFailureAction    PodChaosAction = "podFailure"
+       ContainerKillAction PodChaosAction = "ContainerKill"
+)
+
+type PodChaosSpec struct {
+       PodSelector `json:",inline"`
+       Action      PodChaosAction `json:"action"`
+       // +optional
+       PodActionParam *PodActionParam `json:",inline"`
+}
+
+type PodActionParam struct {
+       //+optional
+       PodFailure *PodFailureActionParams `json:"podFailure,omitempty"`
+       //+optional
+       ContainerKill *ContainerKillActionParams 
`json:"containerKill,omitempty"`
+}
+
+type PodFailureActionParams struct {
+       // +optional
+       Duration string `json:"duration,omitempty"`
+}
+
+type ContainerKillActionParams struct {
+       // +optional
+       ContainerNames []string `json:"containerNames,omitempty"`
+}
+
+//network chaos
+
+type NetworkChaosSpec struct {
+       Source PodSelector `json:",inline"`
+
+       // +optional
+       Duration *string `json:"duration,omitempty"`
+
+       //+optional
+       Direction Direction `json:"direction,omitempty"`
+
+       // +optional
+       Target *PodSelector `json:"target,omitempty"`
+
+       Action NetworkChaosAction `json:"action"`
+
+       // +optional
+       NetWorkParams *NetWorkParams `json:",inline"`

Review Comment:
   Appiled



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to