Skip to content

Commit

Permalink
[Cherrypick for 1.13.2] (#345)
Browse files Browse the repository at this point in the history
* (fix)controller: remove force options of chaos pods upon abort (#336)

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

* fix(crds): Removing maxProperties field validator (#340)

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

* ResponseTimeout for API Request call added for HttpProbe (#342)

* timeout for probe API calls

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

* removed minLength for insecureSkipVerify

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

* chore(push): Update push script to push the all tags on release (#315)

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

* added equality and set based label support (#344)

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

* chore(k8sProbe): Updating the k8s probe schema (#343)

Signed-off-by: shubhamchaudhary <[email protected]>
  • Loading branch information
ispeakc0de authored Mar 15, 2021
1 parent ac7adcd commit 6e8f8e6
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 158 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,25 @@ jobs:
env:
OPERATOR_IMAGE: litmuschaos/chaos-operator:ci
IMAGE_PULL_POLICY: IfNotPresent
KUBECONFIG: /home/runner/.kube/config

- name: Run Admin mode test
if: startsWith(github.event.comment.body, '/run-e2e-admin-mode') || startsWith(github.event.comment.body, '/run-e2e-all')
run: |
export PATH=$PATH:$(go env GOPATH)/bin
cd ${GOPATH}/src/github.com/litmuschaos/litmus-e2e
go test operator/admin-mode_test.go -v -count=1
env:
KUBECONFIG: /home/runner/.kube/config

- name: Run Reconcile Resiliency test
if: startsWith(github.event.comment.body, '/run-e2e-reconcile-resiliency') || startsWith(github.event.comment.body, '/run-e2e-all')
run: |
export PATH=$PATH:$(go env GOPATH)/bin
cd ${GOPATH}/src/github.com/litmuschaos/litmus-e2e
go test operator/reconcile-resiliency_test.go -v -count=1
env:
KUBECONFIG: /home/runner/.kube/config

- name: Check the test run
if: |
Expand Down
39 changes: 18 additions & 21 deletions deploy/chaos_crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,22 @@ spec:
k8sProbe/inputs:
type: object
properties:
command:
type: object
properties:
group:
type: string
version:
type: string
resource:
type: string
namespace:
type: string
fieldSelector:
type: string
labelSelector:
type: string
group:
type: string
version:
type: string
resource:
type: string
namespace:
type: string
fieldSelector:
type: string
labelSelector:
type: string
operation:
type: string
pattern: ^(present|absent|create|delete)$
minLength: 1
cmdProbe/inputs:
type: object
properties:
Expand Down Expand Up @@ -149,11 +150,11 @@ spec:
minLength: 1
insecureSkipVerify:
type: boolean
minLength: 1
responseTimeout:
type: integer
method:
type: object
minProperties: 1
maxProperties: 1
properties:
get:
type: object
Expand Down Expand Up @@ -218,10 +219,6 @@ spec:
type: string
pattern: ^(SOT|EOT|Edge|Continuous|OnChaos)$
minLength: 1
operation:
type: string
pattern: ^(present|absent|create|delete)$
minLength: 1
data:
type: string
components:
Expand Down
39 changes: 18 additions & 21 deletions deploy/crds/chaosengine_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,22 @@ spec:
k8sProbe/inputs:
type: object
properties:
command:
type: object
properties:
group:
type: string
version:
type: string
resource:
type: string
namespace:
type: string
fieldSelector:
type: string
labelSelector:
type: string
group:
type: string
version:
type: string
resource:
type: string
namespace:
type: string
fieldSelector:
type: string
labelSelector:
type: string
operation:
type: string
pattern: ^(present|absent|create|delete)$
minLength: 1
cmdProbe/inputs:
type: object
properties:
Expand Down Expand Up @@ -148,11 +149,11 @@ spec:
minLength: 1
insecureSkipVerify:
type: boolean
minLength: 1
responseTimeout:
type: integer
method:
type: object
minProperties: 1
maxProperties: 1
properties:
get:
type: object
Expand Down Expand Up @@ -217,10 +218,6 @@ spec:
type: string
pattern: ^(SOT|EOT|Edge|Continuous|OnChaos)$
minLength: 1
operation:
type: string
pattern: ^(present|absent|create|delete)$
minLength: 1
data:
type: string
components:
Expand Down
16 changes: 5 additions & 11 deletions pkg/apis/litmuschaos/v1alpha1/chaosengine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,13 @@ type ProbeAttributes struct {
// mode for k8s probe
// it can be SOT, EOT, Edge
Mode string `json:"mode,omitempty"`
// Operation performed by the k8s probe
// it can be create, delete, present, absent
Operation string `json:"operation,omitempty"`
// Data contains the manifest/data for the resource, which need to be created
// it supported for create operation only
Data string `json:"data,omitempty"`
}

// K8sProbeInputs contains all the inputs required for k8s probe
type K8sProbeInputs struct {
// Command need to be executed for the probe
Command K8sCommand `json:"command,omitempty"`
// Expected output or result of the command
ExpectedResult string `json:"expectedResult,omitempty"`
}

// K8sCommand contains all the commands need for the k8sprobe
type K8sCommand struct {
// group of the resource
Group string `json:"group,omitempty"`
// apiversion of the resource
Expand All @@ -223,6 +212,9 @@ type K8sCommand struct {
FieldSelector string `json:"fieldSelector,omitempty"`
// labelselector to get the resource using labels selector
LabelSelector string `json:"labelSelector,omitempty"`
// Operation performed by the k8s probe
// it can be create, delete, present, absent
Operation string `json:"operation,omitempty"`
}

//CmdProbeInputs contains all the inputs required for cmd probe
Expand Down Expand Up @@ -269,6 +261,8 @@ 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
17 changes: 0 additions & 17 deletions pkg/apis/litmuschaos/v1alpha1/zz_generated.deepcopy.go

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

12 changes: 6 additions & 6 deletions pkg/controller/chaosengine/chaosengine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,7 @@ func initializeApplicationInfo(instance *litmuschaosv1alpha1.ChaosEngine, appInf
}

if instance.Spec.Appinfo.Applabel != "" {
appLabel := strings.Split(instance.Spec.Appinfo.Applabel, "=")
chaosTypes.AppLabelKey = appLabel[0]
chaosTypes.AppLabelValue = appLabel[1]
appInfo.Label = make(map[string]string)
appInfo.Label[chaosTypes.AppLabelKey] = chaosTypes.AppLabelValue
appInfo.Label = instance.Spec.Appinfo.Applabel
}

if instance.Spec.Appinfo.Appns != "" {
Expand Down Expand Up @@ -501,7 +497,7 @@ func (r *ReconcileChaosEngine) reconcileForDelete(engine *chaosTypes.EngineInfo,

// forceRemoveAllChaosPods force removes all chaos-related pods
func (r *ReconcileChaosEngine) forceRemoveAllChaosPods(engine *chaosTypes.EngineInfo, request reconcile.Request) error {
optsDelete := []client.DeleteAllOfOption{client.InNamespace(request.NamespacedName.Namespace), client.MatchingLabels{"chaosUID": string(engine.Instance.UID)}, client.PropagationPolicy(metav1.DeletePropagationBackground), client.GracePeriodSeconds(int64(0))}
optsDelete := []client.DeleteAllOfOption{client.InNamespace(request.NamespacedName.Namespace), client.MatchingLabels{"chaosUID": string(engine.Instance.UID)}, client.PropagationPolicy(metav1.DeletePropagationBackground)}
var deleteEvent []string
var err []error

Expand Down Expand Up @@ -735,6 +731,10 @@ func (r *ReconcileChaosEngine) validateAnnontatedApplication(engine *chaosTypes.
}

if engine.Instance.Spec.AnnotationCheck == "true" {

if engine.AppInfo.Label == "" || engine.AppInfo.Namespace == "" || engine.AppInfo.Kind == "" {
return errors.Errorf("Incomplete AppInfo inside chaosengine")
}
// Determine whether apps with matching labels have chaos annotation set to true
engine, err = resource.CheckChaosAnnotation(engine, clientSet, *dynamicClient)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/chaosengine/chaosengine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestInitializeApplicationInfo(t *testing.T) {
t.Run(name, func(t *testing.T) {
appInfo := &chaosTypes.ApplicationInfo{
Namespace: "namespace",
Label: map[string]string{"fake_id": "aa"},
Label: "fake_id=aa",
ExperimentList: []litmuschaosv1alpha1.ExperimentList{
{
Name: "fake_name",
Expand Down
Loading

0 comments on commit 6e8f8e6

Please sign in to comment.