Skip to content

Commit

Permalink
Merge pull request #142 from traas-stack/dev/v0.6.1
Browse files Browse the repository at this point in the history
Dev/v0.6.1
  • Loading branch information
KingsonKai authored Jan 8, 2024
2 parents 6e76c88 + 2300ed4 commit 2c34255
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions chaosmeta-inject-operator/pkg/scopehandler/pod/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ func getPodObjectList(ctx context.Context, selectorUnit v1alpha1.SelectorUnit) (

var result = make([]model.AtomicObject, 0)
for _, pod := range podList {
for _, subObject := range pod.GetSubObjects() {
result = append(result, &subObject)
subObjects := pod.GetSubObjects()
for i, _ := range subObjects {
result = append(result, &subObjects[i])
}
}

Expand Down
7 changes: 4 additions & 3 deletions chaosmeta-inject-operator/pkg/selector/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import (
)

const (
HostIPKey = ".status.hostIP"
PhaseKey = ".status.phase"
HostIPKey = ".status.hostIP"
PhaseKey = ".status.phase"
containerRegFmt = "^(%s)$"
)

var (
Expand Down Expand Up @@ -227,7 +228,6 @@ func GetTargetContainers(containerReg string, status []corev1.ContainerStatus) (
return
}
containerReg = strings.ReplaceAll(containerReg, ",", "|")
reg := regexp.MustCompile(containerReg)
containers = []model.ContainerInfo{}
var targetContainerInfo corev1.ContainerStatus
// no container setting equals to firstcontainer setting
Expand All @@ -239,6 +239,7 @@ func GetTargetContainers(containerReg string, status []corev1.ContainerStatus) (
}
containers = append(containers, *info)
} else {
reg := regexp.MustCompile(fmt.Sprintf(containerRegFmt, containerReg))
for _, containerStatus := range status {
if reg.MatchString(containerStatus.Name) {
info, err := getContainerInfo(containerStatus)
Expand Down

0 comments on commit 2c34255

Please sign in to comment.