Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

magneticio/vamp-health-probe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vamp Health Probe

This repository contains helper structs to run Kubernetes health checks in parallel.

Running unit tests

make test

Example usage

NATS health check

import "github.com/magneticio/vamp-health-probe/pkg/probe" 

func StartHealthCheck() {
	natsConnection := ... // create NATS connection

	natschecker := func() error {
		if !natsConnection.IsConnected() {
			return fmt.Errorf("not connected")
		}
		return nil
	}

	healthStatusProvider := probe.NewHealthStatusProvider(map[string]probe.HealthStatusChecker{
		"NATS": natschecker,
	})
	healthStatusProvider.Start(time.Minute)
	http.HandleFunc("/healthz", healthStatusProvider.Handler)

	go log.Fatal(http.ListenAndServe("0.0.0.0:7770", nil))
}

Kubernetes livenessProbe

livenessProbe:
  httpGet:
    path: /healthz
    port: 7770
  initialDelaySeconds: 10
  timeoutSeconds: 5
  periodSeconds: 60

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published