Documentation ¶
Index ¶
- Constants
- type ContentType
- type HTTPError
- type KubeGroupVersionResource
- type LoadProfile
- type LoadProfileSpec
- type RequestGet
- type RequestGetPodLog
- type RequestList
- type RequestPut
- type ResponseError
- type ResponseErrorType
- type ResponseStats
- type RunnerGroup
- type RunnerGroupSpec
- type RunnerGroupStatus
- type RunnerGroupStatusState
- type RunnerGroupsReport
- type RunnerMetricReport
- type WeightedRequest
Constants ¶
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 HTTPError ¶ added in v0.0.2
type HTTPError struct {
ErrorMessage string `json:"error"`
}
HTTPError is used to render response for error.
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 ResponseError ¶ added in v0.1.7
type ResponseError struct { // URL indicates target resource. URL string `json:"url"` // Timestamp indicates when this error was received. Timestamp time.Time `json:"timestamp"` // Duration records timespan in seconds. Duration float64 `json:"duration"` // Type indicates that category to which the error belongs. Type ResponseErrorType `json:"type"` // Code only works when Type is http. Code int `json:"code"` // Message shows error message for this error. // // NOTE: When Type is http, this field will be empty. Message string `json:"message"` }
ResponseError is the record about that error.
type ResponseErrorType ¶ added in v0.1.7
type ResponseErrorType string
ResponseErrorType is error type of response.
const ( // ResponseErrorTypeUnknown indicates we don't have correct category for errors. ResponseErrorTypeUnknown ResponseErrorType = "unknown" // ResponseErrorTypeHTTP indicates that the response returns http code >= 400. ResponseErrorTypeHTTP ResponseErrorType = "http" // ResponseErrorTypeHTTP2Protocol indicates that error comes from http2 layer. ResponseErrorTypeHTTP2Protocol ResponseErrorType = "http2-protocol" // ResponseErrorTypeConnection indicates that error is related to connection. // For instance, connection refused caused by server down. ResponseErrorTypeConnection ResponseErrorType = "connection" )
type ResponseStats ¶
type ResponseStats struct { // Errors stores all the observed errors. Errors []ResponseError // LatenciesByURL stores all the observed latencies for each request. LatenciesByURL map[string][]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"` // Errors stores all the observed errors. Errors []ResponseError `json:"errors,omitempty"` // ErrorStats means summary of errors group by type. ErrorStats map[string]int32 `json:"errorStats,omitempty"` // TotalReceivedBytes is total bytes read from apiserver. TotalReceivedBytes int64 `json:"totalReceivedBytes"` // LatenciesByURL stores all the observed latencies. LatenciesByURL map[string][]float64 `json:"latenciesByURL,omitempty"` // PercentileLatencies represents the latency distribution in seconds. PercentileLatencies [][2]float64 `json:"percentileLatencies,omitempty"` // PercentileLatenciesByURL represents the latency distribution in seconds per request. PercentileLatenciesByURL map[string][][2]float64 `json:"percentileLatenciesByURL,omitempty"` }
type WeightedRequest ¶
type WeightedRequest struct { 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"` }Shares
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.