Skip to content

Add health and readiness probes to controller manager#4459

Open
Okabe-Junya wants to merge 1 commit intoactions:masterfrom
Okabe-Junya:Okabe-Junya/feat/add-health-readiness-probes
Open

Add health and readiness probes to controller manager#4459
Okabe-Junya wants to merge 1 commit intoactions:masterfrom
Okabe-Junya:Okabe-Junya/feat/add-health-readiness-probes

Conversation

@Okabe-Junya
Copy link
Copy Markdown

What

Add health and readiness probes to the controller manager

  • Set HealthProbeBindAddress (:8081) on the controller-runtime manager
  • Register /healthz (liveness) and /readyz (readiness) checks via healthz.Ping
  • Add --health-probe-bind-address CLI flag to allow customization
  • Add livenessProbe and readinessProbe to all Helm chart deployment templates and config/manager/manager.yaml

Why

Controller manager currently has no health or readiness probes configured. This means:

  • Kubelet cannot detect a hung or deadlocked controller, so the pod is never restarted automatically
  • During rolling updates, traffic may be routed to pods that are not yet ready
  • There is no mechanism to remove a shutting-down controller from service endpoints

Copilot AI review requested due to automatic review settings April 19, 2026 03:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds health and readiness probe support for the controller manager, wiring controller-runtime’s health endpoints into the manager binary and enabling Kubernetes probe configuration in the shipped manifests/charts.

Changes:

  • Add --health-probe-bind-address flag and configure controller-runtime HealthProbeBindAddress on the manager.
  • Register /healthz and /readyz endpoints via controller-runtime health checks.
  • Add livenessProbe and readinessProbe to the kustomize manager manifest and Helm controller deployments.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
main.go Adds controller-runtime health/ready endpoints and CLI flag to configure probe bind address.
config/manager/manager.yaml Adds Kubernetes liveness/readiness probes to the manager container.
charts/gha-runner-scale-set-controller/templates/deployment.yaml Adds liveness/readiness probes to the scale-set controller deployment.
charts/gha-runner-scale-set-controller-experimental/templates/_controller_template.tpl Adds liveness/readiness probes to the experimental controller container template.
charts/actions-runner-controller/templates/deployment.yaml Adds liveness/readiness probes to the actions-runner-controller deployment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +95 to +104
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probes hard-code port 8081, but the manager now supports --health-probe-bind-address and this chart allows users to append arbitrary extraArgs. If a user sets a different bind address/port via extraArgs, the probes will start failing and repeatedly restart the pod. Suggest adding a chart value for the health probe bind address/port, wiring it into both the container args and the probe port field (or at least deriving the probe port from the configured bind address).

Suggested change
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
{{- $healthProbeBindAddress := ":8081" -}}
{{- with .Values.controller.manager.extraArgs }}
{{- if kindIs "slice" . }}
{{- range . }}
{{- if and (kindIs "string" .) (hasPrefix "--health-probe-bind-address=" .) }}
{{- $healthProbeBindAddress = trimPrefix "--health-probe-bind-address=" . -}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- $healthProbePort := 8081 -}}
{{- $healthProbeBindParts := splitList ":" $healthProbeBindAddress -}}
{{- if gt (len $healthProbeBindParts) 1 }}
{{- $healthProbePort = (last $healthProbeBindParts | int) -}}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: {{ $healthProbePort }}
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: {{ $healthProbePort }}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since (technically) we can use extraArgs in experimental chart, this feeedback mighy be reasonable, but I think it would introduce unnecessary complexity and a lack of consistency with other charts.

But, if this change is necessary, I will create a fixup

Comment thread charts/gha-runner-scale-set-controller/templates/deployment.yaml
Comment thread charts/actions-runner-controller/templates/deployment.yaml
Comment thread config/manager/manager.yaml
Comment thread main.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants