Skip to content

Commit f8d618c

Browse files
Shubham Chaudharydravog7
andauthored
[Cherrypick for 2.2.0] (#456)
* Bug(Experiment Generator): Add AuxiliaryAppInfo to template (#455) Signed-off-by: dravog7 <[email protected]> * chore(charts): update readme, contributor guide and github actions (#454) * chore(charts): update readme, contributor guide and github actions Signed-off-by: shubham chaudhary <[email protected]> * chore(repo-health): adding cii best practices Signed-off-by: shubham chaudhary <[email protected]> * chore(synk): Adding snyk to check the vulnerabilities Signed-off-by: shubham chaudhary <[email protected]> * chore(trivy): remove trivy check from push and release actions Signed-off-by: shubham chaudhary <[email protected]> * resolved conflicts Signed-off-by: shubham chaudhary <[email protected]> Co-authored-by: John Abraham <[email protected]>
1 parent 0ffc453 commit f8d618c

116 files changed

Lines changed: 1159 additions & 1717 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/auto-merge.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Configuration for probot-auto-merge - https://github.com/bobvanderlinden/probot-auto-merge
2+
3+
reportStatus: true
4+
updateBranch: false
5+
deleteBranchAfterMerge: true
6+
mergeMethod: squash
7+
8+
minApprovals:
9+
COLLABORATOR: 0
10+
maxRequestedChanges:
11+
NONE: 0
12+
blockingLabels:
13+
- DO NOT MERGE
14+
- WIP
15+
- blocked
16+
17+
# Will merge whenever the above conditions are met, but also
18+
# the owner has approved or merge label was added.
19+
rules:
20+
- minApprovals:
21+
OWNER: 1
22+
- requiredLabels:
23+
- merge

.github/workflows/build.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,18 @@ jobs:
3535
fi
3636
3737
- name: golangci-lint
38-
uses: reviewdog/action-golangci-lint@v1
38+
uses: reviewdog/action-golangci-lint@v1
39+
40+
security:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@master
44+
- name: Run Snyk to check for vulnerabilities
45+
uses: snyk/actions/golang@master
46+
env:
47+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
48+
with:
49+
args: --severity-threshold=high
3950

4051
build:
4152
needs: pre-checks

.github/workflows/push.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,3 @@ jobs:
7070
file: build/Dockerfile
7171
platforms: linux/amd64,linux/arm64
7272
tags: litmuschaos/go-runner:ci
73-
74-
trivy:
75-
needs: pre-checks
76-
runs-on: ubuntu-latest
77-
steps:
78-
# Install golang
79-
- uses: actions/setup-go@v2
80-
with:
81-
go-version: 1.16
82-
- uses: actions/checkout@v2
83-
84-
- name: Build image for trivy scan
85-
run: make build-amd64
86-
87-
- name: setup trivy
88-
run: |
89-
wget https://github.com/aquasecurity/trivy/releases/download/v0.11.0/trivy_0.11.0_Linux-64bit.tar.gz
90-
tar zxvf trivy_0.11.0_Linux-64bit.tar.gz
91-
make trivy-check

.github/workflows/release.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,3 @@ jobs:
6868
file: build/Dockerfile
6969
platforms: linux/amd64,linux/arm64
7070
tags: litmuschaos/go-runner:${{ env.RELEASE_TAG }},litmuschaos/go-runner:latest
71-
72-
trivy:
73-
needs: pre-checks
74-
runs-on: ubuntu-latest
75-
steps:
76-
# Install golang
77-
- uses: actions/setup-go@v2
78-
with:
79-
go-version: 1.16
80-
- uses: actions/checkout@v2
81-
82-
- name: Build image for trivy scan
83-
run: make build-amd64
84-
85-
- name: setup trivy
86-
run: |
87-
wget https://github.com/aquasecurity/trivy/releases/download/v0.11.0/trivy_0.11.0_Linux-64bit.tar.gz
88-
tar zxvf trivy_0.11.0_Linux-64bit.tar.gz
89-
make trivy-check

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ This project is implemented using Go and uses the standard golang tools for deve
5454
- are familiar with Docker containers
5555
- are familiar with Kubernetes and have access to a Kubernetes cluster or Minikube to test the changes.
5656

57-
For the creation of new chaos-experiment and testing of the modified changes, see the detailed instructions [here](./contribute/developer-guide/README.md).
57+
For the creation of new chaos-experiment and testing of the modified changes, see the detailed instructions [here](./contribute/developer-guide/README.md).
58+
59+
## Community
60+
61+
The litmus community will have a monthly community sync-up on 3rd Wednesday 22.00-23.00IST / 18.30-19.30CEST
62+
- The community meeting details are available [here](https://hackmd.io/a4Zu_sH4TZGeih-xCimi3Q). Please feel free to join the community meeting.

README.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
# LitmusGo:
22

3-
- This repo consists of Litmus Chaos Experiments written in golang. The examples in this repo are good indicators
4-
of how to construct the experiments in golang: complete with steady state checks, chaosresult generation, chaos injection etc..,
5-
post chaos checks, create events and reports for observability and configure sinks for these.
3+
[![Slack Channel](https://img.shields.io/badge/Slack-Join-purple)](https://slack.litmuschaos.io)
4+
![GitHub Workflow](https://github.com/litmuschaos/litmus-go/actions/workflows/push.yml/badge.svg?branch=master)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/litmuschaos/go-runner.svg)](https://hub.docker.com/r/litmuschaos/go-runner)
6+
[![GitHub issues](https://img.shields.io/github/issues/litmuschaos/litmus-go)](https://github.com/litmuschaos/litmus-go/issues)
7+
[![Twitter Follow](https://img.shields.io/twitter/follow/litmuschaos?style=social)](https://twitter.com/LitmusChaos)
8+
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5297/badge)](https://bestpractices.coreinfrastructure.org/projects/5297)
9+
[![Go Report Card](https://goreportcard.com/badge/github.com/litmuschaos/litmus-go)](https://goreportcard.com/report/github.com/litmuschaos/litmus-go)
10+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-go.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-go?ref=badge_shield)
11+
[![YouTube Channel](https://img.shields.io/badge/YouTube-Subscribe-red)](https://www.youtube.com/channel/UCa57PMqmz_j0wnteRa9nCaw)
12+
<br><br>
613

7-
**NOTE**
14+
This repo consists of Litmus Chaos Experiments written in golang. The examples in this repo are good indicators of how to construct the experiments in golang: complete with steady state checks, chaosresult generation, chaos injection etc.., post chaos checks, create events and reports for observability and configure sinks for these.
815

9-
- This repo can be viewed as an extension to the [litmuschaos/litmus](https://github.com/litmuschaos/litmus) repo
10-
in the sense that the litmus repo also houses a significant set of experiments, built using ansible. The litmus repo
11-
will also continue to be the project's community-facing meta repo housing other important project artifacts. In that
12-
sense, litmus-go is very similar to and therefore a sister repo of [litmus-python](https://github.com/litmuschaos/litmus-python) which
13-
houses examples for experiment business logic written in python.
16+
**NOTE**: This repo can be viewed as an extension to the [litmuschaos/litmus](https://github.com/litmuschaos/litmus) repo. The litmus repo will also continue to be the project's community-facing meta repo housing other important project artifacts. In that sense, litmus-go is very similar to and therefore a sister repo of [litmus-python](https://github.com/litmuschaos/litmus-python) which houses examples for experiment business logic written in python.
17+
18+
## Litmus SDK
19+
20+
The Litmus SDK provides a simple way to bootstrap your experiment and helps create the aforementioned artifacts in the appropriate directory (i.e., as per the chaos-category) based on an attributes file provided as input by the chart-developer. The scaffolded files consist of placeholders which can then be filled as desired.
21+
22+
It generates the custom chaos experiments with some default Pre & Post Chaos Checks (AUT & Auxiliary Applications status checks). It can use the existing chaoslib (present inside /chaoslib directory), if available else It will create a new chaoslib inside the corresponding directory.
23+
24+
Refer [Litmus-SDK](https://github.com/litmuschaos/litmus-go/blob/master/contribute/developer-guide/README.md) for more details.
25+
26+
## How to get started?
27+
28+
Refer the [LitmusChaos Docs](https://docs.litmuschaos.io) and [Experiment Docs](https://litmuschaos.github.io/litmus/experiments/categories/contents/)
29+
30+
## How do I contribute?
31+
32+
You can contribute by raising issues, improving the documentation, contributing to the core framework and tooling, etc.
33+
34+
Head over to the [Contribution guide](CONTRIBUTING.md)
35+
36+
## License
37+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-go.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-go?ref=badge_large)

chaoslib/litmus/aws-ssm-chaos/lib/ssm-chaos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func InjectChaosInSerialMode(experimentsDetails *experimentTypes.ExperimentDetai
2020

2121
select {
2222
case <-inject:
23-
// stopping the chaos execution, if abort signal recieved
23+
// stopping the chaos execution, if abort signal received
2424
os.Exit(0)
2525
default:
2626
//ChaosStartTimeStamp contains the start timestamp, when the chaos injection begin
@@ -86,7 +86,7 @@ func InjectChaosInParallelMode(experimentsDetails *experimentTypes.ExperimentDet
8686

8787
select {
8888
case <-inject:
89-
// stopping the chaos execution, if abort signal recieved
89+
// stopping the chaos execution, if abort signal received
9090
os.Exit(0)
9191
default:
9292
//ChaosStartTimeStamp contains the start timestamp, when the chaos injection begin

chaoslib/litmus/azure-disk-loss/lib/azure-disk-loss.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func PrepareChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients
6868

6969
select {
7070
case <-inject:
71-
// stopping the chaos execution, if abort signal recieved
71+
// stopping the chaos execution, if abort signal received
7272
os.Exit(0)
7373
default:
7474

@@ -247,7 +247,7 @@ func abortWatcher(experimentsDetails *experimentTypes.ExperimentDetails, attache
247247

248248
log.Info("[Abort]: Chaos Revert Started")
249249

250-
log.Info("[Abort]: Attaching disk(s) as abort signal recieved")
250+
log.Info("[Abort]: Attaching disk(s) as abort signal received")
251251

252252
for instanceName, diskList := range attachedDisksWithInstance {
253253
// Checking for provisioning state of the vm instances

chaoslib/litmus/azure-instance-stop/lib/azure-instance-stop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func injectChaosInParallelMode(experimentsDetails *experimentTypes.ExperimentDet
171171
events.GenerateEvents(eventsDetails, clients, chaosDetails, "ChaosEngine")
172172
}
173173

174-
// PowerOff the instances parallely
174+
// PowerOff the instances parallelly
175175
for _, vmName := range instanceNameList {
176176
// Stopping the Azure instance
177177
log.Infof("[Chaos]: Stopping the Azure instance: %v", vmName)

chaoslib/litmus/container-kill/helper/container-kill.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/litmuschaos/litmus-go/pkg/clients"
1010
"github.com/litmuschaos/litmus-go/pkg/events"
11-
experimentEnv "github.com/litmuschaos/litmus-go/pkg/generic/container-kill/environment"
1211
experimentTypes "github.com/litmuschaos/litmus-go/pkg/generic/container-kill/types"
1312
"github.com/litmuschaos/litmus-go/pkg/log"
1413
"github.com/litmuschaos/litmus-go/pkg/result"
@@ -34,7 +33,7 @@ func Helper(clients clients.ClientSets) {
3433
getENV(&experimentsDetails)
3534

3635
// Intialise the chaos attributes
37-
experimentEnv.InitialiseChaosVariables(&chaosDetails, &experimentsDetails)
36+
types.InitialiseChaosVariables(&chaosDetails)
3837

3938
// Intialise Chaos Result Parameters
4039
types.SetResultAttributes(&resultDetails, chaosDetails)
@@ -197,20 +196,20 @@ func verifyRestartCount(experimentsDetails *experimentTypes.ExperimentDetails, p
197196

198197
//getENV fetches all the env variables from the runner pod
199198
func getENV(experimentDetails *experimentTypes.ExperimentDetails) {
200-
experimentDetails.ExperimentName = common.Getenv("EXPERIMENT_NAME", "")
201-
experimentDetails.InstanceID = common.Getenv("INSTANCE_ID", "")
202-
experimentDetails.AppNS = common.Getenv("APP_NS", "")
203-
experimentDetails.TargetContainer = common.Getenv("APP_CONTAINER", "")
204-
experimentDetails.TargetPods = common.Getenv("APP_POD", "")
205-
experimentDetails.ChaosDuration, _ = strconv.Atoi(common.Getenv("TOTAL_CHAOS_DURATION", "30"))
206-
experimentDetails.ChaosInterval, _ = strconv.Atoi(common.Getenv("CHAOS_INTERVAL", "10"))
207-
experimentDetails.ChaosNamespace = common.Getenv("CHAOS_NAMESPACE", "litmus")
208-
experimentDetails.EngineName = common.Getenv("CHAOS_ENGINE", "")
209-
experimentDetails.ChaosUID = clientTypes.UID(common.Getenv("CHAOS_UID", ""))
210-
experimentDetails.ChaosPodName = common.Getenv("POD_NAME", "")
211-
experimentDetails.SocketPath = common.Getenv("SOCKET_PATH", "")
212-
experimentDetails.ContainerRuntime = common.Getenv("CONTAINER_RUNTIME", "")
213-
experimentDetails.Signal = common.Getenv("SIGNAL", "SIGKILL")
214-
experimentDetails.Delay, _ = strconv.Atoi(common.Getenv("STATUS_CHECK_DELAY", "2"))
215-
experimentDetails.Timeout, _ = strconv.Atoi(common.Getenv("STATUS_CHECK_TIMEOUT", "180"))
199+
experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "")
200+
experimentDetails.InstanceID = types.Getenv("INSTANCE_ID", "")
201+
experimentDetails.AppNS = types.Getenv("APP_NAMESPACE", "")
202+
experimentDetails.TargetContainer = types.Getenv("APP_CONTAINER", "")
203+
experimentDetails.TargetPods = types.Getenv("APP_POD", "")
204+
experimentDetails.ChaosDuration, _ = strconv.Atoi(types.Getenv("TOTAL_CHAOS_DURATION", "30"))
205+
experimentDetails.ChaosInterval, _ = strconv.Atoi(types.Getenv("CHAOS_INTERVAL", "10"))
206+
experimentDetails.ChaosNamespace = types.Getenv("CHAOS_NAMESPACE", "litmus")
207+
experimentDetails.EngineName = types.Getenv("CHAOSENGINE", "")
208+
experimentDetails.ChaosUID = clientTypes.UID(types.Getenv("CHAOS_UID", ""))
209+
experimentDetails.ChaosPodName = types.Getenv("POD_NAME", "")
210+
experimentDetails.SocketPath = types.Getenv("SOCKET_PATH", "")
211+
experimentDetails.ContainerRuntime = types.Getenv("CONTAINER_RUNTIME", "")
212+
experimentDetails.Signal = types.Getenv("SIGNAL", "SIGKILL")
213+
experimentDetails.Delay, _ = strconv.Atoi(types.Getenv("STATUS_CHECK_DELAY", "2"))
214+
experimentDetails.Timeout, _ = strconv.Atoi(types.Getenv("STATUS_CHECK_TIMEOUT", "180"))
216215
}

0 commit comments

Comments
 (0)