Skip to content

Commit

Permalink
[CheeryPick 2.13.1] (#425)
Browse files Browse the repository at this point in the history
* Fix permissions for leader election in chaos-operator (#418)

Signed-off-by: uditgaurav <[email protected]>

Signed-off-by: uditgaurav <[email protected]>

* fix(probe): Converting probeStatus as enum (#419)

Signed-off-by: Shubham Chaudhary <[email protected]>

Signed-off-by: Shubham Chaudhary <[email protected]>

* update(sdk): updating operator sdk version (#420)

Signed-off-by: Shubham Chaudhary <[email protected]>

* Chore(cmd-probe): Adds inherit_inputs field in cmdProbe/inputs.source to inherit experiment details in probe pod (#421)

Signed-off-by: uditgaurav <[email protected]>

* chore(httpProbe): Remove responseTimeout field, use the global probeTimeout field instead (#422)

Signed-off-by: Shubham Chaudhary <[email protected]>

Signed-off-by: uditgaurav <[email protected]>
Signed-off-by: Shubham Chaudhary <[email protected]>
Co-authored-by: Udit Gaurav <[email protected]>
  • Loading branch information
ispeakc0de and uditgaurav authored Oct 6, 2022
1 parent 5f1ad86 commit 3cc5346
Show file tree
Hide file tree
Showing 11 changed files with 459 additions and 442 deletions.
5 changes: 3 additions & 2 deletions api/litmuschaos/v1alpha1/chaosengine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ type SourceDetails struct {
// HostNetwork define the hostNetwork of the external pod
// it supports boolean values and default value is false
HostNetwork bool `json:"hostNetwork,omitempty"`
// InheritInputs defined to inherit experiment pod attributes(ENV, volumes, and volumeMounts) into probe pod
// it supports boolean values and default value is false
InheritInputs bool `json:"inheritInputs,omitempty"`
// Args for the source pod
Args []string `json:"args,omitempty"`
// ENVList contains ENV passed to the source pod
Expand Down Expand Up @@ -292,8 +295,6 @@ type HTTPProbeInputs struct {
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
// Method define the http method, it can be get or post
Method HTTPMethod `json:"method,omitempty"`
// ResponseTimeout contains the http response timeout
ResponseTimeout int `json:"responseTimeout,omitempty"`
}

// HTTPMethod define the http method details
Expand Down
25 changes: 22 additions & 3 deletions api/litmuschaos/v1alpha1/chaosresult_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,21 @@ const (
ResultVerdictStopped ResultVerdict = "Stopped"
)

type ProbeVerdict string

const (
ProbeVerdictPassed ProbeVerdict = "Passed"
ProbeVerdictFailed ProbeVerdict = "Failed"
ProbeVerdictNA ProbeVerdict = "N/A"
ProbeVerdictAwaited ProbeVerdict = "Awaited"
)

// ChaosResultStatus defines the observed state of ChaosResult
type ChaosResultStatus struct {
// ExperimentStatus contains the status,verdict of the experiment
ExperimentStatus TestStatus `json:"experimentStatus"`
// ProbeStatus contains the status of the probe
ProbeStatus []ProbeStatus `json:"probeStatus,omitempty"`
ProbeStatuses []ProbeStatuses `json:"probeStatuses,omitempty"`
// History contains cumulative values of verdicts
History *HistoryDetails `json:"history,omitempty"`
}
Expand All @@ -82,13 +91,23 @@ type TargetDetails struct {
}

// ProbeStatus defines information about the status and result of the probes
type ProbeStatus struct {
type ProbeStatuses struct {
// Name defines the name of probe
Name string `json:"name,omitempty"`
// Type defined the type of probe, supported values: K8sProbe, HttpProbe, CmdProbe
Type string `json:"type,omitempty"`
// Mode defined the mode of probe, supported values: SOT, EOT, Edge, OnChaos, Continuous
Mode string `json:"mode,omitempty"`
// Status defines whether a probe is pass or fail
Status map[string]string `json:"status,omitempty"`
Status ProbeStatus `json:"status,omitempty"`
}

// ProbeStatus defines information about the status and result of the probes
type ProbeStatus struct {
// Verdict defines the verdict of the probe, range: Passed, Failed, N/A
Verdict ProbeVerdict `json:"verdict,omitempty"`
// Description defines the description of probe status
Description string `json:"description,omitempty"`
}

// TestStatus defines information about the status and results of a chaos experiment
Expand Down
33 changes: 20 additions & 13 deletions api/litmuschaos/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion controllers/chaosengine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"github.com/litmuschaos/chaos-operator/pkg/resource"
chaosTypes "github.com/litmuschaos/chaos-operator/pkg/types"
"github.com/litmuschaos/chaos-operator/pkg/utils"
"github.com/litmuschaos/chaos-operator/pkg/utils/retry"
"github.com/litmuschaos/elves/kubernetes/container"
"github.com/litmuschaos/elves/kubernetes/pod"
"github.com/litmuschaos/litmus-go/pkg/utils/retry"
"github.com/pkg/errors"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
Expand Down
7 changes: 5 additions & 2 deletions deploy/chaos_crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ spec:
of the external pod it supports boolean values
and default value is false
type: boolean
inheritInputs:
description: InheritInputs define to inherit experiment
details in probe pod it supports boolean values
and default value is false.
type: boolean
image:
description: Image for the source pod
type: string
Expand Down Expand Up @@ -1957,8 +1962,6 @@ spec:
minLength: 1
insecureSkipVerify:
type: boolean
responseTimeout:
type: integer
method:
type: object
minProperties: 1
Expand Down
7 changes: 5 additions & 2 deletions deploy/crds/chaosengine_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ spec:
of the external pod it supports boolean values
and default value is false
type: boolean
inheritInputs:
description: InheritInputs define to inherit experiment
details in probe pod it supports boolean values
and default value is false.
type: boolean
image:
description: Image for the source pod
type: string
Expand Down Expand Up @@ -1956,8 +1961,6 @@ spec:
minLength: 1
insecureSkipVerify:
type: boolean
responseTimeout:
type: integer
method:
type: object
minProperties: 1
Expand Down
3 changes: 3 additions & 0 deletions deploy/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ rules:
- apiGroups: ["litmuschaos.io"]
resources: ["chaosengines/finalizers"]
verbs: ["update"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get","create","list","update","delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/google/go-cmp v0.5.6 // indirect
github.com/jpillora/go-ogle-analytics v0.0.0-20161213085824-14b04e0594ef
github.com/litmuschaos/elves v0.0.0-20201107015738-552d74669e3c
github.com/litmuschaos/litmus-go v0.0.0-20210705063441-babf0c4aa57d
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b // indirect
Expand All @@ -25,7 +24,7 @@ require (
github.com/google/martian v2.1.0+incompatible
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.15.0
github.com/operator-framework/operator-sdk v0.15.2
github.com/operator-framework/operator-sdk v0.19.0
github.com/stretchr/testify v1.7.0
k8s.io/klog v1.0.0
)
Expand Down Expand Up @@ -115,5 +114,3 @@ replace (
replace github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm

replace github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.2.0+incompatible

replace github.com/openshift/api => github.com/openshift/api v0.0.0-20190924102528-32369d4db2ad // Required until https://github.com/operator-framework/operator-lifecycle-manager/pull/1241 is resolved
Loading

0 comments on commit 3cc5346

Please sign in to comment.