Skip to content

Commit

Permalink
upgrade to latest dependencies (#1305)
Browse files Browse the repository at this point in the history
bumping knative.dev/networking 2002961...a3d8b0f:
  > a3d8b0f Replace all usages of deprecated wait.PollImmediate with wait.PollUntilContextTimeout (# 957)
  > 1a6e0da some conformance tests assume we're getting back a runtime request (# 964)
  > 2a4859c this fixes the probe handler to reflect that it doesn't care about the path (# 963)
  > b321831 upgrade to latest dependencies (# 962)

Signed-off-by: Knative Automation <automation@knative.team>
  • Loading branch information
knative-automation committed Apr 11, 2024
1 parent 846d5a1 commit b41987e
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
k8s.io/apimachinery v0.29.2
k8s.io/client-go v0.29.2
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7
knative.dev/networking v0.0.0-20240410133143-200296131672
knative.dev/networking v0.0.0-20240410205709-a3d8b0fc9cd2
knative.dev/pkg v0.0.0-20240409141558-1ff9a77566f6
sigs.k8s.io/yaml v1.4.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7 h1:fkWYWvdHm1mVHevKW2vVJnZtxH0NzOlux8imesweKwE=
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20240410133143-200296131672 h1:BGHRJN0RzLbB+HMUUUDWLd5ShzLRl+Pk1OV6mMQCqCs=
knative.dev/networking v0.0.0-20240410133143-200296131672/go.mod h1:m9aH65g5JGuwhH6moqAmF0+X6PvIQwElVx5dw2+jDno=
knative.dev/networking v0.0.0-20240410205709-a3d8b0fc9cd2 h1:W8M/cxPYUOIjNcwQ3w2Il/qlYKpZBPJ89ysTr5MTI/A=
knative.dev/networking v0.0.0-20240410205709-a3d8b0fc9cd2/go.mod h1:yXbBRuzGKDkHSdvqUT7/1j9br5gkJL9LAyxpHfcF3h8=
knative.dev/pkg v0.0.0-20240409141558-1ff9a77566f6 h1:jJVStFc+y8c7veKYDyQFwQTod+w5pzZqopz/nLH2dJo=
knative.dev/pkg v0.0.0-20240409141558-1ff9a77566f6/go.mod h1:ZWUA+Z6zFI93VyExtnH0P5JtVQ0TvWpKvbxtFvmRJ9I=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/networking/pkg/prober/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (m *Manager) doAsync(ctx context.Context, target string, arg interface{}, p
result bool
inErr error
)
err := wait.PollImmediate(period, timeout, func() (bool, error) {
err := wait.PollUntilContextTimeout(ctx, period, timeout, true, func(ctx context.Context) (bool, error) {
result, inErr = Do(ctx, m.transport, target, ops...)
// Do not return error, which is from verifierError, as retry is expected until timeout.
return result, nil
Expand Down
26 changes: 15 additions & 11 deletions vendor/knative.dev/networking/test/conformance/ingress/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,25 @@ func TestProbeHeaders(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

ros := []RequestOption{}
req, err := http.NewRequest("GET", fmt.Sprintf("http://%s.%s", name, test.NetworkingFlags.ServiceDomain), nil)
if err != nil {
t.Fatal("Error creating request:", err)
}
req.Header.Set(header.ProbeKey, header.ProbeValue)
req.Header.Set(header.HashKey, tt.req)

ros = append(ros, func(r *http.Request) {
// Add the header to indicate this is a probe request.
r.Header.Set(header.ProbeKey, header.ProbeValue)
r.Header.Set(header.HashKey, tt.req)
})
resp, err := client.Do(req)
if err != nil {
t.Fatal("Error making GET request:", err)
}
defer resp.Body.Close()

ri := RuntimeRequest(ctx, t, client, "http://"+name+"."+test.NetworkingFlags.ServiceDomain, ros...)
if ri == nil {
t.Error("Couldn't make request")
return
if resp.StatusCode != http.StatusOK {
t.Errorf("Unexpected status code: %d, wanted %d", resp.StatusCode, http.StatusOK)
DumpResponse(ctx, t, resp)
}

if got, want := ri.Request.Headers.Get(header.HashKey), tt.want; got != want {
if got, want := resp.Header.Get(header.HashKey), tt.want; got != want {
t.Errorf("Header[%q] = %q, wanted %q", header.HashKey, got, want)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ func createPodAndService(ctx context.Context, t *testing.T, clients *test.Client
}

// Wait for the Pod to show up in the Endpoints resource.
waitErr := wait.PollImmediate(test.PollInterval, test.PollTimeout, func() (bool, error) {
waitErr := wait.PollUntilContextTimeout(ctx, test.PollInterval, test.PollTimeout, true, func(ctx context.Context) (bool, error) {
var ep *corev1.Endpoints
err := reconciler.RetryTestErrors(func(attempts int) (err error) {
ep, err = clients.KubeClient.CoreV1().Endpoints(svc.Namespace).Get(ctx, svc.Name, metav1.GetOptions{})
Expand Down Expand Up @@ -1212,7 +1212,7 @@ func WaitForIngressState(ctx context.Context, client *test.NetworkingClients, na
defer span.End()

var lastState *v1alpha1.Ingress
waitErr := wait.PollImmediate(test.PollInterval, test.PollTimeout, func() (bool, error) {
waitErr := wait.PollUntilContextTimeout(ctx, test.PollInterval, test.PollTimeout, true, func(ctx context.Context) (bool, error) {
err := reconciler.RetryTestErrors(func(attempts int) (err error) {
lastState, err = client.Ingresses.Get(ctx, name, metav1.GetOptions{})
return err
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/networking/test/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func WaitForIngressState(ctx context.Context, client *NetworkingClients, name st
defer span.End()

var lastState *v1alpha1.Ingress
waitErr := wait.PollImmediate(PollInterval, PollTimeout, func() (bool, error) {
waitErr := wait.PollUntilContextTimeout(ctx, PollInterval, PollTimeout, true, func(ctx context.Context) (bool, error) {
var err error
lastState, err = client.Ingresses.Get(ctx, name, metav1.GetOptions{})
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ import (
"strings"

nethttp "knative.dev/networking/pkg/http"
"knative.dev/networking/pkg/http/probe"
"knative.dev/pkg/network"
)

// InitHandlers initializes all handlers.
func InitHandlers(mux *http.ServeMux) {
mux.HandleFunc("/", withHeaders(withRequestLog(runtimeHandler)))

h := probe.NewHandler(withRequestLog(withKubeletProbeHeaderCheck))
mux.HandleFunc(nethttp.HealthCheckPath, h.ServeHTTP)
mux.HandleFunc(nethttp.HealthCheckPath, withRequestLog(withKubeletProbeHeaderCheck))
}

// withRequestLog logs each request before handling it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net/http"
"os"

"knative.dev/networking/pkg/http/probe"
"knative.dev/networking/test"
"knative.dev/networking/test/test_images/runtime/handlers"
)
Expand All @@ -48,11 +49,13 @@ func main() {
mux := http.NewServeMux()
handlers.InitHandlers(mux)

h := probe.NewHandler(mux)

if cert, key := os.Getenv("CERT"), os.Getenv("KEY"); cert != "" && key != "" {
log.Print("Server starting on port with TLS ", port)
test.ListenAndServeTLSGracefullyWithHandler(cert, key, ":"+port, mux)
test.ListenAndServeTLSGracefullyWithHandler(cert, key, ":"+port, h)
} else {
log.Print("Server starting on port ", port)
test.ListenAndServeGracefullyWithHandler(":"+port, mux)
test.ListenAndServeGracefullyWithHandler(":"+port, h)
}
}
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ k8s.io/utils/trace
# knative.dev/hack v0.0.0-20240404013450-1133b37da8d7
## explicit; go 1.18
knative.dev/hack
# knative.dev/networking v0.0.0-20240410133143-200296131672
# knative.dev/networking v0.0.0-20240410205709-a3d8b0fc9cd2
## explicit; go 1.21
knative.dev/networking/config
knative.dev/networking/pkg
Expand Down

0 comments on commit b41987e

Please sign in to comment.