Skip to content

Commit

Permalink
srv
Browse files Browse the repository at this point in the history
  • Loading branch information
yalosev committed Oct 18, 2023
1 parent 2614b7f commit b22fae5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions pkg/addon-operator/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ import (
"net/http"
"strings"

"github.com/flant/addon-operator/pkg/app"

"github.com/prometheus/client_golang/prometheus/promhttp"
)

func (op *AddonOperator) registerDefaultRoutes() {
op.engine.APIServer.RegisterRoute(http.MethodGet, "/", func(writer http.ResponseWriter, request *http.Request) {
_, _ = writer.Write([]byte(`<html>
_, _ = writer.Write([]byte(fmt.Sprintf(`<html>
<head><title>Addon-operator</title></head>
<body>
<h1>Addon-operator</h1>
<pre>go tool pprof goprofex http://ADDON_OPERATOR_IP:9115/debug/pprof/profile</pre>
<pre>go tool pprof http://ADDON_OPERATOR_IP:%s/debug/pprof/profile</pre>
<p>
<a href="/discovery">show all possible routes</a>
<a href="/metrics">prometheus metrics</a>
<a href="/healthz">health url</a>
<a href="/readyz">ready url</a>
</p>
</body>
</html>`))
</html>`, app.ListenPort)))
})
op.engine.APIServer.RegisterRoute(http.MethodGet, "/metrics", promhttp.Handler().ServeHTTP)

Expand Down
7 changes: 5 additions & 2 deletions pkg/module_manager/go_hook/go_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ type BindingAction struct {
}

type HookConfig struct {
Schedule []ScheduleConfig
Kubernetes []KubernetesConfig
Schedule []ScheduleConfig
Kubernetes []KubernetesConfig
// OnStartup runs hook on module/global startup
// Attention! During the startup you don't have snapshots available
// use native KubeClient to fetch resources
OnStartup *OrderedConfig
OnBeforeHelm *OrderedConfig
OnAfterHelm *OrderedConfig
Expand Down

0 comments on commit b22fae5

Please sign in to comment.