litmuschaos / litmus-go

Apache License 2.0
66 stars 118 forks source link

enable ALL for TARGET_CONTAINER #683

Closed MichaelMorrisEst closed 6 months ago

MichaelMorrisEst commented 7 months ago

What this PR does / why we need it: Enables the user to specify ALL for TARGET_CONTAINERS to execute against all containers in the pods in parallel execution

Which issue this PR fixes Closes #682

Special notes for your reviewer:

Checklist:

MichaelMorrisEst commented 6 months ago

Hi @ispeakc0de

Yes, I have tested.

When I use a specific container name ("hello-world-2"), I see in the logs that specific container being targeted:

time="2024-03-04T00:11:23Z" level=info msg="Helper Name: container-kill"
time="2024-03-04T00:11:23Z" level=info msg="[PreReq]: Getting the ENV variables"
time="2024-03-04T00:11:23Z" level=info msg="Injecting chaos on target: {name: ahoy-hello-world-778f6696cb-sqfjp, namespace: litmus, container: hello-world-2}"
time="2024-03-04T00:11:23Z" level=info msg="[Info]: Details of application under chaos injection" RestartCountBefore=49 PodName=ahoy-hello-world-778f6696cb-sqfjp ContainerName=hello-world-2

When I use "ALL" for the container name, I see both the containers in the pod being selected:

time="2024-03-04T00:15:52Z" level=info msg="Helper Name: container-kill"
time="2024-03-04T00:15:52Z" level=info msg="[PreReq]: Getting the ENV variables"
time="2024-03-04T00:15:52Z" level=info msg="Injecting chaos on target: {name: ahoy-hello-world-778f6696cb-sqfjp, namespace: litmus, container: hello-world}"
time="2024-03-04T00:15:52Z" level=info msg="Injecting chaos on target: {name: ahoy-hello-world-778f6696cb-sqfjp, namespace: litmus, container: hello-world-2}"
time="2024-03-04T00:15:52Z" level=info msg="[Info]: Details of application under chaos injection" RestartCountBefore=0 PodName=ahoy-hello-world-778f6696cb-sqfjp ContainerName=hello-world
time="2024-03-04T00:15:52Z" level=info msg="[Info]: Details of application under chaos injection" RestartCountBefore=49 PodName=ahoy-hello-world-778f6696cb-sqfjp ContainerName=hello-world-2
neelanjan00 commented 6 months ago

@MichaelMorrisEst can you please rebase the branch?

MichaelMorrisEst commented 6 months ago

@MichaelMorrisEst can you please rebase the branch?

No problem @neelanjan00 , rebased there now

neelanjan00 commented 6 months ago

@ispeakc0de are we good to merge?