common

package
v0.0.0-...-5aef5f5 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

pkg/common/client.go

Index

Constants

This section is empty.

Variables

View Source
var PrerequisitesReportHTML string

Functions

func BuildFullDumpYAML

func BuildFullDumpYAML(cd *ClusterData) string

func BuildHTMLReport

func BuildHTMLReport(data *ReportData, tpl string) string

func BuildKubeClient

func BuildKubeClient() (*kubernetes.Clientset, bool)

func BuildValuesYAML

func BuildValuesYAML(d *ReportData) string

func GenerateOutput

func GenerateOutput(sizingReportData *ReportData, inCluster bool)

func WriteToConfigMap

func WriteToConfigMap(htmlContent, helmValuesContent, fullDumpContent string)

func WriteToDisk

func WriteToDisk(htmlContent, helmValuesContent, fullDumpContent string)

Types

type ClusterData

type ClusterData struct {
	Nodes        []corev1.Node
	Pods         []corev1.Pod
	Services     []corev1.Service
	Deployments  []appsv1.Deployment
	ReplicaSets  []appsv1.ReplicaSet
	StatefulSets []appsv1.StatefulSet
	DaemonSets   []appsv1.DaemonSet
	Jobs         []batchv1.Job
	CronJobs     []batchv1.CronJob

	ClusterDetails    ClusterDetails
	NodeInfoSummaries NodeInfoSummary
}

ClusterData aggregates everything we collect from the cluster.

func CollectClusterData

func CollectClusterData(ctx context.Context, clientset *kubernetes.Clientset) (*ClusterData, error)

type ClusterDetails

type ClusterDetails struct {
	Name            string
	Version         string
	CloudProvider   string
	K8sDistribution string
	TotalNodeCount  int
	TotalVCPUCount  int
}

ClusterDetails stores metadata about the cluster

type NodeInfoSummary

type NodeInfoSummary struct {
	OperatingSystemCounts         map[string]int
	ArchitectureCounts            map[string]int
	KernelVersionCounts           map[string]int
	OSImageCounts                 map[string]int
	ContainerRuntimeVersionCounts map[string]int
	KubeletVersionCounts          map[string]int
	KubeProxyVersionCounts        map[string]int
}

type ReportData

type ReportData struct {
	TotalResources          int
	MaxNodeCPUCapacity      int
	MaxNodeMemoryMB         int
	LargestContainerImageMB int

	DefaultResourceAllocations map[string]map[string]string
	FinalResourceAllocations   map[string]map[string]string

	KubernetesVersion string
	CloudProvider     string
	K8sDistribution   string
	TotalNodeCount    int
	TotalVCPUCount    int

	GenerationTime    string
	HasAnyAdjustments bool

	NodeOSSummary               string
	NodeArchSummary             string
	NodeKernelVersionSummary    string
	NodeOSImageSummary          string
	NodeContainerRuntimeSummary string
	NodeKubeletVersionSummary   string
	NodeKubeProxyVersionSummary string

	FullClusterData *ClusterData

	PVProvisioningMessage string
}

func BuildReportData

func BuildReportData(cd *ClusterData, sr *SizingResult) *ReportData

type SizingResult

type SizingResult struct {
	TotalResources          int
	MaxNodeCPUCapacity      int
	MaxNodeMemoryMB         int
	LargestContainerImageMB int

	// Final recommended resource allocations for each component
	FinalResourceAllocations map[string]map[string]string
	// Default resource allocations (if you need them, or remove if not)
	DefaultResourceAllocations map[string]map[string]string

	// Whether any resource changed from default
	HasAnyAdjustments bool
}

Jump to

Keyboard shortcuts

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