diff --git a/Gopkg.lock b/Gopkg.lock index cb768e48ba4..4e75777fcad 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -34,6 +34,12 @@ packages = ["."] revision = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a" +[[projects]] + branch = "master" + name = "github.com/beorn7/perks" + packages = ["quantile"] + revision = "4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9" + [[projects]] name = "github.com/davecgh/go-spew" packages = ["spew"] @@ -156,6 +162,12 @@ ] revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6" +[[projects]] + branch = "master" + name = "github.com/heptiolabs/healthcheck" + packages = ["."] + revision = "da5fdee475fb09de87c5d4a50da233b7d28767b1" + [[projects]] branch = "master" name = "github.com/howeyc/gopass" @@ -196,6 +208,12 @@ ] revision = "32fa128f234d041f196a9f3e0fea5ac9772c08e1" +[[projects]] + name = "github.com/matttproud/golang_protobuf_extensions" + packages = ["pbutil"] + revision = "3247c84500bff8d9fb6d579d800f20b3e091582c" + version = "v1.0.0" + [[projects]] branch = "master" name = "github.com/petar/GoLLRB" @@ -208,6 +226,39 @@ revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" version = "v2.0.1" +[[projects]] + name = "github.com/prometheus/client_golang" + packages = ["prometheus"] + revision = "c5b7fccd204277076155f10851dad72b76a49317" + version = "v0.8.0" + +[[projects]] + branch = "master" + name = "github.com/prometheus/client_model" + packages = ["go"] + revision = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" + +[[projects]] + branch = "master" + name = "github.com/prometheus/common" + packages = [ + "expfmt", + "internal/bitbucket.org/ww/goautoneg", + "model" + ] + revision = "89604d197083d4781071d3c65855d24ecfb0a563" + +[[projects]] + branch = "master" + name = "github.com/prometheus/procfs" + packages = [ + ".", + "internal/util", + "nfs", + "xfs" + ] + revision = "cb4147076ac75738c9a7d279075a253c0cc5acbd" + [[projects]] name = "github.com/spf13/pflag" packages = ["."] @@ -502,6 +553,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "178653a683ca7a782dfcc5d09cccb58e6b782e33fd3b53ad97cb3bc2f4669166" + inputs-digest = "0d51328b2df5e89776ac980590dbcb6c72ab5481b784b47f925a55ef9978f30c" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/contour/contour.go b/cmd/contour/contour.go index 2ba01747443..a1ad8dff916 100644 --- a/cmd/contour/contour.go +++ b/cmd/contour/contour.go @@ -14,12 +14,15 @@ package main import ( + "context" "flag" "fmt" "io" "net" + "net/http" "os" "path/filepath" + "time" kingpin "gopkg.in/alecthomas/kingpin.v2" @@ -33,6 +36,7 @@ import ( "github.com/heptio/contour/internal/k8s" "github.com/heptio/contour/internal/log/stdlog" "github.com/heptio/contour/internal/workgroup" + "github.com/heptiolabs/healthcheck" ) const ( @@ -92,6 +96,21 @@ func main() { k8s.WatchIngress(&g, client, logger, buf) k8s.WatchSecrets(&g, client, logger, buf) + g.Add(func(stop <-chan struct{}) { + logger := logger.WithPrefix("healthcheck") + srv := &http.Server{ + Handler: healthcheck.NewHandler(), + Addr: "0.0.0.0:8086", + WriteTimeout: 15 * time.Second, + ReadTimeout: 15 * time.Second, + } + go srv.ListenAndServe() // run server in another goroutine + logger.Infof("started, listening on %v", srv.Addr) + defer logger.Infof("stopped") + <-stop // wait for stop signal + srv.Shutdown(context.Background()) // shutdown and wait for server to exit + }) + g.Add(func(stop <-chan struct{}) { logger := logger.WithPrefix("gRPCAPI") l, err := net.Listen("tcp", V2_API_ADDRESS) diff --git a/deployment/deployment-grpc-v2/02-contour.yaml b/deployment/deployment-grpc-v2/02-contour.yaml index a60905b8d1b..c262dd18d3e 100644 --- a/deployment/deployment-grpc-v2/02-contour.yaml +++ b/deployment/deployment-grpc-v2/02-contour.yaml @@ -36,6 +36,11 @@ spec: volumeMounts: - name: contour-config mountPath: /config + readinessProbe: + httpGet: + path: /ready + port: 8086 + periodSeconds: 5 initContainers: - image: gcr.io/heptio-images/contour:master imagePullPolicy: Always diff --git a/deployment/ds-grpc-v2/02-contour.yaml b/deployment/ds-grpc-v2/02-contour.yaml index 071092f98c8..af8a826e90f 100644 --- a/deployment/ds-grpc-v2/02-contour.yaml +++ b/deployment/ds-grpc-v2/02-contour.yaml @@ -35,6 +35,11 @@ spec: volumeMounts: - name: contour-config mountPath: /config + readinessProbe: + httpGet: + path: /ready + port: 8086 + periodSeconds: 5 initContainers: - image: gcr.io/heptio-images/contour:master imagePullPolicy: Always diff --git a/deployment/ds-hostnet/02-contour.yaml b/deployment/ds-hostnet/02-contour.yaml index b39107aa3ae..0fd58418dd8 100644 --- a/deployment/ds-hostnet/02-contour.yaml +++ b/deployment/ds-hostnet/02-contour.yaml @@ -36,6 +36,11 @@ spec: name: contour command: ["contour"] args: ["serve", "--incluster"] + readinessProbe: + httpGet: + path: /ready + port: 8086 + periodSeconds: 5 initContainers: - image: gcr.io/heptio-images/contour:master imagePullPolicy: Always diff --git a/deployment/render/daemonset-norbac.yaml b/deployment/render/daemonset-norbac.yaml index eaec2a413e6..a1718b665d0 100644 --- a/deployment/render/daemonset-norbac.yaml +++ b/deployment/render/daemonset-norbac.yaml @@ -49,6 +49,11 @@ spec: volumeMounts: - name: contour-config mountPath: /config + readinessProbe: + httpGet: + path: /ready + port: 8086 + periodSeconds: 5 initContainers: - image: gcr.io/heptio-images/contour:master imagePullPolicy: Always diff --git a/deployment/render/daemonset-rbac.yaml b/deployment/render/daemonset-rbac.yaml index a7c5363f020..4bd0d8a603f 100644 --- a/deployment/render/daemonset-rbac.yaml +++ b/deployment/render/daemonset-rbac.yaml @@ -49,6 +49,11 @@ spec: volumeMounts: - name: contour-config mountPath: /config + readinessProbe: + httpGet: + path: /ready + port: 8086 + periodSeconds: 5 initContainers: - image: gcr.io/heptio-images/contour:master imagePullPolicy: Always diff --git a/deployment/render/deployment-norbac.yaml b/deployment/render/deployment-norbac.yaml index acbbfe12a5c..dd18ad00c73 100644 --- a/deployment/render/deployment-norbac.yaml +++ b/deployment/render/deployment-norbac.yaml @@ -50,6 +50,11 @@ spec: volumeMounts: - name: contour-config mountPath: /config + readinessProbe: + httpGet: + path: /ready + port: 8086 + periodSeconds: 5 initContainers: - image: gcr.io/heptio-images/contour:master imagePullPolicy: Always diff --git a/deployment/render/deployment-rbac.yaml b/deployment/render/deployment-rbac.yaml index 3c69fcb1651..35e0c7f03c1 100644 --- a/deployment/render/deployment-rbac.yaml +++ b/deployment/render/deployment-rbac.yaml @@ -50,6 +50,11 @@ spec: volumeMounts: - name: contour-config mountPath: /config + readinessProbe: + httpGet: + path: /ready + port: 8086 + periodSeconds: 5 initContainers: - image: gcr.io/heptio-images/contour:master imagePullPolicy: Always