Skip to content

Commit

Permalink
Chore(helper pod): Make setHelper data as tunable (#519)
Browse files Browse the repository at this point in the history
Signed-off-by: uditgaurav <[email protected]>
  • Loading branch information
uditgaurav committed May 13, 2022
1 parent ffc96c0 commit 057fc5b
Show file tree
Hide file tree
Showing 45 changed files with 65 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ trivy-check:
@echo "---> Running Trivy Check"
@echo "------------------------"
@./trivy --exit-code 0 --severity HIGH --no-progress $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)
@./trivy --exit-code 0 --severity CRITICAL --no-progress $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)
@./trivy --exit-code 0 --severity CRITICAL --no-progress $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN apk --update add \
# Packaging stage
# Image source: https://github.com/litmuschaos/test-tools/blob/master/custom/hardened-alpine/experiment/Dockerfile
# The base image is non-root (have litmus user) with default litmus directory.
FROM litmuschaos/experiment-alpine
FROM litmuschaos/experiment-alpine:2.9.0

LABEL maintainer="LitmusChaos"

Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/container-kill/lib/container-kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func PrepareContainerKill(experimentsDetails *experimentTypes.ExperimentDetails,
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/disk-fill/lib/disk-fill.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func PrepareDiskFill(experimentsDetails *experimentTypes.ExperimentDetails, clie
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func PrepareDockerServiceKill(experimentsDetails *experimentTypes.ExperimentDeta
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func PrepareKubeletKill(experimentsDetails *experimentTypes.ExperimentDetails, c
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/network-chaos/lib/network-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/node-cpu-hog/lib/node-cpu-hog.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func PrepareNodeCPUHog(experimentsDetails *experimentTypes.ExperimentDetails, cl
})

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/node-io-stress/lib/node-io-stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func PrepareNodeIOStress(experimentsDetails *experimentTypes.ExperimentDetails,
})

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/node-memory-hog/lib/node-memory-hog.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func PrepareNodeMemoryHog(experimentsDetails *experimentTypes.ExperimentDetails,
})

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/node-restart/lib/node-restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func PrepareNodeRestart(experimentsDetails *experimentTypes.ExperimentDetails, c
types.SetEngineEventAttributes(eventsDetails, types.ChaosInject, msg, "Normal", chaosDetails)
events.GenerateEvents(eventsDetails, clients, chaosDetails, "ChaosEngine")

if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/pod-dns-chaos/lib/pod-dns-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/stress-chaos/lib/stress-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func PrepareAndInjectStressChaos(experimentsDetails *experimentTypes.ExperimentD
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/pumba/container-kill/lib/container-kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func PrepareContainerKill(experimentsDetails *experimentTypes.ExperimentDetails,
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/pumba/cpu-chaos/lib/cpu-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func PreparePodCPUHog(experimentsDetails *experimentTypes.ExperimentDetails, cli
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/pumba/memory-chaos/lib/memory-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func PreparePodMemoryHog(experimentsDetails *experimentTypes.ExperimentDetails,
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/pumba/network-chaos/lib/network-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/pumba/pod-io-stress/lib/pod-io-stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func PreparePodIOStress(experimentsDetails *experimentTypes.ExperimentDetails, c
}

if experimentsDetails.EngineName != "" {
if err := common.SetHelperData(chaosDetails, clients); err != nil {
if err := common.SetHelperData(chaosDetails, experimentsDetails.SetHelperData, clients); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require (
k8s.io/api v0.17.3
k8s.io/apimachinery v0.17.3
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog v1.0.0
k8s.io/kubernetes v1.18.19
)

Expand Down Expand Up @@ -75,7 +76,6 @@ require (
google.golang.org/grpc v1.38.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 // indirect
k8s.io/utils v0.0.0-20200414100711-2df71ebbae66 // indirect
sigs.k8s.io/controller-runtime v0.4.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions pkg/generic/container-kill/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.Signal = types.Getenv("SIGNAL", "SIGKILL")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/container-kill/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ type ExperimentDetails struct {
Signal string
NodeLabel string
IsTargetContainerProvided bool
SetHelperData string
}
2 changes: 1 addition & 1 deletion pkg/generic/disk-fill/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.DataBlockSize, _ = strconv.Atoi(types.Getenv("DATA_BLOCK_SIZE", "256"))
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")

experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/disk-fill/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ type ExperimentDetails struct {
DataBlockSize int
NodeLabel string
IsTargetContainerProvided bool
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/docker-service-kill/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.TargetContainer = types.Getenv("TARGET_CONTAINER", "")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/docker-service-kill/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ type ExperimentDetails struct {
LIBImage string
LIBImagePullPolicy string
TargetContainer string
SetHelperData string
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.TargetContainer = types.Getenv("TARGET_CONTAINER", "")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/kubelet-service-kill/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ type ExperimentDetails struct {
LIBImage string
LIBImagePullPolicy string
TargetContainer string
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/network-chaos/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails, expName string
experimentDetails.SocketPath = types.Getenv("SOCKET_PATH", "/var/run/docker.sock")
experimentDetails.Sequence = types.Getenv("SEQUENCE", "parallel")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")

switch expName {
case "pod-network-loss":
Expand Down
1 change: 1 addition & 0 deletions pkg/generic/network-chaos/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ type ExperimentDetails struct {
NetworkChaosType string
NodeLabel string
IsTargetContainerProvided bool
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/node-cpu-hog/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.TargetContainer = types.Getenv("TARGET_CONTAINER", "")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/node-cpu-hog/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ type ExperimentDetails struct {
Sequence string
TargetContainer string
NodeLabel string
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/node-io-stress/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.TargetContainer = types.Getenv("TARGET_CONTAINER", "")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/node-io-stress/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ type ExperimentDetails struct {
Sequence string
TargetContainer string
NodeLabel string
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/node-memory-hog/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.TargetContainer = types.Getenv("TARGET_CONTAINER", "")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/node-memory-hog/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ type ExperimentDetails struct {
Sequence string
TargetContainer string
NodeLabel string
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/node-restart/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.TargetContainer = types.Getenv("TARGET_CONTAINER", "")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
}
1 change: 1 addition & 0 deletions pkg/generic/node-restart/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ type ExperimentDetails struct {
TargetNodeIP string
TargetContainer string
NodeLabel string
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/node-taint/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.Timeout, _ = strconv.Atoi(types.Getenv("STATUS_CHECK_TIMEOUT", "180"))
experimentDetails.TargetContainer = types.Getenv("TARGET_CONTAINER", "")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")

}
1 change: 1 addition & 0 deletions pkg/generic/node-taint/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ type ExperimentDetails struct {
LIBImagePullPolicy string
TargetContainer string
NodeLabel string
SetHelperData string
}
1 change: 1 addition & 0 deletions pkg/generic/pod-dns-chaos/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails, expType DNSCha
experimentDetails.SocketPath = types.Getenv("SOCKET_PATH", "/var/run/docker.sock")
experimentDetails.ChaosServiceAccount = types.Getenv("CHAOS_SERVICE_ACCOUNT", "")
experimentDetails.Sequence = types.Getenv("SEQUENCE", "parallel")
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
switch expType {
case Error:
Expand Down
1 change: 1 addition & 0 deletions pkg/generic/pod-dns-chaos/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ type ExperimentDetails struct {
SocketPath string
TerminationGracePeriodSeconds int
IsTargetContainerProvided bool
SetHelperData string
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.PodSelector = types.Getenv("POD_SELECTOR", "")
experimentDetails.NamespaceSelector = types.Getenv("NAMESPACE_SELECTOR", "")
experimentDetails.PORTS = types.Getenv("PORTS", "")

}
1 change: 1 addition & 0 deletions pkg/generic/stress-chaos/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func GetENV(experimentDetails *experimentTypes.ExperimentDetails, expName string
experimentDetails.TerminationGracePeriodSeconds, _ = strconv.Atoi(types.Getenv("TERMINATION_GRACE_PERIOD_SECONDS", ""))
experimentDetails.StressImage = types.Getenv("STRESS_IMAGE", "alexeiled/stress-ng:latest-ubuntu")
experimentDetails.NodeLabel = types.Getenv("NODE_LABEL", "")
experimentDetails.SetHelperData = types.Getenv("SET_HELPER_DATA", "true")

switch expName {
case "pod-cpu-hog":
Expand Down
1 change: 1 addition & 0 deletions pkg/generic/stress-chaos/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ type ExperimentDetails struct {
StressType string
IsTargetContainerProvided bool
NodeLabel string
SetHelperData string
}
33 changes: 21 additions & 12 deletions pkg/utils/common/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,38 @@ func getChaosPodResourceRequirements(podName, containerName, namespace string, c

// SetHelperData derive the data from experiment pod and sets into experimentDetails struct
// which can be used to create helper pod
func SetHelperData(chaosDetails *types.ChaosDetails, clients clients.ClientSets) error {
pod, err := clients.KubeClient.CoreV1().Pods(chaosDetails.ChaosNamespace).Get(chaosDetails.ChaosPodName, v1.GetOptions{})
func SetHelperData(chaosDetails *types.ChaosDetails, setHelperData string, clients clients.ClientSets) error {
var pod *core_v1.Pod
pod, err = clients.KubeClient.CoreV1().Pods(chaosDetails.ChaosNamespace).Get(chaosDetails.ChaosPodName, v1.GetOptions{})
if err != nil {
return err
}
// Get Chaos Pod Annotation
chaosDetails.Annotations = pod.Annotations

// Get ImagePullSecrets
chaosDetails.ImagePullSecrets = pod.Spec.ImagePullSecrets

// Get Labels
labels := pod.ObjectMeta.Labels
delete(labels, "controller-uid")
delete(labels, "job-name")
chaosDetails.Labels = labels

// Get Resource Requirements
chaosDetails.Resources, err = getChaosPodResourceRequirements(chaosDetails.ChaosPodName, chaosDetails.ExperimentName, chaosDetails.ChaosNamespace, clients)
if err != nil {
return errors.Errorf("unable to get resource requirements, err: %v", err)
switch setHelperData {
case "false":
return nil

default:

// Get Chaos Pod Annotation
chaosDetails.Annotations = pod.Annotations

// Get ImagePullSecrets
chaosDetails.ImagePullSecrets = pod.Spec.ImagePullSecrets

// Get Resource Requirements
chaosDetails.Resources, err = getChaosPodResourceRequirements(chaosDetails.ChaosPodName, chaosDetails.ExperimentName, chaosDetails.ChaosNamespace, clients)
if err != nil {
return errors.Errorf("unable to get resource requirements, err: %v", err)
}
return nil
}
return nil
}

// GetHelperLabels return the labels of the helper pod
Expand Down

0 comments on commit 057fc5b

Please sign in to comment.