vaulthealthz

package module
v0.0.0-...-66528f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

CircleCI

vaulthealthz

Package vaulthealthz provides microkit endpoints for Vault health checks.

Documentation

Index

Constants

View Source
const (
	PrometheusNamespace = "microendpoint"
	PrometheusSubsystem = "vaulthealthz"
)
View Source
const (
	// Description describes which functionality this health check implements.
	Description = "Ensure Vault API availability."
	// Name is the identifier of the health check. This can be used for emitting
	// metrics.
	Name = "vault"
	// SuccessMessage is the message returned in case the health check did not
	// fail.
	SuccessMessage = "all good"
	// Timeout is the time being waited until timing out health check, which
	// renders its result unsuccessful.
	Timeout = 5 * time.Second
)
View Source
const (
	// ExpireTimeKey is the data key provided by the secret when looking up the
	// used Vault token. This key is specific to Vault as they define it.
	ExpireTimeKey = "expire_time"
	// ExpireTimeLayout is the layout used for time parsing when inspecting the
	// expiration date of the used Vault token. This layout is specific to Vault
	// as they define it.
	ExpireTimeLayout = "2006-01-02T15:04:05"
)

Variables

This section is empty.

Functions

func IsExecutionFailed

func IsExecutionFailed(err error) bool

IsExecutionFailed asserts executionFailedError.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

Types

type Config

type Config struct {
	// Dependencies.
	Logger      micrologger.Logger
	VaultClient *vaultapi.Client

	// Settings.
	Timeout time.Duration
}

Config represents the configuration used to create a healthz service.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig provides a default configuration to create a new healthz service by best effort.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements the healthz service interface.

func New

func New(config Config) (*Service, error)

New creates a new configured healthz service.

func (*Service) GetHealthz

func (s *Service) GetHealthz(ctx context.Context) (healthz.Response, error)

GetHealthz implements the health check for Vault. It does this by calling the Vault /sys/health endpoint. This checks that the we can connect to the Vault API and that the Vault token is valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL