Skip to content

Commit

Permalink
UPSTREAM: <drop>: Revert "UPSTREAM: <carry>: annotate audit events fo…
Browse files Browse the repository at this point in the history
…r requests during unready phase and graceful termination phase"

This reverts commit 97c75d3.
  • Loading branch information
tkashem committed Feb 17, 2023
1 parent 919a59b commit 85f0f2c
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package server

import (
"fmt"
"net"
"net/http"
"strings"
Expand All @@ -27,7 +26,6 @@ import (
"go.uber.org/atomic"

corev1 "k8s.io/api/core/v1"
"k8s.io/apiserver/pkg/audit"
"k8s.io/klog/v2"
netutils "k8s.io/utils/net"
)
Expand Down Expand Up @@ -82,10 +80,8 @@ func WithLateConnectionFilter(handler http.Handler) http.Handler {
if late {
if pth := "/" + strings.TrimLeft(r.URL.Path, "/"); pth != "/readyz" && pth != "/healthz" && pth != "/livez" {
if isLocal(r) {
audit.AddAuditAnnotation(r.Context(), "openshift.io/during-graceful", fmt.Sprintf("loopback=true,%v,readyz=false", r.URL.Host))
klog.V(4).Infof("Loopback request to %q (user agent %q) through connection created very late in the graceful termination process (more than 80%% has passed). This client probably does not watch /readyz and might get failures when termination is over.", r.URL.Path, r.UserAgent())
} else {
audit.AddAuditAnnotation(r.Context(), "openshift.io/during-graceful", fmt.Sprintf("loopback=false,%v,readyz=false", r.URL.Host))
klog.Warningf("Request to %q (source IP %s, user agent %q) through a connection created very late in the graceful termination process (more than 80%% has passed), possibly a sign for a broken load balancer setup.", r.URL.Path, r.RemoteAddr, r.UserAgent())

// create only one event to avoid event spam.
Expand Down Expand Up @@ -122,11 +118,9 @@ func WithNonReadyRequestLogging(handler http.Handler, hasBeenReadySignal lifecyc
if pth := "/" + strings.TrimLeft(r.URL.Path, "/"); pth != "/readyz" && pth != "/healthz" && pth != "/livez" {
if isLocal(r) {
if !isKubeApiserverLoopBack(r) {
audit.AddAuditAnnotation(r.Context(), "openshift.io/unready", fmt.Sprintf("loopback=true,%v,readyz=false", r.URL.Host))
klog.V(2).Infof("Loopback request to %q (user agent %q) before server is ready. This client probably does not watch /readyz and might get inconsistent answers.", r.URL.Path, r.UserAgent())
}
} else {
audit.AddAuditAnnotation(r.Context(), "openshift.io/unready", fmt.Sprintf("loopback=false,%v,readyz=false", r.URL.Host))
klog.Warningf("Request to %q (source IP %s, user agent %q) before server is ready, possibly a sign for a broken load balancer setup.", r.URL.Path, r.RemoteAddr, r.UserAgent())

// create only one event to avoid event spam.
Expand Down

0 comments on commit 85f0f2c

Please sign in to comment.