cleaning up
parent
4d76440b38
commit
69bcd641ac
|
|
@ -45,7 +45,7 @@ type APIClient struct {
|
||||||
connOK bool
|
connOK bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTestClient for testing ONLY!!
|
// NewTestAPIClient for testing ONLY!!
|
||||||
func NewTestAPIClient() *APIClient {
|
func NewTestAPIClient() *APIClient {
|
||||||
return &APIClient{
|
return &APIClient{
|
||||||
config: NewConfig(nil),
|
config: NewConfig(nil),
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@ package client
|
||||||
|
|
||||||
import metricsapi "k8s.io/metrics/pkg/apis/metrics"
|
import metricsapi "k8s.io/metrics/pkg/apis/metrics"
|
||||||
|
|
||||||
|
// Error represents an error.
|
||||||
type Error string
|
type Error string
|
||||||
|
|
||||||
|
// Error returns the error text.
|
||||||
func (e Error) Error() string {
|
func (e Error) Error() string {
|
||||||
return string(e)
|
return string(e)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ func (m *MetricsServer) FetchNodesMetrics(ctx context.Context) (*mv1beta1.NodeMe
|
||||||
return mxList, nil
|
return mxList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FetchNodesMetrics return all metrics for nodes.
|
// FetchNodeMetrics return all metrics for nodes.
|
||||||
func (m *MetricsServer) FetchNodeMetrics(ctx context.Context, n string) (*mv1beta1.NodeMetrics, error) {
|
func (m *MetricsServer) FetchNodeMetrics(ctx context.Context, n string) (*mv1beta1.NodeMetrics, error) {
|
||||||
const msg = "user is not authorized to list node metrics"
|
const msg = "user is not authorized to list node metrics"
|
||||||
|
|
||||||
|
|
@ -243,6 +243,7 @@ func (m *MetricsServer) FetchPodsMetrics(ctx context.Context, ns string) (*mv1be
|
||||||
return mxList, err
|
return mxList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FetchContainersMetrics returns a pod's containers metrics.
|
||||||
func (m *MetricsServer) FetchContainersMetrics(ctx context.Context, fqn string) (ContainersMetrics, error) {
|
func (m *MetricsServer) FetchContainersMetrics(ctx context.Context, fqn string) (ContainersMetrics, error) {
|
||||||
mm, err := m.FetchPodMetrics(ctx, fqn)
|
mm, err := m.FetchPodMetrics(ctx, fqn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,10 @@ var (
|
||||||
// ContainersMetrics tracks containers metrics.
|
// ContainersMetrics tracks containers metrics.
|
||||||
type ContainersMetrics map[string]*mv1beta1.ContainerMetrics
|
type ContainersMetrics map[string]*mv1beta1.ContainerMetrics
|
||||||
|
|
||||||
// NodesMetrics tracks node metrics.
|
// NodesMetricsMap tracks node metrics.
|
||||||
type NodesMetricsMap map[string]*mv1beta1.NodeMetrics
|
type NodesMetricsMap map[string]*mv1beta1.NodeMetrics
|
||||||
|
|
||||||
// PodsMetrics tracks pod metrics.
|
// PodsMetricsMap tracks pod metrics.
|
||||||
type PodsMetricsMap map[string]*mv1beta1.PodMetrics
|
type PodsMetricsMap map[string]*mv1beta1.PodMetrics
|
||||||
|
|
||||||
// Authorizer checks what a user can or cannot do to a resource.
|
// Authorizer checks what a user can or cannot do to a resource.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ func (*SemVer) parse(version string) (major, minor, patch int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize ensures the version starts with a v.
|
// NormalizeVersion ensures the version starts with a v.
|
||||||
func NormalizeVersion(version string) string {
|
func NormalizeVersion(version string) string {
|
||||||
if version == "" {
|
if version == "" {
|
||||||
return version
|
return version
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue