Skip to content

Commit c7228f8

Browse files
committed
🐛 Call the callback method which is UpdateTargets
1 parent 1478969 commit c7228f8

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

pkg/kubernetes/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"k8s.io/client-go/rest"
88
)
99

10-
func NewFromInCluster(errOut chan error, callback func(pods *[]v1.Pod) error) *Watcher {
10+
func NewFromInCluster(errOut chan error, callback func(pods []v1.Pod) error) *Watcher {
1111
config, err := rest.InClusterConfig()
1212
if err != nil {
1313
log.Warn().Err(err).Send()

pkg/kubernetes/target.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func updateCurrentlyTargetedPods(
109109
clientSet *kubernetes.Clientset,
110110
regex *regexp.Regexp,
111111
namespaces []string,
112-
callback func(pods *[]v1.Pod) error,
112+
callback func(pods []v1.Pod) error,
113113
) (err error, changesFound bool) {
114114
if matchingPods, err := listAllRunningPodsMatchingRegex(ctx, clientSet, regex, namespaces); err != nil {
115115
return err, false
@@ -125,6 +125,7 @@ func updateCurrentlyTargetedPods(
125125

126126
if len(addedPods) > 0 || len(removedPods) > 0 {
127127
SetTargetedPods(podsToTarget)
128+
callback(podsToTarget)
128129
}
129130
return nil, false
130131
}

pkg/kubernetes/watcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Watcher struct {
2121
namespaces []string
2222
isStarted bool
2323
errOut chan error
24-
callback func(pods *[]v1.Pod) error
24+
callback func(pods []v1.Pod) error
2525
}
2626

2727
func (watcher *Watcher) Start(ctx context.Context, clusterMode bool) {

tls_process_discoverer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
var numberRegex = regexp.MustCompile("[0-9]+")
1919

20-
func UpdateTargets(pods *[]v1.Pod) error {
20+
func UpdateTargets(pods []v1.Pod) error {
2121
containerIds := buildContainerIdsMap(pods)
2222
containerPids, err := findContainerPids(tracer.procfs, containerIds)
2323

@@ -87,10 +87,10 @@ func findContainerPids(procfs string, containerIds map[string]v1.Pod) (map[uint3
8787
return result, nil
8888
}
8989

90-
func buildContainerIdsMap(pods *[]v1.Pod) map[string]v1.Pod {
90+
func buildContainerIdsMap(pods []v1.Pod) map[string]v1.Pod {
9191
result := make(map[string]v1.Pod)
9292

93-
for _, pod := range *pods {
93+
for _, pod := range pods {
9494
for _, container := range pod.Status.ContainerStatuses {
9595
parsedUrl, err := url.Parse(container.ContainerID)
9696

0 commit comments

Comments
 (0)