Add a flag for enabling pprof on the controller manager (#4449)
Some checks failed
Runner Updates Check (Scheduled Job) / check_versions (push) Has been cancelled
Runner Updates Check (Scheduled Job) / check_pr (push) Has been cancelled
Runner Updates Check (Scheduled Job) / update_version (push) Has been cancelled
(gha) E2E Tests / default-setup (push) Has been cancelled
(gha) E2E Tests / default-setup-v2 (push) Has been cancelled
(gha) E2E Tests / single-namespace-setup (push) Has been cancelled
(gha) E2E Tests / single-namespace-setup-v2 (push) Has been cancelled
(gha) E2E Tests / dind-mode-setup (push) Has been cancelled
(gha) E2E Tests / dind-mode-setup-v2 (push) Has been cancelled
(gha) E2E Tests / kubernetes-mode-setup (push) Has been cancelled
(gha) E2E Tests / kubernetes-mode-setup-v2 (push) Has been cancelled
(gha) E2E Tests / auth-proxy-setup (push) Has been cancelled
(gha) E2E Tests / auth-proxy-setup-v2 (push) Has been cancelled
(gha) E2E Tests / anonymous-proxy-setup (push) Has been cancelled
(gha) E2E Tests / anonymous-proxy-setup-v2 (push) Has been cancelled
(gha) E2E Tests / self-signed-ca-setup (push) Has been cancelled
(gha) E2E Tests / self-signed-ca-setup-v2 (push) Has been cancelled
(gha) E2E Tests / update-strategy-tests (push) Has been cancelled
(gha) E2E Tests / update-strategy-tests-v2 (push) Has been cancelled
(gha) E2E Tests / init-with-min-runners (push) Has been cancelled
(gha) E2E Tests / init-with-min-runners-v2 (push) Has been cancelled
Go / lint (push) Has been cancelled
Go / generate (push) Has been cancelled
Run CodeQL / Analyze (push) Has been cancelled
Go / fmt (push) Has been cancelled
(gha) Validate Helm Charts / Lint Chart (push) Has been cancelled
(gha) Validate Helm Charts / Test Chart (push) Has been cancelled
Publish Canary Images / Build and Publish Legacy Canary Image (push) Has been cancelled
Publish Canary Images / Build and Publish gha-runner-scale-set-controller Canary Image (push) Has been cancelled
Go / mocks (push) Has been cancelled
Go / test (push) Has been cancelled
Run Stale Bot / Run Stale (push) Has been cancelled

This commit is contained in:
Junya Okabe
2026-04-24 17:03:26 +09:00
committed by GitHub
parent a401686bd5
commit 13a03302c8
3 changed files with 19 additions and 2 deletions

View File

@@ -84,6 +84,9 @@ spec:
- "--listener-metrics-endpoint=" - "--listener-metrics-endpoint="
- "--metrics-addr=0" - "--metrics-addr=0"
{{- end }} {{- end }}
{{- if .Values.pprof.addr }}
- "--pprof-addr={{ .Values.pprof.addr }}"
{{- end }}
{{- range .Values.flags.excludeLabelPropagationPrefixes }} {{- range .Values.flags.excludeLabelPropagationPrefixes }}
- "--exclude-label-propagation-prefix={{ . }}" - "--exclude-label-propagation-prefix={{ . }}"
{{- end }} {{- end }}
@@ -100,12 +103,19 @@ spec:
{{- end }} {{- end }}
command: command:
- "/manager" - "/manager"
{{- with .Values.metrics }} {{- if or .Values.metrics .Values.pprof.addr }}
ports: ports:
- containerPort: {{regexReplaceAll ":([0-9]+)" .controllerManagerAddr "${1}"}} {{- end }}
{{- with .Values.metrics }}
- containerPort: {{ required "Values.metrics.controllerManagerAddr must end with a numeric port" (regexFind "[0-9]+$" .controllerManagerAddr) }}
protocol: TCP protocol: TCP
name: metrics name: metrics
{{- end }} {{- end }}
{{- if .Values.pprof.addr }}
- containerPort: {{ required "Values.pprof.addr must end with a numeric port" (regexFind "[0-9]+$" .Values.pprof.addr) }}
protocol: TCP
name: pprof
{{- end }}
env: env:
- name: CONTROLLER_MANAGER_CONTAINER_IMAGE - name: CONTROLLER_MANAGER_CONTAINER_IMAGE
value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"

View File

@@ -94,6 +94,10 @@ priorityClassName: ""
# listenerAddr: ":8080" # listenerAddr: ":8080"
# listenerEndpoint: "/metrics" # listenerEndpoint: "/metrics"
## To enable pprof, uncomment the addr field below.
pprof: {}
# addr: ":6060"
flags: flags:
## Log level can be set here with one of the following values: "debug", "info", "warn", "error". ## Log level can be set here with one of the following values: "debug", "info", "warn", "error".
## Defaults to "debug". ## Defaults to "debug".

View File

@@ -85,6 +85,7 @@ func main() {
listenerMetricsEndpoint string listenerMetricsEndpoint string
metricsAddr string metricsAddr string
pprofAddr string
autoScalingRunnerSetOnly bool autoScalingRunnerSetOnly bool
enableLeaderElection bool enableLeaderElection bool
disableAdmissionWebhook bool disableAdmissionWebhook bool
@@ -125,6 +126,7 @@ func main() {
flag.StringVar(&listenerMetricsAddr, "listener-metrics-addr", ":8080", "The address applied to AutoscalingListener metrics server") flag.StringVar(&listenerMetricsAddr, "listener-metrics-addr", ":8080", "The address applied to AutoscalingListener metrics server")
flag.StringVar(&listenerMetricsEndpoint, "listener-metrics-endpoint", "/metrics", "The AutoscalingListener metrics server endpoint from which the metrics are collected") flag.StringVar(&listenerMetricsEndpoint, "listener-metrics-endpoint", "/metrics", "The AutoscalingListener metrics server endpoint from which the metrics are collected")
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&pprofAddr, "pprof-addr", "", "The address the pprof endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false, flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
"Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.") "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&leaderElectionID, "leader-election-id", "actions-runner-controller", "Controller id for leader election.") flag.StringVar(&leaderElectionID, "leader-election-id", "actions-runner-controller", "Controller id for leader election.")
@@ -244,6 +246,7 @@ func main() {
SyncPeriod: &syncPeriod, SyncPeriod: &syncPeriod,
DefaultNamespaces: defaultNamespaces, DefaultNamespaces: defaultNamespaces,
}, },
PprofBindAddress: pprofAddr,
WebhookServer: webhookServer, WebhookServer: webhookServer,
LeaderElection: enableLeaderElection, LeaderElection: enableLeaderElection,
LeaderElectionID: leaderElectionID, LeaderElectionID: leaderElectionID,