Commit 07e05429 authored by Michelle Noorali's avatar Michelle Noorali

feat(repos): add routes for chart repo management

parent 75cbba95
package main
import (
"github.com/kubernetes/helm/cmd/manager/router"
"github.com/kubernetes/helm/pkg/util"
"net/http"
)
func registerChartRepoRoutes(c *router.Context, h *router.Handler) {
h.Add("GET /chart_repositories", listChartRepositoriesHandlerFunc)
h.Add("POST /chart_repositories", addChartRepoHandlerFunc)
h.Add("DELETE /chart_repositories", removeChartRepoHandlerFunc)
}
func listChartRepositoriesHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {
handler := "manager: list chart repositories"
util.LogHandlerExitWithJSON(handler, w, "a repo here", http.StatusOK)
return nil
}
func addChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {
handler := "manager: add chart repository"
util.LogHandlerExitWithJSON(handler, w, "add a repo", http.StatusOK)
return nil
}
func removeChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {
handler := "manager: remove chart repository"
util.LogHandlerExitWithJSON(handler, w, "remove a repo", http.StatusOK)
return nil
}
......@@ -78,7 +78,7 @@ type Route struct {
Type string
}
func registerRoutes(c *router.Context, h *router.Handler) {
func registerDeploymentRoutes(c *router.Context, h *router.Handler) {
re := regexp.MustCompile("{[a-z]+}")
h.Add("GET /healthz", healthz)
......
......@@ -54,7 +54,8 @@ func main() {
// Set up routes
handler := router.NewHandler(c)
registerRoutes(c, handler)
registerDeploymentRoutes(c, handler)
registerChartRepoRoutes(c, handler)
// Now create a server.
log.Printf("Starting Manager %s on %s", version.Version, c.Config.Address)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment