Documentation ¶
Index ¶
- Variables
- func CreateKubeNamespace(c kubernetes.Interface) (*corev1.Namespace, error)
- func DeleteKubeNamespace(c kubernetes.Interface, namespace string) error
- func Execute() error
- func LoadConfig(config, context string) (*rest.Config, error)
- func RegisterMetricsAndInstallHandler(m *http.ServeMux)
- func ReportOperationCompleted(operation string, startTime time.Time)
- func RestclientConfig(config, context string) (*api.Config, error)
- func ServeHTTP(healthcheckOptions *HealthCheckServer) error
- func WaitForEndpoint(c kubernetes.Interface, namespace, name string) error
- type HealthCheck
- type HealthCheckServer
Constants ¶
This section is empty.
Variables ¶
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 ¶
LoadConfig parses the config and context and returns a new Config
func RegisterMetricsAndInstallHandler ¶
RegisterMetricsAndInstallHandler registers the metrics objects with Prometheus and installs the Prometheus http handler at the default context.
func ReportOperationCompleted ¶
ReportOperationCompleted records the elapses time in milliseconds for a specified operation
func RestclientConfig ¶
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.