types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RunnerGroupStatusStateUnknown represents unknown state.
	RunnerGroupStatusStateUnknown = "unknown"
	// RunnerGroupStatusStateRunning represents runner group is still running.
	RunnerGroupStatusStateRunning = "running"
	// RunnerGroupStatusStateFinished represents all runners finished.
	RunnerGroupStatusStateFinished = "finished"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentType added in v0.0.2

type ContentType string

ContentType represents the format of response.

const (
	// ContentTypeJSON means the format is json.
	ContentTypeJSON ContentType = "json"
	// ContentTypeProtobuffer means the format is protobuf.
	ContentTypeProtobuffer = "protobuf"
)

func (ContentType) Validate added in v0.0.2

func (ct ContentType) Validate() error

Validate returns error if ContentType is not supported.

type HTTP2ErrorStats added in v0.0.2

type HTTP2ErrorStats struct {
	// ConnectionErrors represents connection level errors.
	ConnectionErrors map[string]int32 `json:"connectionErrors,omitempty"`
	// StreamErrors represents stream level errors.
	StreamErrors map[string]int32 `json:"streamErrors,omitempty"`
}

HTTP2ErrorStats is the report about http2 error during testing.

func NewHTTP2ErrorStats added in v0.0.2

func NewHTTP2ErrorStats() *HTTP2ErrorStats

NewHTTP2ErrorStats returns new instance of HTTP2ErrorStats.

type HTTPError added in v0.0.2

type HTTPError struct {
	ErrorMessage string `json:"error"`
}

HTTPError is used to render response for error.

func (HTTPError) Error added in v0.0.2

func (herr HTTPError) Error() string

Error implements error interface.

type KubeGroupVersionResource

type KubeGroupVersionResource struct {
	// Group is the name about a collection of related functionality.
	Group string `json:"group" yaml:"group"`
	// Version is a version of that group.
	Version string `json:"version" yaml:"version"`
	// Resource is a type in that versioned group APIs.
	Resource string `json:"resource" yaml:"resource"`
}

KubeGroupVersionResource identifies the resource URI.

func (*KubeGroupVersionResource) Validate

func (m *KubeGroupVersionResource) Validate() error

Validate validates KubeGroupVersionResource.

type LoadProfile

type LoadProfile struct {
	// Version defines the version of this object.
	Version int `json:"version" yaml:"version"`
	// Description is a string value to describe this object.
	Description string `json:"description,omitempty" yaml:"description"`
	// Spec defines behavior of load profile.
	Spec LoadProfileSpec `json:"spec" yaml:"spec"`
}

LoadProfile defines how to create load traffic from one host to kube-apiserver.

func (LoadProfile) Validate

func (lp LoadProfile) Validate() error

Validate verifies fields of LoadProfile.

type LoadProfileSpec

type LoadProfileSpec struct {
	// Rate defines the maximum requests per second (zero is no limit).
	Rate float64 `json:"rate" yaml:"rate"`
	// Total defines the total number of requests.
	Total int `json:"total" yaml:"total"`
	// Conns defines total number of long connections used for traffic.
	Conns int `json:"conns" yaml:"conns"`
	// Client defines total number of HTTP clients.
	Client int `json:"client" yaml:"client"`
	// ContentType defines response's content type.
	ContentType ContentType `json:"contentType" yaml:"contentType"`
	// DisableHTTP2 means client will use HTTP/1.1 protocol if it's true.
	DisableHTTP2 bool `json:"disableHTTP2" yaml:"disableHTTP2"`
	// MaxRetries makes the request use the given integer as a ceiling of
	// retrying upon receiving "Retry-After" headers and 429 status-code
	// in the response (<= 0 means no retry).
	MaxRetries int `json:"maxRetries" yaml:"maxRetries"`
	// Requests defines the different kinds of requests with weights.
	// The executor should randomly pick by weight.
	Requests []*WeightedRequest
}

LoadProfileSpec defines the load traffic for traget resource.

func (LoadProfileSpec) Validate

func (spec LoadProfileSpec) Validate() error

Validate verifies fields of LoadProfileSpec.

type RequestGet

type RequestGet struct {
	// KubeGroupVersionResource identifies the resource URI.
	KubeGroupVersionResource `yaml:",inline"`
	// Namespace is object's namespace.
	Namespace string `json:"namespace" yaml:"namespace"`
	// Name is object's name.
	Name string `json:"name" yaml:"name"`
}

