alert

package
v0.0.0-...-5d42de7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Running is used when the instance is running
	Running State = "Running"
	// Stopped is used when the instance is about to stop
	Stopped State = "Stopped"
	// Updating is used when the instance is about to update
	Updating State = "Updating"
	// Error is used when the instance deployment errored out
	Error State = "Error"

	// Start is used when the instance to be created or updated
	Start DesiredState = ""
	// Stop is used when the instance to be stopped
	Stop DesiredState = "Stop"
)
View Source
const (
	EmptySpec   string = "empty"
	DefaultSpec string = "default"
)

Constants for predefined specs

Variables

This section is empty.

Functions

func FlagWasSet

func FlagWasSet(flagset *pflag.FlagSet, flagName string) bool

FlagWasSet returns true if a flag was changed and it exists, otherwise it returns false

Types

type CRDInstaller

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

CRDInstaller defines the specification for the controller

func NewCRDInstaller

func NewCRDInstaller(config *protoform.Config, kubeConfig *rest.Config, kubeClient *kubernetes.Clientset, defaults interface{}, stopCh <-chan struct{}) *CRDInstaller

NewCRDInstaller will create a installer configuration

func (*CRDInstaller) AddInformerEventHandler

func (c *CRDInstaller) AddInformerEventHandler()

AddInformerEventHandler will add the event handlers for the informers

func (*CRDInstaller) CreateClientSet

func (c *CRDInstaller) CreateClientSet() error

CreateClientSet will create the CRD client

func (*CRDInstaller) CreateController

func (c *CRDInstaller) CreateController()

CreateController will create a CRD controller

func (*CRDInstaller) CreateHandler

func (c *CRDInstaller) CreateHandler()

CreateHandler will create a CRD handler

func (*CRDInstaller) CreateInformer

func (c *CRDInstaller) CreateInformer()

CreateInformer will create a informer for the CRD

func (*CRDInstaller) CreateQueue

func (c *CRDInstaller) CreateQueue()

CreateQueue will create a queue to process the CRD

func (*CRDInstaller) Deploy

func (c *CRDInstaller) Deploy() error

Deploy will deploy the CRD

func (*CRDInstaller) PostDeploy

func (c *CRDInstaller) PostDeploy()

PostDeploy will initialize before deploying the CRD

func (*CRDInstaller) PostRun

func (c *CRDInstaller) PostRun()

PostRun will run post CRD controller execution

func (*CRDInstaller) Run

func (c *CRDInstaller) Run()

Run will run the CRD controller

type CRSpecBuilderFromCobraFlags

type CRSpecBuilderFromCobraFlags struct {
	Version                string
	StandAlone             string
	ExposeService          string
	Port                   int32
	EncryptionPassword     string
	EncryptionGlobalSalt   string
	Environs               []string
	PersistentStorage      string
	PVCName                string
	PVCStorageClass        string
	PVCSize                string
	AlertMemory            string
	CfsslMemory            string
	Registry               string
	RegistryNamespace      string
	PullSecrets            []string
	ImageRegistries        []string
	CertificateFilePath    string
	CertificateKeyFilePath string
	JavaKeyStoreFilePath   string
	// contains filtered or unexported fields
}

CRSpecBuilderFromCobraFlags uses Cobra commands, Cobra flags and other values to create an Alert CR's Spec.

The fields in the CRSpecBuilderFromCobraFlags represent places where the values of the Cobra flags are stored.

Usage: Use CRSpecBuilderFromCobraFlags to add flags to your Cobra Command for making an Alert Spec. When flags are used the correspoding value in this struct will by set. You can then generate the spec by telling CRSpecBuilderFromCobraFlags what flags were changed.

func NewCRSpecBuilderFromCobraFlags

func NewCRSpecBuilderFromCobraFlags() *CRSpecBuilderFromCobraFlags

NewCRSpecBuilderFromCobraFlags creates a new CRSpecBuilderFromCobraFlags type

func (*CRSpecBuilderFromCobraFlags) AddCRSpecFlagsToCommand

