-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update(contribution-guide): updating contribution guide according to …
…new schema changes (#35) Signed-off-by: shubhamchaudhary <shubham.chaudhary@mayadata.io>
- Loading branch information
1 parent
2320a97
commit 416a023
Showing
6 changed files
with
148 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package environment | ||
|
||
import ( | ||
"os" | ||
"strconv" | ||
|
||
clientTypes "k8s.io/apimachinery/pkg/types" | ||
|
||
experimentTypes "github.com/litmuschaos/litmus-go/pkg/pod-delete/types" | ||
"github.com/litmuschaos/litmus-go/pkg/types" | ||
) | ||
|
||
// STEPS TO GETENV OF YOUR CHOICE HERE | ||
// ADDED FOR FEW MANDATORY FIELD | ||
|
||
//GetENV fetches all the env variables from the runner pod | ||
func GetENV(experimentDetails *experimentTypes.ExperimentDetails, expName string) { | ||
experimentDetails.ExperimentName = expName | ||
experimentDetails.ChaosNamespace = Getenv("CHAOS_NAMESPACE", "litmus") | ||
experimentDetails.EngineName = Getenv("CHAOSENGINE", "") | ||
experimentDetails.ChaosDuration, _ = strconv.Atoi(Getenv("TOTAL_CHAOS_DURATION", "30")) | ||
experimentDetails.ChaosInterval, _ = strconv.Atoi(Getenv("CHAOS_INTERVAL", "10")) | ||
experimentDetails.RampTime, _ = strconv.Atoi(Getenv("RAMP_TIME", "0")) | ||
experimentDetails.ChaosLib = Getenv("LIB", "litmus") | ||
experimentDetails.AppNS = Getenv("APP_NAMESPACE", "") | ||
experimentDetails.AppLabel = Getenv("APP_LABEL", "") | ||
experimentDetails.AppKind = Getenv("APP_KIND", "") | ||
experimentDetails.ChaosUID = clientTypes.UID(Getenv("CHAOS_UID", "")) | ||
experimentDetails.InstanceID = Getenv("INSTANCE_ID", "") | ||
experimentDetails.ChaosPodName = Getenv("POD_NAME", "") | ||
} | ||
|
||
// Getenv fetch the env and set the default value, if any | ||
func Getenv(key string, defaultValue string) string { | ||
value := os.Getenv(key) | ||
if value == "" { | ||
value = defaultValue | ||
} | ||
return value | ||
} | ||
|
||
//InitialiseChaosVariables initialise all the global variables | ||
func InitialiseChaosVariables(chaosDetails *types.ChaosDetails, experimentDetails *experimentTypes.ExperimentDetails) { | ||
|
||
chaosDetails.ChaosNamespace = experimentDetails.ChaosNamespace | ||
chaosDetails.ChaosPodName = experimentDetails.ChaosPodName | ||
chaosDetails.ChaosUID = experimentDetails.ChaosUID | ||
chaosDetails.EngineName = experimentDetails.EngineName | ||
chaosDetails.ExperimentName = experimentDetails.ExperimentName | ||
chaosDetails.InstanceID = experimentDetails.InstanceID | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package types | ||
|
||
import ( | ||
clientTypes "k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
// ADD THE ATTRIBUTES OF YOUR CHOICE HERE | ||
// FEW MENDATORY ATTRIBUTES ARE ADDED BY DEFAULT | ||
|
||
// ExperimentDetails is for collecting all the experiment-related details | ||
type ExperimentDetails struct { | ||
ExperimentName string | ||
EngineName string | ||
ChaosDuration int | ||
ChaosInterval int | ||
RampTime int | ||
ChaosLib string | ||
AppNS string | ||
AppLabel string | ||
AppKind string | ||
ChaosUID clientTypes.UID | ||
InstanceID string | ||
ChaosNamespace string | ||
ChaosPodName string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters