Skip to content

Commit 5b85f3f

Browse files
committed
cleanup
Signed-off-by: jukie <10012479+Jukie@users.noreply.github.com>
1 parent 9744c51 commit 5b85f3f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

internal/provider/kubernetes/topology_injector.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,11 @@ func (m *ProxyTopologyInjector) Handle(ctx context.Context, req admission.Reques
4949
}
5050

5151
pod := &corev1.Pod{}
52-
if getErr := m.Get(ctx, podName, pod); getErr != nil {
52+
if err := m.Get(ctx, podName, pod); err != nil {
5353
// Cache isn't guaranteed to be updated yet so if m.Get() fails
5454
// try getting the pod from API server directly.
55-
if m.APIReader != nil {
56-
if err := m.APIReader.Get(ctx, podName, pod); err != nil {
57-
logger.Error(err, "apiReader get pod failed", "pod", podName.String())
58-
topologyInjectorEventsTotal.WithFailure(metrics.ReasonError).Increment()
59-
return admission.Allowed("internal error, skipped")
60-
}
61-
} else {
62-
logger.Error(getErr, "get pod failed", "pod", podName.String())
55+
if err := m.APIReader.Get(ctx, podName, pod); err != nil {
56+
logger.Error(err, "get pod failed", "pod", podName.String())
6357
topologyInjectorEventsTotal.WithFailure(metrics.ReasonError).Increment()
6458
return admission.Allowed("internal error, skipped")
6559
}

0 commit comments

Comments
 (0)