diff --git a/go.mod b/go.mod index c275be86a4..b8a62b1fdf 100644 --- a/go.mod +++ b/go.mod @@ -21,11 +21,11 @@ require ( k8s.io/client-go v0.33.1 k8s.io/code-generator v0.33.1 knative.dev/caching v0.0.0-20250708014010-99e6352a57b1 - knative.dev/eventing v0.45.1-0.20250708155102-50d5a2666dfb + knative.dev/eventing v0.45.1-0.20250709065003-351613bc3192 knative.dev/hack v0.0.0-20250708013849-70d4b00da6ba - knative.dev/pkg v0.0.0-20250708013613-d3550d4350f9 + knative.dev/pkg v0.0.0-20250710001404-a4cc1bdef5b2 knative.dev/reconciler-test v0.0.0-20250708152404-d97d9007b8d3 - knative.dev/serving v0.45.1-0.20250709011302-dc0034928a36 + knative.dev/serving v0.45.1-0.20250710161811-c65e780e017d sigs.k8s.io/yaml v1.5.0 ) @@ -162,7 +162,7 @@ require ( k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect - knative.dev/networking v0.0.0-20250707164707-14e7b4882ada // indirect + knative.dev/networking v0.0.0-20250708014646-f8c92385906a // indirect sigs.k8s.io/controller-runtime v0.19.0 // indirect sigs.k8s.io/gateway-api v1.1.0 // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect diff --git a/go.sum b/go.sum index 59acb3b04f..400522aafb 100644 --- a/go.sum +++ b/go.sum @@ -1731,18 +1731,18 @@ k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJ k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/caching v0.0.0-20250708014010-99e6352a57b1 h1:XwdZn/BhNpy0Gfo9kd4JH5UDqcKmNGsUhEgcbKC+4yw= knative.dev/caching v0.0.0-20250708014010-99e6352a57b1/go.mod h1:h2I9IN6loLDQ6uUEpK20tlBds/xqeNfgW6uF5RDeBgk= -knative.dev/eventing v0.45.1-0.20250708155102-50d5a2666dfb h1:cmfDTbxBGabYUgZZpJl+epYOn1XsDDRdAU08jYcBOr4= -knative.dev/eventing v0.45.1-0.20250708155102-50d5a2666dfb/go.mod h1:w5L38I+/IPH4l/6F0peYgqAFmKIwZgKJSQp+gQjdU/E= +knative.dev/eventing v0.45.1-0.20250709065003-351613bc3192 h1:w7RqueP9vzi4kovE+CbtZlXMUXkAoEJ3xVNzmY1Mdi8= +knative.dev/eventing v0.45.1-0.20250709065003-351613bc3192/go.mod h1:CzplbX3BjQ/1glhP1XL20baAttmcZCDd8q9Jg3TwzwY= knative.dev/hack v0.0.0-20250708013849-70d4b00da6ba h1:PkOTBI8DRfvUKD8HTvYYT94NJ49J++llrDo3y0/ZAwc= knative.dev/hack v0.0.0-20250708013849-70d4b00da6ba/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY= -knative.dev/networking v0.0.0-20250707164707-14e7b4882ada h1:5e4ty93xKfzxYad1/lk+H8y4VMfnlqObJ6qGPsXdW6M= -knative.dev/networking v0.0.0-20250707164707-14e7b4882ada/go.mod h1:2oJaAUdMvfOYiMDCVaHUvmD+Vx7qpm1QPjtyf7yLWts= -knative.dev/pkg v0.0.0-20250708013613-d3550d4350f9 h1:yCiThjArNgVjRbyBGvRvYr/B6G3djvr5pXrh8MXfnsk= -knative.dev/pkg v0.0.0-20250708013613-d3550d4350f9/go.mod h1:I2vWm0knRQH2WBfpIAkRzOPk0XoXxfu8YJT63ddYWd4= +knative.dev/networking v0.0.0-20250708014646-f8c92385906a h1:svYrI9zSPhZXNdQ3Id5syQAuZvpIevBOCPfUN6lWjso= +knative.dev/networking v0.0.0-20250708014646-f8c92385906a/go.mod h1:2oJaAUdMvfOYiMDCVaHUvmD+Vx7qpm1QPjtyf7yLWts= +knative.dev/pkg v0.0.0-20250710001404-a4cc1bdef5b2 h1:PH7kUY1glZNfo2aUp+rEsoWUeN49NgVmSwuEJvIKzqQ= +knative.dev/pkg v0.0.0-20250710001404-a4cc1bdef5b2/go.mod h1:I2vWm0knRQH2WBfpIAkRzOPk0XoXxfu8YJT63ddYWd4= knative.dev/reconciler-test v0.0.0-20250708152404-d97d9007b8d3 h1:IoFGGv7wWIHRJ5vPkcKCII9MMQEJ/ARUp1qZg7QdfLA= knative.dev/reconciler-test v0.0.0-20250708152404-d97d9007b8d3/go.mod h1:5PaPJka37JwlDQUQD3yHpHZLs0BOW8Ahz3mRNgXeoqw= -knative.dev/serving v0.45.1-0.20250709011302-dc0034928a36 h1:S3PVZtr8RFxPokoK/U36ztIHo3ABjgM1SwC2AY/w7k8= -knative.dev/serving v0.45.1-0.20250709011302-dc0034928a36/go.mod h1:hqtNgKZIi/gAPRwMl5QSdCKYokcGCIaG2ARlFkQ3dlQ= +knative.dev/serving v0.45.1-0.20250710161811-c65e780e017d h1:bAKkcS8A6DYNrfzY8WCFuxR5Lh9ST5dB/YIpTXHAMbE= +knative.dev/serving v0.45.1-0.20250710161811-c65e780e017d/go.mod h1:hXjH0XGC1ISNiXcIcVlbGqMfib7CJgZ1HT7phnykG1E= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= diff --git a/vendor/knative.dev/pkg/profiling/server.go b/vendor/knative.dev/pkg/profiling/server.go deleted file mode 100644 index 9eceef51cb..0000000000 --- a/vendor/knative.dev/pkg/profiling/server.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2019 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package profiling - -import ( - "fmt" - "net/http" - "net/http/pprof" - "os" - "strconv" - "sync/atomic" - "time" - - "go.uber.org/zap" - corev1 "k8s.io/api/core/v1" -) - -const ( - // ProfilingPortKey specified the name of an environment variable that - // may be used to override the default profiling port. - ProfilingPortKey = "PROFILING_PORT" - - // ProfilingPort specifies the default port where profiling data is available when profiling is enabled - ProfilingPort = 8008 - - // profilingKey is the name of the key in config-observability config map - // that indicates whether profiling is enabled - profilingKey = "profiling.enable" -) - -// Handler holds the main HTTP handler and a flag indicating -// whether the handler is active -type Handler struct { - enabled *atomic.Bool - handler http.Handler - log *zap.SugaredLogger -} - -// NewHandler create a new ProfilingHandler which serves runtime profiling data -// according to the given context path -func NewHandler(logger *zap.SugaredLogger, enableProfiling bool) *Handler { - const pprofPrefix = "/debug/pprof/" - - mux := http.NewServeMux() - mux.HandleFunc(pprofPrefix, pprof.Index) - mux.HandleFunc(pprofPrefix+"cmdline", pprof.Cmdline) - mux.HandleFunc(pprofPrefix+"profile", pprof.Profile) - mux.HandleFunc(pprofPrefix+"symbol", pprof.Symbol) - mux.HandleFunc(pprofPrefix+"trace", pprof.Trace) - - logger.Info("Profiling enabled: ", enableProfiling) - var enabled atomic.Bool - enabled.Store(enableProfiling) - - return &Handler{ - enabled: &enabled, - handler: mux, - log: logger, - } -} - -func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if h.enabled.Load() { - h.handler.ServeHTTP(w, r) - } else { - http.NotFoundHandler().ServeHTTP(w, r) - } -} - -func ReadProfilingFlag(config map[string]string) (bool, error) { - profiling, ok := config[profilingKey] - if !ok { - return false, nil - } - enabled, err := strconv.ParseBool(profiling) - if err != nil { - return false, fmt.Errorf("failed to parse the profiling flag: %w", err) - } - return enabled, nil -} - -// UpdateFromConfigMap modifies the Enabled flag in the Handler -// according to the value in the given ConfigMap -func (h *Handler) UpdateFromConfigMap(configMap *corev1.ConfigMap) { - enabled, err := ReadProfilingFlag(configMap.Data) - if err != nil { - h.log.Errorw("Failed to update the profiling flag", zap.Error(err)) - return - } - - if h.enabled.Swap(enabled) != enabled { - h.log.Info("Profiling enabled: ", enabled) - } -} - -// NewServer creates a new http server that exposes profiling data on the default profiling port -func NewServer(handler http.Handler) *http.Server { - port := os.Getenv(ProfilingPortKey) - if port == "" { - port = strconv.Itoa(ProfilingPort) - } - - return &http.Server{ - Addr: ":" + port, - Handler: handler, - ReadHeaderTimeout: time.Minute, // https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6 - } -} diff --git a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go index 496008f2d9..6642fb21f8 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go @@ -29,7 +29,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation" "knative.dev/pkg/apis" - "knative.dev/pkg/profiling" + "knative.dev/pkg/observability/runtime" "knative.dev/serving/pkg/apis/config" "knative.dev/serving/pkg/networking" ) @@ -63,7 +63,7 @@ var ( networking.QueueAdminPort, networking.AutoscalingQueueMetricsPort, networking.UserQueueMetricsPort, - profiling.ProfilingPort) + runtime.ProfilingDefaultPort) reservedSidecarEnvVars = reservedEnvVars.Difference(sets.New("PORT")) diff --git a/vendor/modules.txt b/vendor/modules.txt index d5b9e0af4e..6bddbc065c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1483,7 +1483,7 @@ k8s.io/utils/trace ## explicit; go 1.24.0 knative.dev/caching/pkg/apis/caching knative.dev/caching/pkg/apis/caching/v1alpha1 -# knative.dev/eventing v0.45.1-0.20250708155102-50d5a2666dfb +# knative.dev/eventing v0.45.1-0.20250709065003-351613bc3192 ## explicit; go 1.24.0 knative.dev/eventing/cmd/heartbeats knative.dev/eventing/pkg/apis @@ -1577,7 +1577,7 @@ knative.dev/eventing/test/upgrade/prober/wathola/sender # knative.dev/hack v0.0.0-20250708013849-70d4b00da6ba ## explicit; go 1.21 knative.dev/hack -# knative.dev/networking v0.0.0-20250707164707-14e7b4882ada +# knative.dev/networking v0.0.0-20250708014646-f8c92385906a ## explicit; go 1.24.0 knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking @@ -1594,7 +1594,7 @@ knative.dev/networking/pkg/http/proxy knative.dev/networking/pkg/http/stats knative.dev/networking/pkg/ingress knative.dev/networking/pkg/k8s -# knative.dev/pkg v0.0.0-20250708013613-d3550d4350f9 +# knative.dev/pkg v0.0.0-20250710001404-a4cc1bdef5b2 ## explicit; go 1.24.0 knative.dev/pkg/apiextensions/storageversion knative.dev/pkg/apiextensions/storageversion/cmd/migrate @@ -1658,7 +1658,6 @@ knative.dev/pkg/observability/resource knative.dev/pkg/observability/runtime knative.dev/pkg/observability/runtime/k8s knative.dev/pkg/observability/tracing -knative.dev/pkg/profiling knative.dev/pkg/ptr knative.dev/pkg/reconciler knative.dev/pkg/resolver @@ -1720,7 +1719,7 @@ knative.dev/reconciler-test/pkg/resources/service knative.dev/reconciler-test/pkg/resources/serviceaccount knative.dev/reconciler-test/pkg/state knative.dev/reconciler-test/resources/certificate -# knative.dev/serving v0.45.1-0.20250709011302-dc0034928a36 +# knative.dev/serving v0.45.1-0.20250710161811-c65e780e017d ## explicit; go 1.24.0 knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1