Skip to content

Commit 3f23644

Browse files
committed
alert-mgmt-01: add alerting health stub endpoint
\nSigned-off-by: avlitman <alitman@redhat.com>\nSigned-off-by: Shirly Radco <sradco@redhat.com>\nSigned-off-by: machadovilaca <machadovilaca@gmail.com>\nCo-authored-by: Cursor AI Agent <cursor-ai@users.noreply.github.com>\n
1 parent 2c24949 commit 3f23644

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

cmd/plugin-backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var (
1616
portArg = flag.Int("port", 0, "server port to listen on (default: 9443)\nports 9444 and 9445 reserved for other use")
1717
certArg = flag.String("cert", "", "cert file path to enable TLS (disabled by default)")
1818
keyArg = flag.String("key", "", "private key file path to enable TLS (disabled by default)")
19-
featuresArg = flag.String("features", "", "enabled features, comma separated.\noptions: ['acm-alerting', 'incidents', 'dev-config', 'perses-dashboards']")
19+
featuresArg = flag.String("features", "", "enabled features, comma separated.\noptions: ['acm-alerting', 'incidents', 'dev-config', 'perses-dashboards', 'alert-management-api']")
2020
staticPathArg = flag.String("static-path", "", "static files path to serve frontend (default: './web/dist')")
2121
configPathArg = flag.String("config-path", "", "config files path (default: './config')")
2222
pluginConfigArg = flag.String("plugin-config-path", "", "plugin yaml configuration")

pkg/server.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const (
6060
Incidents Feature = "incidents"
6161
DevConfig Feature = "dev-config"
6262
PersesDashboards Feature = "perses-dashboards"
63+
AlertManagement Feature = "alert-management-api"
6364
)
6465

6566
func (pluginConfig *PluginConfig) MarshalJSON() ([]byte, error) {
@@ -229,6 +230,12 @@ func setupRoutes(cfg *Config) (*mux.Router, *PluginConfig) {
229230

230231
router.PathPrefix("/health").HandlerFunc(healthHandler())
231232

233+
// Stub endpoint to make the intended alert-management API shape reviewable
234+
// early in the PR series, without pulling in the full router/management stack yet.
235+
if cfg.Features[AlertManagement] {
236+
router.HandleFunc("/api/v1/alerting/health", alertManagementHealthStub()).Methods(http.MethodGet)
237+
}
238+
232239
router.Path("/plugin-manifest.json").Handler(manifestHandler(cfg))
233240

234241
router.PathPrefix("/features").HandlerFunc(featuresHandler(cfg))
@@ -238,6 +245,18 @@ func setupRoutes(cfg *Config) (*mux.Router, *PluginConfig) {
238245
return router, pluginConfig
239246
}
240247

248+
func alertManagementHealthStub() http.HandlerFunc {
249+
type resp struct {
250+
Error string `json:"error"`
251+
}
252+
return func(w http.ResponseWriter, _ *http.Request) {
253+
w.Header().Set("Content-Type", "application/json")
254+
w.Header().Set("Cache-Control", "no-store")
255+
w.WriteHeader(http.StatusNotImplemented)
256+
_ = json.NewEncoder(w).Encode(resp{Error: "alert management API not implemented yet"})
257+
}
258+
}
259+
241260
func setupProxyRoutes(cfg *Config, k8sclient *dynamic.DynamicClient, kind proxy.KindType) *mux.Router {
242261
router := mux.NewRouter()
243262
var proxyUrl string

0 commit comments

Comments
 (0)