RequestGet defines GET request for target object.

func (*RequestGet) Validate

func (r *RequestGet) Validate() error

Validate validates RequestGet type.

type RequestGetPodLog added in v0.0.6

type RequestGetPodLog struct {
	// Namespace is pod's namespace.
	Namespace string `json:"namespace" yaml:"namespace"`
	// Name is pod's name.
	Name string `json:"name" yaml:"name"`
	// Container is target for stream logs. If empty, it's only valid
	// when there is only one container.
	Container string `json:"container" yaml:"container"`
	// TailLines is the number of lines from the end of the logs to show,
	// if set.
	TailLines *int64 `json:"tailLines" yaml:"tailLines"`
	// LimitBytes is the number of bytes to read from the server before
	// terminating the log output, if set.
	LimitBytes *int64 `json:"limitBytes" yaml:"limitBytes"`
}

RequestGetPodLog defines GetLog request for target pod.

func (*RequestGetPodLog) Validate added in v0.0.6

func (r *RequestGetPodLog) Validate() error

Validate validates RequestGetPodLog type.

type RequestList

type RequestList struct {
	// KubeGroupVersionResource identifies the resource URI.
	KubeGroupVersionResource `yaml:",inline"`
	// Namespace is object's namespace.
	Namespace string `json:"namespace" yaml:"namespace"`
	// Limit defines the page size.
	Limit int `json:"limit" yaml:"limit"`
	// Selector defines how to identify a set of objects.
	Selector string `json:"seletor" yaml:"seletor"`
	// FieldSelector defines how to identify a set of objects with field selector.
	FieldSelector string `json:"fieldSelector" yaml:"fieldSelector"`
}

RequestList defines LIST request for target objects.

func (*RequestList) Validate

func (r *RequestList) Validate(stale bool) error

RequestList validates RequestList type.

type RequestPut

type RequestPut struct {
	// KubeGroupVersionResource identifies the resource URI.
	//
	// NOTE: Currently, it should be configmap or secrets because we can
	// generate random bytes as blob for it. However, for the pod resource,
	// we need to ensure a lot of things are ready, for instance, volumes,
	// resource capacity. It's not easy to generate it randomly. Maybe we
	// can introduce pod template in the future.
	KubeGroupVersionResource `yaml:",inline"`
	// Namespace is object's namespace.
	Namespace string `json:"namespace" yaml:"namespace"`
	// Name is object's prefix name.
	Name string `json:"name" yaml:"name"`
	// KeySpaceSize is used to generate random number as name's suffix.
	KeySpaceSize int `json:"keySpaceSize" yaml:"keySpaceSize"`
	// ValueSize is the object's size in bytes.
	ValueSize int `json:"valueSize" yaml:"valueSize"`
}

RequestPut defines PUT request for target resource type.

func (*RequestPut) Validate

func (r *RequestPut) Validate() error

Validate validates RequestPut type.

type ResponseErrorStats added in v0.0.2

type ResponseErrorStats struct {
	// UnknownErrors is all unknown errors.
	UnknownErrors []string `json:"unknownErrors"`
	// NetErrors is to track errors from net.
	NetErrors map[string]int32 `json:"netErrors"`
	// ResponseCodes records request number grouped by response
	// code between 400 and 600.
	ResponseCodes map[int]int32 `json:"responseCodes"`
	// HTTP2Errors records http2 related errors.
	HTTP2Errors HTTP2ErrorStats `json:"http2Errors"`
}

ResponseErrorStats is the report about errors.

func NewResponseErrorStats added in v0.0.2

func NewResponseErrorStats() *ResponseErrorStats

NewResponseErrorStats returns empty ResponseErrorStats.

func (*ResponseErrorStats) Copy added in v0.0.2

Copy clones self.

func (*ResponseErrorStats) Merge added in v0.0.2

func (r *ResponseErrorStats) Merge(from *ResponseErrorStats)

Merge merges two ResponseErrorStats.

type ResponseStats

type ResponseStats struct {
	// ErrorStats means summary of errors.
	ErrorStats ResponseErrorStats
	// Latencies stores all the observed latencies.
	Latencies []float64
	// TotalReceivedBytes is total bytes read from apiserver.
	TotalReceivedBytes int64
}

ResponseStats is the report about benchmark result.

type RunnerGroup added in v0.0.2

