kube

package
v0.0.0-...-b9085d8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	MB = 1048576
)

Variables

This section is empty.

Functions

func CollectMetrics

func CollectMetrics(configPath string) error

func Percentage

func Percentage(top int, bottom int) int

func PrettyPrint

func PrettyPrint(nodes map[string]*Node) string

Types

type CTA

type CTA struct {
	Current     int
	Total       int
	Allocatable int
}

func (*CTA) Available

func (cta *CTA) Available() int

func (*CTA) Percentage

func (cta *CTA) Percentage() int

type Config

type Config struct {
	KubeConfigPath string
	Namespace      string
	LogLevel       string
	Port           int
}

func GetConfig

func GetConfig(configPath string) (*Config, error)

GetConfig ...

func (*Config) GetLogLevel

func (config *Config) GetLogLevel() (log.Level, error)

GetLogLevel ...

type Container

type Container struct {
	Name         string
	MemoryBytes  *RLU
	CPUMilli     *RLU
	StorageBytes *RLU
}

type KubeClient

type KubeClient struct {
	// contains filtered or unexported fields
}

func NewKubeClient

func NewKubeClient(kubeConfigPath string) (*KubeClient, error)

func (*KubeClient) Containers

func (kc *KubeClient) Containers(namespace string) map[string]*Namespace

func (*KubeClient) Nodes

func (kc *KubeClient) Nodes() map[string]*Node

type Namespace

type Namespace struct {
	Name string
	Pods map[string]*Pod
}

type Node

type Node struct {
	Name         string
	MemoryBytes  *CTA
	CPUMilli     *CTA
	StorageBytes *CTA
}

type Pod

type Pod struct {
	Name         string
	Containers   map[string]*Container
	MemoryBytes  *RLU
	CPUMilli     *RLU
	StorageBytes *RLU
}

type RLU

type RLU struct {
	Request int
	Limit   int
	Usage   int
}

func (*RLU) LimitPercentage

func (rlu *RLU) LimitPercentage() int

func (*RLU) RequestPercentage

func (rlu *RLU) RequestPercentage() int

Jump to

Keyboard shortcuts

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