server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package server provides the coordination logic for kured-silencer

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingHost is returned when the URL is missing a scheme
	ErrMissingHost = errors.New("missing host")

	// ErrInvalidScheme is returned when the URL has an invalid scheme
	ErrInvalidScheme = errors.New("invalid scheme")

	// ErrMissingNode is returned when the node a label is deleted from is not found
	ErrMissingNode = errors.New("missing node")

	// ErrNodeNotReady is returned when the node is not ready
	ErrNodeNotReady = errors.New("node not ready")

	// ErrNodeUnschedulable is returned when the node is unschedulable
	ErrNodeUnschedulable = errors.New("node unschedulable")
)

Functions

func ValidateURL

func ValidateURL(u *url.URL) error

ValidateURL ensures that a valid url with both scheme and host is provided

Types

type Client

type Client struct {
	KubeClient kubernetes.Interface
	AMClient   *client.AlertmanagerAPI
}

Client is a struct container the kubernetes and alertmanager clients

type Server

type Server struct {
	Client *Client
	// contains filtered or unexported fields
}

Server contains settings for kured-silencer

func NewServer

func NewServer(ctx context.Context, logger *zap.SugaredLogger) (*Server, error)

NewServer creates a new server

func (Server) EventHandler

func (srv Server) EventHandler(ctx context.Context, event watch.Event) error

EventHandler provides logic for handling node label event types

func (Server) GetKubeClient

func (srv Server) GetKubeClient() kubernetes.Interface

GetKubeClient returns the kubernetes client from the running server

func (*Server) Run

func (srv *Server) Run(ctx context.Context)

Run starts the server

func (Server) WithLogger

func (srv Server) WithLogger(_ context.Context, logger *zap.SugaredLogger) *Server

WithLogger sets the logger for the server

func (Server) WithSilenceDuration

func (srv Server) WithSilenceDuration(_ context.Context, d time.Duration) *Server

WithSilenceDuration sets the silence duration for the server

Jump to

Keyboard shortcuts

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