k8s

package
v0.0.0-...-dc8fb1e Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//ScaleUp const for scaling up action
	ScaleUp = "UP"
	//ScaleDown const for scaling up action
	ScaleDown = "DOWN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hpa

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

Hpa is the hpa struct

type K8s

type K8s interface {
	Connect() dynamic.Interface
	GetDeployments(Client dynamic.Interface, namespace string) []unstructured.Unstructured
	GetHorizontalPodAutoscalers(Client dynamic.Interface, namespace string) []Hpa
	ScaleDeployments(Client dynamic.Interface, deployments []unstructured.Unstructured)
}

K8s interface for k8s package

type KubernetesAPI

type KubernetesAPI struct {
	Client dynamic.Interface
}

KubernetesAPI is the struct for k8s

func (KubernetesAPI) Connect

func (k KubernetesAPI) Connect() dynamic.Interface

Connect returns new kubernetes Client

func (KubernetesAPI) GetDeployments

func (k KubernetesAPI) GetDeployments(namespace string) []unstructured.Unstructured

GetDeployments gets all deployments from the specified namespace

func (KubernetesAPI) GetHorizontalPodAutoscalers

func (k KubernetesAPI) GetHorizontalPodAutoscalers(namespace string) []Hpa

GetHorizontalPodAutoscalers gets all hpas from all namespaces except kube-system

func (KubernetesAPI) ScaleDeployments

func (k KubernetesAPI) ScaleDeployments(deployments []unstructured.Unstructured, hpas []Hpa, scaleAction string, dryRun bool)

ScaleDeployments scales all deployments from all namespaces except kube-system either down to 0, or up to the minimum replicas if available(or 1)

Jump to

Keyboard shortcuts

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