Skip to content

Commit

Permalink
Merge pull request #75 from roycaihw/feat/healthz
Browse files Browse the repository at this point in the history
add healthz to migrator and trigger
  • Loading branch information
k8s-ci-robot authored Sep 21, 2020
2 parents 3b58c5f + 1e0b908 commit 78600c3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/migrator/app/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func NewMigratorCommand() *cobra.Command {

func Run(ctx context.Context) error {
http.Handle("/metrics", promhttp.Handler())
livenessHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "ok")
})
http.HandleFunc("/healthz", livenessHandler)
go func() { http.ListenAndServe(":2112", nil) }()

var err error
Expand Down
7 changes: 7 additions & 0 deletions cmd/trigger/app/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"log"
"net/http"
"os"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -41,6 +42,12 @@ func NewTriggerCommand() *cobra.Command {
}

func Run(ctx context.Context) error {
livenessHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "ok")
})
http.HandleFunc("/healthz", livenessHandler)
go func() { http.ListenAndServe(":2113", nil) }()

var err error
var config *rest.Config
if *kubeconfigPath != "" {
Expand Down
7 changes: 7 additions & 0 deletions manifests/migrator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ spec:
- --alsologtostderr
- --kube-api-qps=40
- --kube-api-burst=1000
livenessProbe:
httpGet:
scheme: HTTP
port: 2112
path: /healthz
initialDelaySeconds: 10
timeoutSeconds: 60
7 changes: 7 additions & 0 deletions manifests/trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ spec:
containers:
- name: trigger
image: REGISTRY/storage-version-migration-trigger:VERSION
livenessProbe:
httpGet:
scheme: HTTP
port: 2113
path: /healthz
initialDelaySeconds: 10
timeoutSeconds: 60

0 comments on commit 78600c3

Please sign in to comment.