discovery/kubernetes: issue overcapacity warning for endpoint rather than endpointslice

Signed-off-by: akatsadimas <nkatsadim@gmail.com>
This commit is contained in:
akatsadimas 2021-10-08 23:17:04 +03:00
parent dd2e666a8d
commit ee77a6212f
2 changed files with 8 additions and 8 deletions

View File

@ -308,6 +308,14 @@ func (e *Endpoints) buildEndpoints(eps *apiv1.Endpoints) *targetgroup.Group {
} }
} }
v := eps.Labels[apiv1.EndpointsOverCapacity]
if v == "truncated" {
level.Warn(e.logger).Log("msg", "Number of endpoints in one Endpoints object exceeds 1000 and has been truncated, please use \"role: endpointslice\" instead", "endpoint", eps.Name)
}
if v == "warning" {
level.Warn(e.logger).Log("msg", "Number of endpoints in one Endpoints object exceeds 1000, please use \"role: endpointslice\" instead", "endpoint", eps.Name)
}
// For all seen pods, check all container ports. If they were not covered // For all seen pods, check all container ports. If they were not covered
// by one of the service endpoints, generate targets for them. // by one of the service endpoints, generate targets for them.
for _, pe := range seenPods { for _, pe := range seenPods {

View File

@ -322,14 +322,6 @@ func (e *EndpointSlice) buildEndpointSlice(eps *disv1beta1.EndpointSlice) *targe
} }
} }
v := eps.Labels[apiv1.EndpointsOverCapacity]
if v == "truncated" {
level.Warn(e.logger).Log("msg", "Number of endpoints in one Endpoints object truncated to 1000", "endpoint", eps.Name)
}
if v == "warning" {
level.Warn(e.logger).Log("msg", "Number of endpoints in one Endpoints object exceeds 1000", "endpoint", eps.Name)
}
// For all seen pods, check all container ports. If they were not covered // For all seen pods, check all container ports. If they were not covered
// by one of the service endpoints, generate targets for them. // by one of the service endpoints, generate targets for them.
for _, pe := range seenPods { for _, pe := range seenPods {