framework

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ExecutionCount is the number of times the HealthCheck has executed
	ExecutionCount = prometheus.NewCounter(
		prometheus.CounterOpts{
			Namespace: promNamespace,
			Name:      "execution_count",
			Help:      "Number of times the health check has run.",
		},
	)

	// ErrorCount is the number of times HealthCheck has errored during the end to end test
	ErrorCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: promNamespace,
			Name:      "error_count",
			Help:      "Number of times the health check ended in error, by error.",
		},
		[]string{"error"},
	)
)

Functions

func CreateKubeNamespace

func CreateKubeNamespace(c kubernetes.Interface) (*corev1.Namespace, error)

CreateKubeNamespace create a new K8s namespace with a unique name

func DeleteKubeNamespace

func DeleteKubeNamespace(c kubernetes.Interface, namespace string) error

DeleteKubeNamespace deletes the specified K8s namespace

func Execute

func Execute() error

Execute starts the HTTP Server and runs the health check tasks on a periodic basis

func LoadConfig

func LoadConfig(config, context string) (*rest.Config, error)

LoadConfig parses the config and context and returns a new Config

func RegisterMetricsAndInstallHandler

func RegisterMetricsAndInstallHandler(m *http.ServeMux)

RegisterMetricsAndInstallHandler registers the metrics objects with Prometheus and installs the Prometheus http handler at the default context.

func ReportOperationCompleted

func ReportOperationCompleted(operation string, startTime time.Time)

ReportOperationCompleted records the elapses time in milliseconds for a specified operation

func RestclientConfig

func RestclientConfig(config, context string) (*api.Config, error)

RestclientConfig builds a Config object

func ServeHTTP

func ServeHTTP(healthcheckOptions *HealthCheckServer) error

ServeHTTP starts a new Http Server thread for /metrics and health probing

func WaitForEndpoint

func WaitForEndpoint(c kubernetes.Interface, namespace, name string) error

WaitForEndpoint waits for 'defaultTimeout' interval for an endpoint to be available

Types

type HealthCheck

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

HealthCheck is a type that used to control various aspects of the health check.

func NewHealthCheck

func NewHealthCheck(s *HealthCheckServer) (*HealthCheck, error)

NewHealthCheck creates a new HealthCheck object and initializes the kube and catalog client sets.

func (*HealthCheck) RunHealthCheck

func (h *HealthCheck) RunHealthCheck(s *HealthCheckServer) error

RunHealthCheck runs an end to end verification against the "ups-broker". It validates the broker endpoint is available, then creates an instance and binding and does validation along the way and then tears it down. Some basic Prometheus metrics are maintained that can be alerted off from.

type HealthCheckServer

type HealthCheckServer struct {
	KubeHost    string
	KubeConfig  string
	KubeContext string

	// HealthCheckInterval is how frequently the end to end health check should be run
	HealthCheckInterval  time.Duration
	SecureServingOptions *genericoptions.SecureServingOptions
	TestBrokerName       string
	UseNamespacedBroker  bool
}

HealthCheckServer is the main context object for the health check server

func NewHealthCheckServer

func NewHealthCheckServer() *HealthCheckServer

NewHealthCheckServer creates a new HealthCheckServer with a default config.

func (*HealthCheckServer) AddFlags

func (s *HealthCheckServer) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags for a ControllerManagerServer to the specified FlagSet.

Jump to

Keyboard shortcuts

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