Documentation ¶
Index ¶
- Variables
- type Ratio
- func (r Ratio) Below(limit resource.Quantity) 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
- type RatioValidator
Constants ¶
This section is empty.
Variables ¶
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 ¶
type Ratio struct {
// contains filtered or unexported fields
}
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.
func (Ratio) Ratio ¶
Ratio returns the memory to CPU ratio of the recorded objects. Returns nil if there are no CPU requests.
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
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
type RatioValidator ¶
type RatioValidator struct { RatioLimit *resource.Quantity // contains filtered or unexported fields }
RatioValidator checks for every action in a namespace whether the Memory to CPU ratio limit is exceeded and will return a warning if it is.
func (*RatioValidator) InjectClient ¶
func (v *RatioValidator) InjectClient(c client.Client) error
InjectClient injects a Kubernetes client
func (*RatioValidator) InjectDecoder ¶
func (v *RatioValidator) InjectDecoder(d *admission.Decoder) error
InjectDecoder injects a Admission request decoder