controller

package
v0.0.0-...-4c11de6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfig

func BuildConfig() (*rest.Config, error)

BuildConfig builds a config from the file

func CreateLoadTest

func CreateLoadTest(clientSet clientSetV.Clientset, pods int32, name, testFile, testData string, envVars map[string]string, loadTestType apisLoadTestV1.LoadTestType) error

CreateLoadTest creates a load test CR

func DeleteLoadTest

func DeleteLoadTest(clientSet clientSetV.Clientset, loadtestName string, testname string) error

DeleteLoadTest deletes a load test CR

func GetDistributedPods

func GetDistributedPods(clientSet typeV1.CoreV1Interface, namespace string) (coreV1.PodList, error)

GetDistributedPods returns a number of distributed pods in load test namespace

func GetLoadTest

func GetLoadTest(clientSet clientSetV.Clientset, loadtestName string) (string, error)

GetLoadTest returns a load test name

func GetLoadTestEnvVars

func GetLoadTestEnvVars(clientSet clientSetV.Clientset, loadtestName string) (map[string]string, error)

GetLoadTestEnvVars returns a load test name

func GetLoadTestLabels

func GetLoadTestLabels(clientSet clientSetV.Clientset, loadtestName string) (map[string]string, error)

GetLoadTestLabels returns load test labels.

func GetLoadTestNamespace

func GetLoadTestNamespace(clientSet clientSetV.Clientset, loadtestName string) (string, error)

GetLoadTestNamespace returns a load test namespace

func GetLoadTestPhase

func GetLoadTestPhase(clientSet clientSetV.Clientset, loadtestName string) (string, error)

GetLoadTestPhase returns the current phase of given loadtest

func GetLoadTestTestdata

func GetLoadTestTestdata(clientSet clientSetV.Clientset, loadtestName string) ([]byte, error)

GetLoadTestTestdata returns a load test name

func GetSecret

func GetSecret(clientSet typeV1.CoreV1Interface, namespace string) (coreV1.SecretList, error)

GetSecret returns a list of created secrets according to the given label

func Run

func Run(cfg Config, rr Runner) error

Run runs an instance of kubernetes kubeController

func RunMetricsServer

func RunMetricsServer(cfg Config, rr Runner, stopChan chan struct{}) error

RunMetricsServer starts Prometheus metrics server

func WaitLoadTest

func WaitLoadTest(clientSet clientSetV.Clientset, loadtestName string) error

WaitLoadTest waits until Loadtest resources exists

Types

type Config

type Config struct {
	HTTPPort int `envconfig:"WEB_HTTP_PORT" default:"8080"`
	Logger   observability.LoggerConfig

	// CleanUpThresholdEnvVar is used if we want to increase the amount of time a
	// load test lives for, the default is 1 hour. (ex. 5h)
	CleanUpThreshold time.Duration `envconfig:"CLEANUP_THRESHOLD" default:"1h"`

	// S3 compatible configuration access keys and endpoints needed to store load test reports
	KangalProxyURL string `envconfig:"KANGAL_PROXY_URL" default:""`

	// KubeClientTimeout specifies timeout for each operation done by kube client
	KubeClientTimeout time.Duration `envconfig:"KUBE_CLIENT_TIMEOUT" default:"5s"`

	// SyncHandlerTimeout specifies the time limit for each sync operation
	SyncHandlerTimeout time.Duration `envconfig:"SYNC_HANDLER_TIMEOUT" default:"60s"`

	MasterURL            string
	KubeConfig           string
	NamespaceAnnotations map[string]string
	PodAnnotations       map[string]string
	NodeSelectors        map[string]string
	Tolerations          kubernetes.Tolerations
}

Config is the possible Kangal Controller configurations

type Controller

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

Controller is the controller implementation for LoadTest resources

func NewController

func NewController(
	cfg Config,
	kubeClientSet kubernetes.Interface,
	kangalClientSet clientSetV.Interface,
	kubeInformerFactory informers.SharedInformerFactory,
	kangalInformerFactory externalversions.SharedInformerFactory,
	statsClient MetricsReporter,
	registry backends.Registry,
	logger *zap.Logger,
) *Controller

NewController returns a new sample controller

func (*Controller) Run

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

Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the workQueue and wait for workers to finish processing their current work items.

type MetricsReporter

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

MetricsReporter used to interface with the metrics configurations

func NewMetricsReporter

func NewMetricsReporter(meter metric.Meter) (*MetricsReporter, error)

NewMetricsReporter contains loadtest metrics definition

type Runner

type Runner struct {
	Exporter       *otelPrometheus.Exporter
	Logger         *zap.Logger
	KubeClient     kubernetes.Interface
	KangalClient   *clientSetV.Clientset
	KubeInformer   kubeInformers.SharedInformerFactory
	KangalInformer externalversions.SharedInformerFactory
	StatsReporter  *MetricsReporter
}

Runner encapsulates all Kangal Controller dependencies

Jump to

Keyboard shortcuts

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