@@ -12,6 +12,7 @@ import (
12
12
"github.com/litmuschaos/litmus-go/pkg/probe"
13
13
"github.com/litmuschaos/litmus-go/pkg/status"
14
14
"github.com/litmuschaos/litmus-go/pkg/types"
15
+ "github.com/litmuschaos/litmus-go/pkg/utils/annotation"
15
16
"github.com/litmuschaos/litmus-go/pkg/utils/common"
16
17
"github.com/pkg/errors"
17
18
"github.com/sirupsen/logrus"
@@ -74,8 +75,18 @@ func injectChaosInSerialMode(experimentsDetails *experimentTypes.ExperimentDetai
74
75
return err
75
76
}
76
77
77
- for _ , target := range chaosDetails .ParentsResources {
78
- common .SetTargets (target , "targeted" , chaosDetails .AppDetail .Kind , chaosDetails )
78
+ // deriving the parent name of the target resources
79
+ if chaosDetails .AppDetail .Kind != "" {
80
+ for _ , pod := range targetPodList .Items {
81
+ parentName , err := annotation .GetParentName (clients , pod , chaosDetails )
82
+ if err != nil {
83
+ return err
84
+ }
85
+ common .SetParentName (parentName , chaosDetails )
86
+ }
87
+ for _ , target := range chaosDetails .ParentsResources {
88
+ common .SetTargets (target , "targeted" , chaosDetails .AppDetail .Kind , chaosDetails )
89
+ }
79
90
}
80
91
81
92
if experimentsDetails .ChaoslibDetail .EngineName != "" {
@@ -152,8 +163,18 @@ func injectChaosInParallelMode(experimentsDetails *experimentTypes.ExperimentDet
152
163
return err
153
164
}
154
165
155
- for _ , target := range chaosDetails .ParentsResources {
156
- common .SetTargets (target , "targeted" , chaosDetails .AppDetail .Kind , chaosDetails )
166
+ // deriving the parent name of the target resources
167
+ if chaosDetails .AppDetail .Kind != "" {
168
+ for _ , pod := range targetPodList .Items {
169
+ parentName , err := annotation .GetParentName (clients , pod , chaosDetails )
170
+ if err != nil {
171
+ return err
172
+ }
173
+ common .SetParentName (parentName , chaosDetails )
174
+ }
175
+ for _ , target := range chaosDetails .ParentsResources {
176
+ common .SetTargets (target , "targeted" , chaosDetails .AppDetail .Kind , chaosDetails )
177
+ }
157
178
}
158
179
159
180
if experimentsDetails .ChaoslibDetail .EngineName != "" {
0 commit comments