pkg

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientset

func GetClientset(kubeconfig, context string) (*kubernetes.Clientset, error)

func GetDaemonsets

func GetDaemonsets(ctx context.Context, clientset kubernetes.Interface, namespace string) (*v1.DaemonSetList, error)

func GetDefaultKubernetesContextAndNamespace

func GetDefaultKubernetesContextAndNamespace(kubeconfig string) (string, string)

func GetDeployments

func GetDeployments(ctx context.Context, clientset kubernetes.Interface, namespace string) (*v1.DeploymentList, error)

func GetKubernetesContexts

func GetKubernetesContexts(kubeconfig string) ([]string, error)

func GetNamespaces

func GetNamespaces(ctx context.Context, clientset kubernetes.Interface) []string

func GetStatefulSets

func GetStatefulSets(ctx context.Context, clientset kubernetes.Interface, namespace string) (*v1.StatefulSetList, error)

func IsDaemonSetReady

func IsDaemonSetReady(ds *v1.DaemonSet, downscaled bool) bool

func IsDeploymentReady

func IsDeploymentReady(ds *v1.Deployment, downscaled bool) bool

func IsStatefulSetReady

func IsStatefulSetReady(ss *v1.StatefulSet, downscaled bool) bool

func WaitForDaemonSets

func WaitForDaemonSets(ctx context.Context, clientset kubernetes.Interface, daemonsets *v1.DaemonSetList, timeout time.Duration, downscaled bool) error

func WaitForDeployments

func WaitForDeployments(ctx context.Context, clientset kubernetes.Interface, deployments *v1.DeploymentList, timeout time.Duration, downscaled bool) error

func WaitForStatefulSets

func WaitForStatefulSets(ctx context.Context, clientset kubernetes.Interface, statefulsets *v1.StatefulSetList, timeout time.Duration, downscaled bool) error

Types

type NamespaceResult added in v1.14.1

type NamespaceResult struct {
	Namespace    string
	Deployments  ResourceGroup
	StatefulSets ResourceGroup
	DaemonSets   ResourceGroup
}

NamespaceResult contains all scaling results for a namespace

type ResourceGroup added in v1.14.1

type ResourceGroup struct {
	Type      string // "Deployments", "StatefulSets", "DaemonSets"
	Resources []ScaleInfo
	Skipped   bool
}

ResourceGroup groups resources by type for tree output

type ScaleInfo added in v1.14.1

type ScaleInfo struct {
	Name     string
	Replicas int32
	Scaled   bool
	Warning  string // if not scaled, this contains the reason
}

ScaleInfo contains information about a scaling operation

func DownscaleDaemonsets

func DownscaleDaemonsets(ctx context.Context, clientset kubernetes.Interface, daemonsets *v1.DaemonSetList, dryRun bool) ([]ScaleInfo, error)

func DownscaleDeployments

func DownscaleDeployments(ctx context.Context, clientset kubernetes.Interface, deployments *v1.DeploymentList, dryRun bool) ([]ScaleInfo, error)

func DownscaleStatefulSets

func DownscaleStatefulSets(ctx context.Context, clientset kubernetes.Interface, statefulsets *v1.StatefulSetList, dryRun bool) ([]ScaleInfo, error)

func UpscaleDaemonsets

func UpscaleDaemonsets(ctx context.Context, clientset kubernetes.Interface, daemonsets *v1.DaemonSetList, dryRun bool) ([]ScaleInfo, error)

func UpscaleDeployments

func UpscaleDeployments(ctx context.Context, clientset kubernetes.Interface, deployments *v1.DeploymentList, dryRun bool) ([]ScaleInfo, error)

func UpscaleStatefulSets

func UpscaleStatefulSets(ctx context.Context, clientset kubernetes.Interface, statefulsets *v1.StatefulSetList, dryRun bool) ([]ScaleInfo, error)

type TreePrinter added in v1.14.1

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

TreePrinter provides a tree-style output for scaling operations

func NewTreePrinter added in v1.14.1

func NewTreePrinter() *TreePrinter

NewTreePrinter creates a new TreePrinter

func NewTreePrinterWithWriter added in v1.14.1

func NewTreePrinterWithWriter(w io.Writer) *TreePrinter

NewTreePrinterWithWriter creates a TreePrinter with a custom writer

func (*TreePrinter) PrintNamespaceResult added in v1.14.1

func (tp *TreePrinter) PrintNamespaceResult(result NamespaceResult) error

PrintNamespaceResult prints the scaling result for a namespace in tree format

Jump to

Keyboard shortcuts

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