Documentation ¶
Index ¶
- Variables
- type Fetcher
- type Ratio
- func (r Ratio) Below(limit resource.Quantity, threshold *inf.Dec) bool
- func (r Ratio) Ratio() *resource.Quantity
- func (r *Ratio) RecordDeployment(deps ...appsv1.Deployment) *Ratio
- func (r *Ratio) RecordPod(pods ...corev1.Pod) *Ratio
- func (r *Ratio) RecordStatefulSet(stss ...appsv1.StatefulSet) *Ratio
- func (r Ratio) String() string
- func (r Ratio) Warn(limit *resource.Quantity, nodeSelector string) string
Constants ¶
This section is empty.
Variables ¶
var ErrorDisabled error = errors.New("request ratio validation disabled")
ErrorDisabled is returned if the request ratio validation is disabled
var RatioValidatiorDisableAnnotation = "validate-request-ratio.appuio.io/disable"
RatioValidatiorDisableAnnotation is the key for an annotion on a namespace to disable request ratio warnings
Functions ¶
This section is empty.
Types ¶
type Ratio ¶
Ratio records resource requests and can calculate the current memory to CPU request ratio
func (Ratio) Below ¶
Below returns if the memory to CPU ratio of the recorded objects is below the given limit. Always returns false if no CPU is requested. The limit is multiplied by the optional threshold before comparison. If threshold is nil, it defaults to 1. A threshold of 0.95 would mean that the function returns true if the ratio is below 95% of the limit.
func (Ratio) Ratio ¶
Ratio returns the memory to CPU ratio of the recorded objects. Returns nil if there are no CPU requests. Ratio rounds up to the nearest MiB
func (*Ratio) RecordDeployment ¶
func (r *Ratio) RecordDeployment(deps ...appsv1.Deployment) *Ratio
RecordDeployment collects all requests in the given deployment(s) and adds it to the ratio
func (*Ratio) RecordPod ¶
RecordPod collects all requests in the given Pod(s), and adds it to the ratio The function only considers pods in phase `Running`.
func (*Ratio) RecordStatefulSet ¶
func (r *Ratio) RecordStatefulSet(stss ...appsv1.StatefulSet) *Ratio
RecordStatefulSet collects all requests in the given StatefulSet(s) and adds it to the ratio