Skip to content

Commit

Permalink
Merge pull request #394 from ispeakc0de/v2.2.0-tracker
Browse files Browse the repository at this point in the history
[cherrypick for 2.2.0]
  • Loading branch information
Shubham Chaudhary authored Oct 13, 2021
2 parents 2450cc3 + 5e05127 commit eed73d0
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in the repo.
* @rahulchheda @ksatchit @chandankumar4 @rajdas98
* @rahulchheda @ksatchit @chandankumar4 @rajdas98
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ jobs:
- name: unused-package check
run: make unused-package-check

security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high

trivy:
needs: pre-checks
runs-on: ubuntu-latest
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ For setting up a Development environment on your local host, see the detailed in
## Community
The litmus community will have a weekly contributor sync-up on Tuesdays 16.00-16.30IST / 12.30-13.00CEST
- The sync up meeting is held online on [Google Hangouts](https://meet.google.com/uvt-ozaw-bvp)
- The release items are tracked in this [planning sheet](https://docs.google.com/spreadsheets/d/15svGB99bDcSTkwAYttH1QzP5WJSb-dFKbPzl-9WqmXM).
The litmus community will have a monthly community sync-up on 3rd Wednesday 22.00-23.00IST / 18.30-19.30CEST
- The community meeting details are available [here](https://hackmd.io/a4Zu_sH4TZGeih-xCimi3Q). Please feel free to join the community meeting.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
Expand All @@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
79 changes: 48 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Litmus chaos-operator for injecting chaos experiments on Kubernetes

[![Slack Channel](https://img.shields.io/badge/Slack-Join-purple)](https://slack.litmuschaos.io)
![GitHub Workflow](https://github.com/litmuschaos/chaos-operator/actions/workflows/push.yml/badge.svg?branch=master)
[![Docker Pulls](https://img.shields.io/docker/pulls/litmuschaos/chaos-operator.svg)](https://hub.docker.com/r/litmuschaos/chaos-operator)
[![GitHub issues](https://img.shields.io/github/issues/litmuschaos/chaos-operator)](https://github.com/litmuschaos/chaos-operator/issues)
[![Twitter Follow](https://img.shields.io/twitter/follow/litmuschaos?style=social)](https://twitter.com/LitmusChaos)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2597079b1b5240d3866a6deb4112a2f2)](https://www.codacy.com/manual/litmuschaos/chaos-operator?utm_source=github.com&utm_medium=referral&utm_content=litmuschaos/chaos-operator&utm_campaign=Badge_Grade)
[![Go Report Card](https://goreportcard.com/badge/github.com/litmuschaos/chaos-operator)](https://goreportcard.com/report/github.com/litmuschaos/chaos-operator)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5290/badge)](https://bestpractices.coreinfrastructure.org/projects/5290)
[![BCH compliance](https://bettercodehub.com/edge/badge/litmuschaos/chaos-operator?branch=master)](https://bettercodehub.com/)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Flitmuschaos%2Fchaos-operator.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Flitmuschaos%2Fchaos-operator?ref=badge_shield)
[![codecov](https://codecov.io/gh/litmuschaos/chaos-operator/branch/master/graph/badge.svg)](https://codecov.io/gh/litmuschaos/chaos-operator)
[![YouTube Channel](https://img.shields.io/badge/YouTube-Subscribe-red)](https://www.youtube.com/channel/UCa57PMqmz_j0wnteRa9nCaw)
<br><br>

Litmus chaos operator is used by Kubernetes application developers and SREs to inject chaos into the applications
and Kubernetes infrastructure in a managed fashion. Its objective is to make the process of validation and
hardening of application workloads on Kubernetes easy by automating the execution of chaos experiments. A sample chaos
injection workflow could be as simple as:

- Install the Litmus infrastructure components (RBAC, CRDs), the Operator & Experiment custom resource bundles via the operator manifest
- Annotate the application under test (AUT), enabling it for chaos
- Create a ChaosEngine custom resource tied to the AUT, which describes the experiment to be executed
- Install the Litmus infrastructure components (RBAC, CRDs), the Operator & Experiment custom resource bundles via the operator manifest
- Annotate the application under test (AUT), enabling it for chaos
- Create a ChaosEngine custom resource tied to the AUT, which describes the experiment to be executed

Benefits provided by the Chaos Operator include:

- Standardised chaos experiment spec
- Categorized chaos bundles for stateless/stateful/vendor-specific
- Test-Run resiliency
- Ability to chaos run as a background service based on annotations
- Standardised chaos experiment spec
- Categorized chaos bundles for stateless/stateful/vendor-specific
- Test-Run resiliency
- Ability to chaos run as a background service based on annotations

## What is a chaos operator and how is it built?

Expand All @@ -40,17 +48,17 @@ runner pod), which is created & managed by it in order to implement the reconcil

The ChaosEngine is the core schema that defines the chaos workflow for a given application. Currently, it defines the following:

- Application info (namespace, labels, kind) of primary (AUT) and auxiliary (dependent) applications
- ServiceAccount used for execution of the experiment
- Flag to turn on/off chaos annotation checks on applications
- Chaos Experiment to be executed on the application
- Attributes of the experiments (overrides defaults specified in the experiment CRs)
- Flag to retain/cleanup chaos resources after experiment execution
- Application info (namespace, labels, kind) of primary (AUT) and auxiliary (dependent) applications
- ServiceAccount used for execution of the experiment
- Flag to turn on/off chaos annotation checks on applications
- Chaos Experiment to be executed on the application
- Attributes of the experiments (overrides defaults specified in the experiment CRs)
- Flag to retain/cleanup chaos resources after experiment execution

The ChaosEngine is the referenced as the owner of the secondary (reconcile) resource with Kubernetes deletePropagation
ensuring these also are removed upon deletion of the ChaosEngine CR.

Here is a sample ChaosEngineSpec for reference: <https://docs.litmuschaos.io/docs/getstarted/#prepare-chaosengine>
Here is a sample ChaosEngineSpec for reference: <https://v1-docs.litmuschaos.io/docs/getstarted/#prepare-chaosengine>

## What is a litmus chaos chart and how can I use it?

Expand All @@ -72,7 +80,11 @@ description:
kind: ChaosExperiment
metadata:
name: pod-delete
version: 0.1.9
labels:
name: pod-delete
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: chaosexperiment
app.kubernetes.io/version: latest
spec:
definition:
scope: Namespaced
Expand All @@ -97,28 +109,19 @@ spec:
- "patch"
- "update"
- "delete"
- apiGroups:
- ""
resources:
- "nodes"
verbs :
- "get"
- "list"
image: "litmuschaos/ansible-runner:latest"
image: "litmuschaos/go-runner:latest"
imagePullPolicy: Always
args:
- -c
- ansible-playbook ./experiments/generic/pod_delete/pod_delete_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0
- ./experiments -name pod-delete
command:
- /bin/bash
env:

- name: ANSIBLE_STDOUT_CALLBACK
value: 'default'

- name: TOTAL_CHAOS_DURATION
value: '15'

# Period to wait before injection of chaos in sec
# Period to wait before/after injection of chaos in sec
- name: RAMP_TIME
value: ''

Expand All @@ -128,10 +131,25 @@ spec:
- name: CHAOS_INTERVAL
value: '5'

## percentage of total pods to target
- name: PODS_AFFECTED_PERC
value: ''

- name: LIB
value: ''
value: 'litmus'

- name: TARGET_PODS
value: ''

## it defines the sequence of chaos execution for multiple target pods
## supported values: serial, parallel
- name: SEQUENCE
value: 'parallel'
labels:
name: pod-delete
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: experiment-job
app.kubernetes.io/version: latest
```
## How to get started?
Expand All @@ -140,8 +158,7 @@ Refer the LitmusChaos documentation [litmus docs](https://docs.litmuschaos.io)
## How do I contribute?
The Chaos Operator is in _alpha_ stage and needs all the help you can provide! Please contribute by raising issues,
improving the documentation, contributing to the core framework and tooling, etc.
You can contribute by raising issues, improving the documentation, contributing to the core framework and tooling, etc.
Head over to the [Contribution guide](CONTRIBUTING.md)
Expand Down
2 changes: 1 addition & 1 deletion pkg/analytics/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"k8s.io/client-go/kubernetes"
)

// contains clientUUID for analytics
// ClientUUID contains clientUUID for analytics
var ClientUUID string

// it derives the UID of the chaos-operator deployment
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/litmuschaos/v1alpha1/chaosengine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ type SourceDetails struct {
type PromProbeInputs struct {
// Endpoint for the prometheus probe
Endpoint string `json:"endpoint,omitempty"`
// Query to get promethus metrices
// Query to get promethus metrics
Query string `json:"query,omitempty"`
// QueryPath contains filePath, which contains prometheus query
QueryPath string `json:"queryPath,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/litmuschaos/v1alpha1/chaosresult_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
ResultVerdictPassed ResultVerdict = "Pass"
// ResultVerdictFailed is verdict of chaosresult when experiment failed
ResultVerdictFailed ResultVerdict = "Fail"
// ResultVerdictFailed is verdict of chaosresult when experiment aborted
// ResultVerdictStopped is verdict of chaosresult when experiment aborted
ResultVerdictStopped ResultVerdict = "Stopped"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/controller/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var (
// DefaultChaosRunnerImage contains the default value of runner resource
DefaultChaosRunnerImage = "litmuschaos/chaos-runner:latest"

// ResultCRDName contains name of the chaosresult CRD
ResultCRDName = "chaosresults.litmuschaos.io"
)

Expand Down
6 changes: 2 additions & 4 deletions tests/bdd/bdd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,8 @@ var _ = Describe("BDD on chaos-operator", func() {
isNotFound := errors.IsNotFound(err)
if isNotFound {
return nil
} else {
return fmt.Errorf("chaos-runner is not deleted yet, err: %v", err)
}
return fmt.Errorf("chaos-runner is not deleted yet, err: %v", err)
})
Expect(err).To(BeNil())
klog.Infoln("chaos-runner pod deletion verified")
Expand Down Expand Up @@ -432,9 +431,8 @@ var _ = Describe("BDD on chaos-operator", func() {
isNotFound := errors.IsNotFound(err)
if isNotFound {
return nil
} else {
return fmt.Errorf("chaos-runner is not deleted yet, err: %v", err)
}
return fmt.Errorf("chaos-runner is not deleted yet, err: %v", err)
})
Expect(err).To(BeNil())
})
Expand Down

0 comments on commit eed73d0

Please sign in to comment.