type RunnerGroup struct {
	// Name is the name of runner group.
	Name string `json:"name" yaml:"name"`
	// Spec is specification of the desired behavior of the runner group.
	Spec *RunnerGroupSpec `json:"spec" yaml:"spec"`
	// Status is current state.
	Status *RunnerGroupStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

RunnerGroup defines a set of runners with same load profile.

type RunnerGroupSpec added in v0.0.2

type RunnerGroupSpec struct {
	// Count is the number of runners.
	Count int32 `json:"count" yaml:"count"`
	// Profile defines what the load traffic looks like.
	Profile *LoadProfile `json:"loadProfile,omitempty" yaml:"loadProfile"`
	// NodeAffinity defines how to deploy runners into dedicated nodes
	// which have specific labels.
	NodeAffinity map[string][]string `json:"nodeAffinity,omitempty" yaml:"nodeAffinity,omitempty"`
	// ServiceAccount is the name of the ServiceAccount to use to run runners.
	ServiceAccount *string `json:"serviceAccount,omitempty" yaml:"serviceAccount,omitempty"`
	// OwnerReference is to mark the runner group depending on this object.
	//
	// FORMAT: APIVersion:Kind:Name:UID
	OwnerReference *string `json:"ownerReference,omitempty" yaml:"ownerReference,omitempty"`
}

RunnerGroupSpec is to descibe how the runner group works.

type RunnerGroupStatus added in v0.0.2

type RunnerGroupStatus struct {
	// State is the current state of RunnerGroup.
	State string `json:"state" yaml:"state"`
	// StartTime represents time when RunnerGroup has been started.
	StartTime *metav1.Time `json:"startTime,omitempty" yaml:"startTime,omitempty"`
	// The number of runners which reached phase Succeeded.
	Succeeded int32 `json:"succeeded" yaml:"succeeded"`
	// The number of runners which reached phase Failed.
	Failed int32 `json:"failed" yaml:"failed"`
}

RunnerGroupStatus represents current state of RunnerGroup.

type RunnerGroupStatusState added in v0.0.2

type RunnerGroupStatusState string

RunnerGroupStatusState is current state of RunnerGroup.

type RunnerGroupsReport added in v0.0.2

type RunnerGroupsReport = RunnerMetricReport

TODO(weifu): build brand new struct for RunnerGroupsReport to include more information, like how many runner groups, service account and flow control.

type RunnerMetricReport added in v0.0.2

type RunnerMetricReport struct {
	// Total represents total number of requests.
	Total int `json:"total"`
	// Duration means the time of benchmark.
	Duration string `json:"duration"`
	// ErrorStats means summary of errors.
	ErrorStats ResponseErrorStats `json:"errorStats"`
	// TotalReceivedBytes is total bytes read from apiserver.
	TotalReceivedBytes int64 `json:"totalReceivedBytes"`
	// Latencies stores all the observed latencies.
	Latencies []float64 `json:"latencies,omitempty"`
	// PercentileLatencies represents the latency distribution in seconds.
	PercentileLatencies [][2]float64 `json:"percentileLatencies,omitempty"`
}

type WeightedRequest

type WeightedRequest struct {
	// Shares defines weight in the same group.
	Shares int `json:"shares" yaml:"shares"`
	// StaleList means this list request with zero resource version.
	StaleList *RequestList `json:"staleList,omitempty" yaml:"staleList,omitempty"`
	// QuorumList means this list request without kube-apiserver cache.
	QuorumList *RequestList `json:"quorumList,omitempty" yaml:"quorumList,omitempty"`
	// StaleGet means this get request with zero resource version.
	StaleGet *RequestGet `json:"staleGet,omitempty" yaml:"staleGet,omitempty"`
	// QuorumGet means this get request without kube-apiserver cache.
	QuorumGet *RequestGet `json:"quorumGet,omitempty" yaml:"quorumGet,omitempty"`
	// Put means this is mutating request.
	Put *RequestPut `json:"put,omitempty" yaml:"put,omitempty"`
	// GetPodLog means this is to get log from target pod.
	GetPodLog *RequestGetPodLog `json:"getPodLog,omitempty" yaml:"getPodLog,omitempty"`
}

WeightedRequest represents request with weight. Only one of request types may be specified.

func (WeightedRequest) Validate

func (r WeightedRequest) Validate() error

Validate verifies fields of WeightedRequest.

Jump to

Keyboard shortcuts

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