You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/api/kubernetes/cli/metrics.go

21 lines
467 B

package cli
import (
"context"
models "github.com/portainer/portainer/api/http/models/kubernetes"
"github.com/segmentio/encoding/json"
)
func (kcl *KubeClient) GetMetrics() (models.K8sMetrics, error) {
var metrics models.K8sMetrics
resp, err := kcl.cli.CoreV1().RESTClient().Get().AbsPath("apis/metrics.k8s.io/v1beta1/nodes").DoRaw(context.Background())
if err != nil {
return metrics, err
}
err = json.Unmarshal(resp, &metrics)
return metrics, err
}