Skip to content

Commit

Permalink
fix: deleted service showing port as missing fix (#4240)
Browse files Browse the repository at this point in the history
* adding nil checks for servicePortMapping, etc while extracting port from manifest

* refactor
  • Loading branch information
prakash100198 committed Nov 17, 2023
1 parent 30122db commit 92fbb5d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/k8s/K8sCommonService.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,19 @@ func (impl K8sCommonServiceImpl) PortNumberExtraction(resp []BatchResourceRespon
}
for key, _type := range value {
if key == k8sCommonBean.Kind && _type == k8sCommonBean.EndpointsKind {
value[k8sCommonBean.Port] = endpointPortMapping[serviceName]
if port, ok := endpointPortMapping[serviceName]; ok {
value[k8sCommonBean.Port] = port
}
}
if key == k8sCommonBean.Kind && _type == k8sCommonBean.ServiceKind {
value[k8sCommonBean.Port] = servicePortMapping[serviceName]
if port, ok := servicePortMapping[serviceName]; ok {
value[k8sCommonBean.Port] = port
}
}
if key == k8sCommonBean.Kind && _type == k8sCommonBean.EndPointsSlice {
value[k8sCommonBean.Port] = endpointSlicePortMapping[serviceName]
if port, ok := endpointSlicePortMapping[serviceName]; ok {
value[k8sCommonBean.Port] = port
}
}
}
}
Expand Down

0 comments on commit 92fbb5d

Please sign in to comment.