Documentation ¶
Overview ¶
Package kubeapi implements function and type to operate kubernetes common resource.
Index ¶
- func CalcAndRoundMetricsRatio(usage, limit int64) float64
- func FetchContainerMetricsMean(ctx context.Context, wg *sync.WaitGroup, cl metricsClientset.Interface, ...)
- func InitClient(k8sCtxName string) (ctrlClient.Client, error)
- func InitMetricsClient(k8sCtxName string) (*metricsClientset.Clientset, error)
- type MetricsField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcAndRoundMetricsRatio ¶
CalcAndRoundMetricsRatio calculate ratio by resource usage and limit.
func FetchContainerMetricsMean ¶
func FetchContainerMetricsMean( ctx context.Context, wg *sync.WaitGroup, cl metricsClientset.Interface, resultCh chan MetricsField, receiveGatlingFinishedCh chan bool, podConfig cfg.TargetPodConfig, )
FetchContainerMetricsMean returns container resources value mean.
Fetch metrics value every 5 seconds until informerCh get value or context done. Cpu and Memory value is rounded and cast from *inf.Dec to int64. If error occured this error only log error and continue to run. (not returns error object)
func InitClient ¶
func InitClient(k8sCtxName string) (ctrlClient.Client, error)
InitClient returns client of kubeapi.
use for operate gatling object.
func InitMetricsClient ¶
func InitMetricsClient(k8sCtxName string) (*metricsClientset.Clientset, error)
InitMetricsClient returns clientset of metrics.
Types ¶
type MetricsField ¶
MetricsField hold container metrics value.
func FetchContainerResourcesLimit ¶
func FetchContainerResourcesLimit( ctx context.Context, cl ctrlClient.Client, podConfig cfg.TargetPodConfig, ) (*MetricsField, error)
FetchContainerResourcesLimit fetch specified container and get resources limits or requests field value.