@@ -98,7 +98,7 @@ type LogService struct {
98
98
//
99
99
}
100
100
101
- // IP to K8sResource MAp
101
+ // IP to K8sResource Map
102
102
var Ipcache sync.Map
103
103
104
104
// HealthCheck Function
@@ -876,16 +876,15 @@ func startIPInformers(ctx context.Context, wg *sync.WaitGroup) {
876
876
updateIP := func (kind , namespace , name , ip string ) {
877
877
878
878
if ip == "" {
879
- Ipcache .Delete (ip )
880
879
return
881
880
}
882
881
resource := ""
883
882
switch strings .ToUpper (kind ) {
884
883
885
884
case "POD" :
886
- resource = fmt .Sprintf ("%s.%s.pod " , name , namespace )
885
+ resource = fmt .Sprintf ("pod/%s/%s " , namespace , name )
887
886
case "SERVICE" :
888
- resource = fmt .Sprintf ("%s.%s.svc " , name , namespace )
887
+ resource = fmt .Sprintf ("svc/%s/%s " , namespace , name )
889
888
}
890
889
891
890
Ipcache .Store (ip , resource )
@@ -913,8 +912,8 @@ func startIPInformers(ctx context.Context, wg *sync.WaitGroup) {
913
912
if ! ok {
914
913
return
915
914
}
915
+ Ipcache .Delete (pod .Status .PodIP )
916
916
917
- updateIP ("POD" , pod .Namespace , pod .Name , "" )
918
917
},
919
918
})
920
919
@@ -945,7 +944,7 @@ func startIPInformers(ctx context.Context, wg *sync.WaitGroup) {
945
944
if ! ok {
946
945
return
947
946
}
948
- updateIP ( "SERVICE" , svc .Namespace , svc . Name , "" )
947
+ Ipcache . Delete ( svc .Spec . ClusterIP )
949
948
},
950
949
})
951
950
0 commit comments