Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator: fix bug where /-/ready and /-/healthy always returned 404 #1252

Merged
merged 2 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ for detailed information.

- [BUGFIX] Fix panic when using 'stdout' in automatic logging (@mapno)

- [BUGFIX] Grafana Agent Operator: The /-/ready and /-/healthy endpoints will
no longer always return 404 (@rfratto).

- [DEPRECATION] The node_exporter integration's `netdev_device_whitelist` field
is deprecated in favor of `netdev_device_include`. Support for the old field
name will be removed in a future version. (@rfratto)
Expand Down
8 changes: 8 additions & 0 deletions cmd/agent-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/grafana/agent/pkg/operator/logutil"
"github.com/prometheus/common/version"
controller "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"

// Needed for clients.
_ "k8s.io/client-go/plugin/pkg/client/auth"
Expand All @@ -33,6 +34,13 @@ func main() {
os.Exit(1)
}

if err := m.AddReadyzCheck("running", healthz.Ping); err != nil {
level.Warn(logger).Log("msg", "failed to set up 'running' readyz check", "err", err)
}
if err := m.AddHealthzCheck("running", healthz.Ping); err != nil {
level.Warn(logger).Log("msg", "failed to set up 'running' healthz check", "err", err)
}

if err := operator.New(logger, cfg, m); err != nil {
level.Error(logger).Log("msg", "unable to create operator", "err", err)
os.Exit(1)
Expand Down