Skip to content

Commit

Permalink
Easier twophase controller (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKeao committed Dec 15, 2020
1 parent 79d05c6 commit b0e257c
Show file tree
Hide file tree
Showing 19 changed files with 707 additions and 336 deletions.
16 changes: 7 additions & 9 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ const (
)

type ChaosStatus struct {
// Phase is the chaos status.
Phase ChaosPhase `json:"phase"`
Reason string `json:"reason,omitempty"`
FailedMessage string `json:"failedMessage,omitempty"`
FailedMessage string `json:"failedMessage,omitempty"`

Scheduler ScheduleStatus `json:"scheduler,omitempty"`

Expand Down Expand Up @@ -175,11 +172,12 @@ type ScheduleStatus struct {
type ExperimentPhase string

const (
ExperimentPhaseRunning ExperimentPhase = "Running"
ExperimentPhaseWaiting ExperimentPhase = "Waiting"
ExperimentPhasePaused ExperimentPhase = "Paused"
ExperimentPhaseFailed ExperimentPhase = "Failed"
ExperimentPhaseFinished ExperimentPhase = "Finished"
ExperimentPhaseUninitialized ExperimentPhase = ""
ExperimentPhaseRunning ExperimentPhase = "Running"
ExperimentPhaseWaiting ExperimentPhase = "Waiting"
ExperimentPhasePaused ExperimentPhase = "Paused"
ExperimentPhaseFailed ExperimentPhase = "Failed"
ExperimentPhaseFinished ExperimentPhase = "Finished"
)

type ExperimentStatus struct {
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_dnschaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -217,7 +212,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
required:
- spec
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_httpchaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -241,7 +236,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
type: object
version: v1alpha1
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_iochaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -314,7 +309,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
type: object
version: v1alpha1
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_jvmchaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -479,7 +474,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
type: object
version: v1alpha1
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_kernelchaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -268,7 +263,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
required:
- spec
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_networkchaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -412,7 +407,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
required:
- spec
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_podchaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -225,7 +220,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
required:
- spec
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_podnetworkchaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -273,7 +268,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
required:
- spec
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_stresschaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,6 @@ spec:
type: object
description: Instances always specifies stressing instances
type: object
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -260,7 +255,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
required:
- spec
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/chaos-mesh.org_timechaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ spec:
type: object
failedMessage:
type: string
phase:
description: Phase is the chaos status.
type: string
reason:
type: string
scheduler:
description: ScheduleStatus is the current status of chaos scheduler.
properties:
Expand All @@ -220,7 +215,6 @@ spec:
type: object
required:
- experiment
- phase
type: object
required:
- spec
Expand Down
4 changes: 3 additions & 1 deletion controllers/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ type Reconciler struct {
}

// NewReconciler would create Reconciler for common chaos
func NewReconciler(e endpoint.Endpoint, ctx ctx.Context) *Reconciler {
func NewReconciler(req ctrl.Request, e endpoint.Endpoint, ctx ctx.Context) *Reconciler {
ctx.Log = ctx.Log.WithName(req.NamespacedName.String())

return &Reconciler{
Endpoint: e,
Context: ctx,
Expand Down

0 comments on commit b0e257c

Please sign in to comment.