mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
fix: register pprof endpoints in repo-server using the params config map (#26237)
Signed-off-by: Patroklos Papapetrou <ppapapetrou76@gmail.com>
This commit is contained in:
committed by
GitHub
parent
8e636b78e5
commit
43ea991a25
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/argoproj/argo-cd/v3/util/gpg"
|
||||
"github.com/argoproj/argo-cd/v3/util/healthz"
|
||||
utilio "github.com/argoproj/argo-cd/v3/util/io"
|
||||
"github.com/argoproj/argo-cd/v3/util/profile"
|
||||
"github.com/argoproj/argo-cd/v3/util/tls"
|
||||
traceutil "github.com/argoproj/argo-cd/v3/util/trace"
|
||||
)
|
||||
@@ -177,7 +178,8 @@ func NewCommand() *cobra.Command {
|
||||
listener, err := lc.Listen(ctx, "tcp", fmt.Sprintf("%s:%d", listenHost, listenPort))
|
||||
errors.CheckError(err)
|
||||
|
||||
healthz.ServeHealthCheck(http.DefaultServeMux, func(r *http.Request) error {
|
||||
mux := http.NewServeMux()
|
||||
healthz.ServeHealthCheck(mux, func(r *http.Request) error {
|
||||
if val, ok := r.URL.Query()["full"]; ok && len(val) > 0 && val[0] == "true" {
|
||||
// connect to itself to make sure repo server is able to serve connection
|
||||
// used by liveness probe to auto restart repo server
|
||||
@@ -199,8 +201,9 @@ func NewCommand() *cobra.Command {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
http.Handle("/metrics", metricsServer.GetHandler())
|
||||
go func() { errors.CheckError(http.ListenAndServe(fmt.Sprintf("%s:%d", metricsHost, metricsPort), nil)) }()
|
||||
mux.Handle("/metrics", metricsServer.GetHandler())
|
||||
profile.RegisterProfiler(mux)
|
||||
go func() { errors.CheckError(http.ListenAndServe(fmt.Sprintf("%s:%d", metricsHost, metricsPort), mux)) }()
|
||||
go func() { errors.CheckError(askPassServer.Run()) }()
|
||||
|
||||
if gpg.IsGPGEnabled() {
|
||||
|
||||
@@ -279,6 +279,8 @@ data:
|
||||
# _grpc_config.<hostname> are disabled to prevent excessive DNS queries that can cause timeouts in dual-stack environments.
|
||||
# See https://github.com/argoproj/argo-cd/issues/24991
|
||||
reposerver.grpc.enable.txt.service.config: "false"
|
||||
# Enables profile endpoint on the internal metrics port
|
||||
reposerver.profile.enabled: "false"
|
||||
|
||||
## Commit-server properties
|
||||
# Listen on given address for incoming connections (default "0.0.0.0")
|
||||
|
||||
@@ -522,12 +522,12 @@ Not all HTTP responses are eligible for retries. The following conditions will n
|
||||
|
||||
Argo CD optionally exposes a profiling endpoint that can be used to profile the CPU and memory usage of the Argo CD
|
||||
component.
|
||||
The profiling endpoint is available on metrics port of each component. See [metrics](./metrics.md) for more information
|
||||
The profiling endpoint is available on the metrics port of each component. See [metrics](./metrics.md) for more information
|
||||
about the port.
|
||||
For security reasons, the profiling endpoint is disabled by default. The endpoint can be enabled by setting the
|
||||
`server.profile.enabled`, `applicationsetcontroller.profile.enabled`, or `controller.profile.enabled` key
|
||||
of [argocd-cmd-params-cm](argocd-cmd-params-cm.yaml) ConfigMap to `true`.
|
||||
Once the endpoint is enabled, you can use go profile tool to collect the CPU and memory profiles. Example:
|
||||
`server.profile.enabled`, `applicationsetcontroller.profile.enabled`, `reposerver.profile.enabled` or
|
||||
`controller.profile.enabled` key of [argocd-cmd-params-cm](argocd-cmd-params-cm.yaml) ConfigMap to `true`.
|
||||
Once the endpoint is enabled, you can use the go profile tool to collect the CPU and memory profiles. Example:
|
||||
|
||||
```bash
|
||||
$ kubectl port-forward svc/argocd-metrics 8082:8082
|
||||
|
||||
@@ -369,6 +369,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- name: argocd-cmd-params-cm
|
||||
configMap:
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
|
||||
7
manifests/core-install-with-hydrator.yaml
generated
7
manifests/core-install-with-hydrator.yaml
generated
@@ -32011,6 +32011,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
|
||||
7
manifests/core-install.yaml
generated
7
manifests/core-install.yaml
generated
@@ -31839,6 +31839,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
|
||||
7
manifests/ha/install-with-hydrator.yaml
generated
7
manifests/ha/install-with-hydrator.yaml
generated
@@ -33646,6 +33646,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
7
manifests/ha/install.yaml
generated
7
manifests/ha/install.yaml
generated
@@ -33476,6 +33476,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
@@ -2893,6 +2893,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
7
manifests/ha/namespace-install.yaml
generated
7
manifests/ha/namespace-install.yaml
generated
@@ -2723,6 +2723,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
7
manifests/install-with-hydrator.yaml
generated
7
manifests/install-with-hydrator.yaml
generated
@@ -32676,6 +32676,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
7
manifests/install.yaml
generated
7
manifests/install.yaml
generated
@@ -32504,6 +32504,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
7
manifests/namespace-install-with-hydrator.yaml
generated
7
manifests/namespace-install-with-hydrator.yaml
generated
@@ -1923,6 +1923,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
7
manifests/namespace-install.yaml
generated
7
manifests/namespace-install.yaml
generated
@@ -1751,6 +1751,13 @@ spec:
|
||||
name: var-files
|
||||
- emptyDir: {}
|
||||
name: plugins
|
||||
- configMap:
|
||||
items:
|
||||
- key: reposerver.profile.enabled
|
||||
path: profiler.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
name: argocd-cmd-params-cm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
Reference in New Issue
Block a user