func (ctl *CRSpecBuilderFromCobraFlags) AddCRSpecFlagsToCommand(cmd *cobra.Command, master bool)

AddCRSpecFlagsToCommand adds flags to a Cobra Command that are need for Alert's Spec. The flags map to fields in the CRSpecBuilderFromCobraFlags struct. master - if false, doesn't add flags that all Users shouldn't use

func (*CRSpecBuilderFromCobraFlags) CheckValuesFromFlags

func (ctl *CRSpecBuilderFromCobraFlags) CheckValuesFromFlags(flagset *pflag.FlagSet) error

CheckValuesFromFlags returns an error if a value stored in the struct will not be able to be used in the AlertSpec

func (*CRSpecBuilderFromCobraFlags) GenerateCRSpecFromFlags

func (ctl *CRSpecBuilderFromCobraFlags) GenerateCRSpecFromFlags(flagset *pflag.FlagSet) (interface{}, error)

GenerateCRSpecFromFlags checks if a flag was changed and updates the alertSpec with the value that's stored in the corresponding struct field

func (*CRSpecBuilderFromCobraFlags) GetCRSpec

func (ctl *CRSpecBuilderFromCobraFlags) GetCRSpec() interface{}

GetCRSpec returns a pointer to the AlertSpec as an interface{}

func (*CRSpecBuilderFromCobraFlags) SetCRSpec

func (ctl *CRSpecBuilderFromCobraFlags) SetCRSpec(spec interface{}) error

SetCRSpec sets the alertSpec in the struct

func (*CRSpecBuilderFromCobraFlags) SetCRSpecFieldByFlag

func (ctl *CRSpecBuilderFromCobraFlags) SetCRSpecFieldByFlag(f *pflag.Flag)

SetCRSpecFieldByFlag updates a field in the alertSpec if the flag was set by the user. It gets the value from the corresponding struct field Note: It should only handle values with a 1 to 1 mapping - struct-field to spec

func (*CRSpecBuilderFromCobraFlags) SetPredefinedCRSpec

func (ctl *CRSpecBuilderFromCobraFlags) SetPredefinedCRSpec(specType string) error

SetPredefinedCRSpec sets the alertSpec to a predefined spec

type Controller

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

Controller will store the controller configuration

func NewController

func NewController(logger *log.Entry, queue workqueue.RateLimitingInterface, informer cache.SharedIndexInformer, handler HandlerInterface) *Controller

NewController will contain the controller specification

func (*Controller) HasSynced

func (c *Controller) HasSynced() bool

HasSynced will check for informer sync

func (*Controller) Run

func (c *Controller) Run(threadiness int, stopCh <-chan struct{})

Run will be executed to create the informers or controllers

type DesiredState

type DesiredState string

DesiredState contains the desired state of the Alert

type Handler

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

Handler will store the configuration that is required to initiantiate the informers callback

func NewHandler

func NewHandler(config *protoform.Config, kubeConfig *rest.Config, kubeClient *kubernetes.Clientset, alertClient *alertclientset.Clientset, routeClient *routeclient.RouteV1Client, defaults *alertapi.AlertSpec) *Handler

NewHandler will create the handler

func (*Handler) ObjectCreated

func (h *Handler) ObjectCreated(obj interface{})

ObjectCreated will be called for create alert events

func (*Handler) ObjectDeleted

func (h *Handler) ObjectDeleted(name string)

ObjectDeleted will be called for delete alert events

func (*Handler) ObjectUpdated

func (h *Handler) ObjectUpdated(objOld, objNew interface{})

ObjectUpdated will be called for update alert events

type HandlerInterface

type HandlerInterface interface {
	ObjectCreated(obj interface{})
	ObjectDeleted(obj string)
	ObjectUpdated(objOld, objNew interface{})
}

HandlerInterface contains the methods that are required

type State

type State string

State contains the state of the Alert

Directories

Path Synopsis
client
clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/alert/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/alert/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

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