calc

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package calc provides function to calculate resource quotas for different k8s resources.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrResourceNotSupported is returned if a k8s resource is not supported by kuota-calc.
	ErrResourceNotSupported = errors.New("resource not supported")
)

Functions

This section is empty.

Types

type CalculationError added in v0.1.0

type CalculationError struct {
	Version string
	Kind    string
	// contains filtered or unexported fields
}

CalculationError is an error implementation that includes a k8s Kind/Version.

func (CalculationError) Error added in v0.1.0

func (cErr CalculationError) Error() string

func (CalculationError) Unwrap added in v0.1.0

func (cErr CalculationError) Unwrap() error

Unwrap implements the errors.Unwrap interface.

type Details

type Details struct {
	Version     string
	Kind        string
	Name        string
	Strategy    string
	Replicas    int32
	MaxReplicas int32
}

Details contains a few details of a k8s resource, which are needed to generate a detailed resource usage report.

type ResourceUsage

type ResourceUsage struct {
	CPU     *resource.Quantity
	Memory  *resource.Quantity
	Details Details
}

ResourceUsage summarizes the usage of compute resources for a k8s resource.

func ResourceQuotaFromYaml added in v0.1.0

func ResourceQuotaFromYaml(yamlData []byte) (*ResourceUsage, error)

ResourceQuotaFromYaml decodes a single yaml document into a k8s object. Then performs a type assertion on the object and calculates the resource needs of it. Currently supported: * apps/v1 - Deployment * apps/v1 - StatefulSet * apps/v1 - DaemonSet * batch/v1 - CronJob * batch/v1 - Job * v1 - Pod

Jump to

Keyboard shortcuts

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