Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kafka Experiment to support version 3.x and newer #485

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/kafka/kafka-liveness-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func LivenessStream(experimentsDetails *experimentTypes.ExperimentDetails, clien
if experimentsDetails.KafkaInstanceName == "" {

execCommandDetails := litmusexec.PodDetails{}
command := append([]string{"/bin/sh", "-c"}, "kafka-topics --topic topic-"+experimentsDetails.RunID+" --describe --zookeeper "+experimentsDetails.ZookeeperService+":"+experimentsDetails.ZookeeperPort+" | grep -o 'Leader: [^[:space:]]*' | awk '{print $2}'")
command := append([]string{"/bin/sh", "-c"}, "kafka-topics --topic topic-"+experimentsDetails.RunID+" --describe --boostrap-server "+experimentsDetails.KafkaService+":"+experimentsDetails.KafkaPort+" | grep -o 'Leader: [^[:space:]]*' | awk '{print $2}'")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command := append([]string{"/bin/sh", "-c"}, "kafka-topics --topic topic-"+experimentsDetails.RunID+" --describe --boostrap-server "+experimentsDetails.KafkaService+":"+experimentsDetails.KafkaPort+" | grep -o 'Leader: [^[:space:]]*' | awk '{print $2}'")
command := append([]string{"/bin/sh", "-c"}, "kafka-topics --topic topic-"+experimentsDetails.RunID+" --describe --bootstrap-server "+experimentsDetails.KafkaService+":"+experimentsDetails.KafkaPort+" | grep -o 'Leader: [^[:space:]]*' | awk '{print $2}'")

litmusexec.SetExecCommandAttributes(&execCommandDetails, "kafka-liveness-"+experimentsDetails.RunID, "kafka-consumer", experimentsDetails.KafkaNamespace)
ordinality, err = litmusexec.Exec(&execCommandDetails, clients, command)
if err != nil {
Expand All @@ -50,7 +50,7 @@ func LivenessStream(experimentsDetails *experimentTypes.ExperimentDetails, clien
// It will contains all the pod & container details required for exec command
execCommandDetails := litmusexec.PodDetails{}

command := append([]string{"/bin/sh", "-c"}, "kafka-topics --topic topic-"+experimentsDetails.RunID+" --describe --zookeeper "+experimentsDetails.ZookeeperService+":"+experimentsDetails.ZookeeperPort+"/"+experimentsDetails.KafkaInstanceName+" | grep -o 'Leader: [^[:space:]]*' | awk '{print $2}'")
command := append([]string{"/bin/sh", "-c"}, "kafka-topics --topic topic-"+experimentsDetails.RunID+" --describe --bootstrap-server "+experimentsDetails.KafkaService+":"+experimentsDetails.KafkaPort+"/"+experimentsDetails.KafkaInstanceName+" | grep -o 'Leader: [^[:space:]]*' | awk '{print $2}'")
litmusexec.SetExecCommandAttributes(&execCommandDetails, "kafka-liveness-"+experimentsDetails.RunID, "kafka-consumer", experimentsDetails.KafkaNamespace)
ordinality, err = litmusexec.Exec(&execCommandDetails, clients, command)
if err != nil {
Expand Down Expand Up @@ -109,12 +109,12 @@ func CreateLivenessPod(experimentsDetails *experimentTypes.ExperimentDetails, Ka
Value: experimentsDetails.KafkaInstanceName,
},
{
Name: "ZOOKEEPER_SERVICE",
Value: experimentsDetails.ZookeeperService,
Name: "KAFKA_SERVICE",
Value: experimentsDetails.KafkaService,
},
{
Name: "ZOOKEEPER_PORT",
Value: experimentsDetails.ZookeeperPort,
Name: "KAFKA_PORT",
Value: experimentsDetails.KafkaPort,
},
{
Name: "REPLICATION_FACTOR",
Expand Down