Skip to content

Commit

Permalink
Merge pull request #877 from sofat1989/addhealthserver
Browse files Browse the repository at this point in the history
use grpc health probe for virtlet
  • Loading branch information
ivan4th authored Jun 24, 2019
2 parents 6ef2793 + b76cc75 commit 5a0c02c
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deploy/data/virtlet-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ spec:
command:
- /bin/sh
- -c
- socat - UNIX:/run/virtlet.sock </dev/null
- grpc_health_probe -addr UNIX:/run/virtlet.sock
- name: vms
image: mirantis/virtlet
imagePullPolicy: IfNotPresent
Expand Down
3 changes: 3 additions & 0 deletions images/Dockerfile.virtlet
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ COPY _output/virtletctl /usr/local/bin
COPY _output/virtlet-longevity-tests /usr/local/bin
COPY _output/vmwrapper /
COPY _output/virtlet-e2e-tests /
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.2 && \
curl -L -s -o /usr/local/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /usr/local/bin/grpc_health_probe

CMD ["/start.sh"]
5 changes: 5 additions & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import (
"github.com/Mirantis/virtlet/pkg/stream"
"github.com/Mirantis/virtlet/pkg/tapmanager"
"github.com/Mirantis/virtlet/pkg/utils"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
)

const (
Expand Down Expand Up @@ -146,6 +148,9 @@ func (v *VirtletManager) Run() error {
v.server = NewServer()
v.server.Register(runtimeService, imageService)

healthServer := health.NewServer()
grpc_health_v1.RegisterHealthServer(v.server.server, healthServer)

if err := v.recoverAndGC(); err != nil {
// we consider recover / gc errors non-fatal
glog.Warning(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/TestGenCommand__compat.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
command:
- /bin/sh
- -c
- socat - UNIX:/run/virtlet.sock </dev/null
- grpc_health_probe -addr UNIX:/run/virtlet.sock
resources: {}
securityContext:
privileged: true
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/TestGenCommand__compat_dev.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ spec:
command:
- /bin/sh
- -c
- socat - UNIX:/run/virtlet.sock </dev/null
- grpc_health_probe -addr UNIX:/run/virtlet.sock
resources: {}
securityContext:
privileged: true
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/TestGenCommand__dev.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ spec:
command:
- /bin/sh
- -c
- socat - UNIX:/run/virtlet.sock </dev/null
- grpc_health_probe -addr UNIX:/run/virtlet.sock
resources: {}
securityContext:
privileged: true
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/TestGenCommand__plain.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
command:
- /bin/sh
- -c
- socat - UNIX:/run/virtlet.sock </dev/null
- grpc_health_probe -addr UNIX:/run/virtlet.sock
resources: {}
securityContext:
privileged: true
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/TestGenCommand__tag.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
command:
- /bin/sh
- -c
- socat - UNIX:/run/virtlet.sock </dev/null
- grpc_health_probe -addr UNIX:/run/virtlet.sock
resources: {}
securityContext:
privileged: true
Expand Down
4 changes: 2 additions & 2 deletions pkg/tools/bindata.go

Large diffs are not rendered by default.

0 comments on commit 5a0c02c

Please sign in to comment.