litmuschaos / litmus-go

Apache License 2.0
66 stars 118 forks source link

pod-delete - TARGET_SELECTION_ERROR with custom parent Kind #698

Closed andrusha19 closed 3 months ago

andrusha19 commented 4 months ago

This is a BUG report

What happened: I use pod-delete experiment and my parent resource definition is custom (StrimziPodSet in my case) So when experiment starts - it deletes pod, but then failes to verify recovering Here are some parameters (i tried to play with different values to get it work, but failed):

` metadata: name: kafka-pod-delete namespace: kafka-external spec: engineState: active annotationCheck: "false" appinfo: appns: "kafka-external" applabel: "statefulset.kubernetes.io/pod-name=odf-cluster-kafka-0" appkind: "statefulset" chaosServiceAccount: general-sa experiments:

I tried to use "statefulset:kafka-external:odf-cluster-kafka", "statefulset:kafka-external:odf-cluster-kafka-0" as TARGETS (and other variants), but it fails What you expected to happen: Verification of pod recovering should work

What I see in code: https://github.com/litmuschaos/litmus-go/blob/master/pkg/workloads/workloads.go#L73 In this method it tried to get pod owner type and name. But if it's a custom "Kind" - it will return an empty "parentType" And after that here: https://github.com/litmuschaos/litmus-go/blob/master/pkg/workloads/workloads.go#L58 it will fail as "ownerType" is empty

Here is a full log from helper pod: time="2024-04-30T10:18:06Z" level=info msg="Experiment Name: pod-delete" time="2024-04-30T10:18:06Z" level=info msg="[PreReq]: Getting the ENV for the pod-delete experiment" time="2024-04-30T10:18:08Z" level=info msg="[PreReq]: Updating the chaos result of pod-delete experiment (SOT)" time="2024-04-30T10:18:10Z" level=info msg="The application information is as follows" Targets="[{namespace: kafka-external, kind: strimzipodset, names: [odf-cluster-kafka]}]" Chaos Duration=50 time="2024-04-30T10:18:12Z" level=info msg="[Info]: The chaos tunables are:" PodsAffectedPerc=0 Sequence=parallel time="2024-04-30T10:18:14Z" level=info msg="[Chaos]:Number of pods targeted: 1" time="2024-04-30T10:18:14Z" level=info msg="Target pods list for chaos, [odf-cluster-kafka-0]" time="2024-04-30T10:18:14Z" level=info msg="[Info]: Killing the following pods" PodName=odf-cluster-kafka-0 time="2024-04-30T10:18:14Z" level=info msg="[Wait]: Wait for the chaos interval 10s" time="2024-04-30T10:18:24Z" level=info msg="[Status]: Verification for the recreation of application pod" time="2024-04-30T10:18:24Z" level=error msg="Chaos injection failed, err: could not run chaos in parallel mode\n --- at /litmus-go/chaoslib/litmus/pod-delete/lib/pod-delete.go:50 (PreparePodDelete) ---\nCaused by: could not check pod statuses by workload names\n --- at /litmus-go/chaoslib/litmus/pod-delete/lib/pod-delete.go:244 (injectChaosInParallelMode) ---\nCaused by: could not get pods by workload names\n --- at /litmus-go/pkg/status/application.go:330 (CheckUnTerminatedPodStatusesByWorkloadName) ---\nCaused by: {\"errorCode\":\"TARGET_SELECTION_ERROR\",\"reason\":\"no pod found for specified target\",\"target\":\"{namespace: kafka-external, kind: , name: odf-cluster-kafka}\"}"

As you can see - "kind" is empty