Merge branch 'main' into feat/add-skip-tls-verify

This commit is contained in:
ilia-medvedev-codefresh 2025-06-17 15:16:03 +03:00 committed by GitHub
commit 206649de31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 29 additions and 10 deletions

View File

@ -21,5 +21,6 @@ jobs:
with:
paths: "**/*.md"
markdown: true
concurrency: 1
retry: true
linksToSkip: "https://github.com/kedacore/http-add-on/pkgs/container/http-add-on-interceptor, https://github.com/kedacore/http-add-on/pkgs/container/http-add-on-operator, https://github.com/kedacore/http-add-on/pkgs/container/http-add-on-scaler,http://opentelemetry-collector.open-telemetry-system:4318,http://opentelemetry-collector.open-telemetry-system:4318/v1/traces, https://www.gnu.org/software/make/"

View File

@ -26,7 +26,7 @@ linters:
- unconvert
- ineffassign
- staticcheck
- exportloopref
- copyloopvar
#- depguard #https://github.com/kedacore/keda/issues/4980
- dogsled
- errcheck

View File

@ -27,6 +27,7 @@ This changelog keeps track of work items that have been completed and are ready
- **General**: Add configurable tracing support to the interceptor proxy ([#1021](https://github.com/kedacore/http-add-on/pull/1021))
- **General**: Allow using HSO and SO with different names ([#1293](https://github.com/kedacore/http-add-on/issues/1293))
- **General**: Support profiling for KEDA components ([#4789](https://github.com/kedacore/keda/issues/4789))
### Improvements

View File

@ -47,6 +47,8 @@ type Serving struct {
TLSSkipVerify bool `envconfig:"KEDA_HTTP_PROXY_TLS_SKIP_VERIFY" default:"false"`
// TLSPort is the port that the server should serve on if TLS is enabled
TLSPort int `envconfig:"KEDA_HTTP_PROXY_TLS_PORT" default:"8443"`
// ProfilingAddr if not empty, pprof will be available on this address, assuming host:port here
ProfilingAddr string `envconfig:"PROFILING_BIND_ADDRESS" default:""`
}
// Parse parses standard configs using envconfig and returns a pointer to the

View File

@ -8,6 +8,7 @@ import (
"flag"
"fmt"
"net/http"
_ "net/http/pprof"
"os"
"path/filepath"
"runtime"
@ -81,6 +82,7 @@ func main() {
proxyPort := servingCfg.ProxyPort
adminPort := servingCfg.AdminPort
proxyTLSEnabled := servingCfg.ProxyTLSEnabled
profilingAddr := servingCfg.ProfilingAddr
// setup the configured metrics collectors
metrics.NewMetricsCollectors(metricsCfg)
@ -218,6 +220,13 @@ func main() {
return nil
})
if len(profilingAddr) > 0 {
eg.Go(func() error {
setupLog.Info("enabling pprof for profiling", "address", profilingAddr)
return http.ListenAndServe(profilingAddr, nil)
})
}
build.PrintComponentInfo(ctrl.Log, "Interceptor")
if err := eg.Wait(); err != nil && !errors.Is(err, context.Canceled) {

View File

@ -57,11 +57,13 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var profilingAddr string
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&profilingAddr, "profiling-bind-address", "", "The address the profiling would be exposed on.")
opts := zap.Options{
Development: true,
}
@ -96,6 +98,7 @@ func main() {
Metrics: server.Options{
BindAddress: metricsAddr,
},
PprofBindAddress: profilingAddr,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "http-add-on.keda.sh",

View File

@ -57,7 +57,6 @@ func TestGetEndpoints(t *testing.T) {
addrLookup := map[string]*v1.EndpointAddress{}
for _, subset := range endpoints.Subsets {
for _, addr := range subset.Addresses {
addr := addr
key := fmt.Sprintf("http://%s:%s", addr.IP, svcPort)
addrLookup[key] = &addr
}

View File

@ -190,8 +190,6 @@ var _ = Describe("Table", func() {
defer cancel()
for _, httpso := range httpsoList.Items {
httpso := httpso
key := *k8s.NamespacedNameFromObject(&httpso)
t.httpScaledObjects[key] = &httpso
}
@ -216,8 +214,6 @@ var _ = Describe("Table", func() {
defer cancel()
for _, httpso := range httpsoList.Items {
httpso := httpso
key := *k8s.NamespacedNameFromObject(&httpso)
t.httpScaledObjects[key] = &httpso
}
@ -285,8 +281,6 @@ var _ = Describe("Table", func() {
It("returns new memory based on HTTPSOs", func() {
for _, httpso := range httpsoList.Items {
httpso := httpso
key := *k8s.NamespacedNameFromObject(&httpso)
t.httpScaledObjects[key] = &httpso
}

View File

@ -484,8 +484,6 @@ var _ = Describe("TableMemory", func() {
store: iradix.New[*httpv1alpha1.HTTPScaledObject](),
}
for _, httpso := range httpsoList.Items {
httpso := httpso
tm = insertTrees(tm, &httpso)
}

View File

@ -34,6 +34,8 @@ type config struct {
DeploymentCacheRsyncPeriod time.Duration `envconfig:"KEDA_HTTP_SCALER_DEPLOYMENT_INFORMER_RSYNC_PERIOD" default:"60m"`
// QueueTickDuration is the duration between queue requests
QueueTickDuration time.Duration `envconfig:"KEDA_HTTP_QUEUE_TICK_DURATION" default:"500ms"`
// ProfilingAddr if not empty, pprof will be available on this address, assuming host:port here
ProfilingAddr string `envconfig:"PROFILING_BIND_ADDRESS" default:""`
}
func mustParseConfig() *config {

View File

@ -10,6 +10,8 @@ import (
"flag"
"fmt"
"net"
"net/http"
_ "net/http/pprof"
"os"
"time"
@ -47,6 +49,7 @@ func main() {
deplName := cfg.TargetDeployment
targetPortStr := fmt.Sprintf("%d", cfg.TargetPort)
targetPendingRequests := cfg.TargetPendingRequests
profilingAddr := cfg.ProfilingAddr
opts := zap.Options{}
opts.BindFlags(flag.CommandLine)
@ -113,6 +116,13 @@ func main() {
return nil
})
if len(profilingAddr) > 0 {
eg.Go(func() error {
setupLog.Info("enabling pprof for profiling", "address", profilingAddr)
return http.ListenAndServe(profilingAddr, nil)
})
}
eg.Go(func() error {
setupLog.Info("starting the grpc server")