 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- type ClusterCapacityDetail
- type LabelAnnotationTaintObject
- type NodeCapacityDetail
- type NodeConditionObject
- type NodeCordonHelper
- type NodeDetails
- type NodeDrainHelper
- type NodeUpdateRequestDto
- type PodCapacityDetail
- type PodDelete
- type PodDeleteList
- type PodDeleteStatus
- type PodFilter
- type ResourceDetailObject
Constants ¶
const ( LabelNodeRolePrefix = "node-role.kubernetes.io/" NodeLabelRole = "kubernetes.io/role" Kibibyte = 1024 Mebibyte = 1024 * 1024 Gibibyte = 1024 * 1024 * 1024 Megabyte = 1000 * 1000 Gigabyte = 1000 * 1000 * 1000 )
const ( AWSNodeGroupLabel = "alpha.eksctl.io/nodegroup-name" AzureNodeGroupLabel = "kubernetes.azure.com/agentpool" GcpNodeGroupLabel = "cloud.google.com/gke-nodepool" KopsNodeGroupLabel = "kops.k8s.io/instancegroup" AWSEKSNodeGroupLabel = "eks.amazonaws.com/nodegroup" )
below const set is used for pod filters
const ( // PodDeleteStatusTypeOkay is "Okay" PodDeleteStatusTypeOkay = "Okay" // PodDeleteStatusTypeSkip is "Skip" PodDeleteStatusTypeSkip = "Skip" // PodDeleteStatusTypeWarning is "Warning" PodDeleteStatusTypeWarning = "Warning" // PodDeleteStatusTypeError is "Error" PodDeleteStatusTypeError = "Error" )
below const set is used for pod delete status
const NamespaceAll string = ""
    Variables ¶
var NodeGroupLabels = [5]string{AWSNodeGroupLabel, AzureNodeGroupLabel, GcpNodeGroupLabel, KopsNodeGroupLabel, AWSEKSNodeGroupLabel}
    TODO: add any new nodeGrouplabel in this array
Functions ¶
This section is empty.
Types ¶
type ClusterCapacityDetail ¶
type ClusterCapacityDetail struct {
	Id                int                                   `json:"id,omitempty"`
	Name              string                                `json:"name,omitempty"`
	ErrorInConnection string                                `json:"errorInNodeListing,omitempty"`
	NodeCount         int                                   `json:"nodeCount,omitempty"`
	NodeDetails       []NodeDetails                         `json:"nodeDetails"`
	NodeErrors        map[corev1.NodeConditionType][]string `json:"nodeErrors"`
	NodeK8sVersions   []string                              `json:"nodeK8sVersions"`
	ServerVersion     string                                `json:"serverVersion,omitempty"`
	Cpu               *ResourceDetailObject                 `json:"cpu"`
	Memory            *ResourceDetailObject                 `json:"memory"`
}
    type NodeCapacityDetail ¶
type NodeCapacityDetail struct {
	Name          string                              `json:"name"`
	Version       string                              `json:"version,omitempty"`
	Kind          string                              `json:"kind,omitempty"`
	Roles         []string                            `json:"roles"`
	K8sVersion    string                              `json:"k8sVersion"`
	Cpu           *ResourceDetailObject               `json:"cpu,omitempty"`
	Memory        *ResourceDetailObject               `json:"memory,omitempty"`
	Age           string                              `json:"age,omitempty"`
	Status        string                              `json:"status,omitempty"`
	PodCount      int                                 `json:"podCount,omitempty"`
	Errors        map[corev1.NodeConditionType]string `json:"errors"`
	InternalIp    string                              `json:"internalIp"`
	ExternalIp    string                              `json:"externalIp"`
	Unschedulable bool                                `json:"unschedulable"`
	CreatedAt     string                              `json:"createdAt"`
	Labels        []*LabelAnnotationTaintObject       `json:"labels,omitempty"`
	Annotations   []*LabelAnnotationTaintObject       `json:"annotations,omitempty"`
	Taints        []*LabelAnnotationTaintObject       `json:"taints,omitempty"`
	Conditions    []*NodeConditionObject              `json:"conditions,omitempty"`
	Resources     []*ResourceDetailObject             `json:"resources,omitempty"`
	Pods          []*PodCapacityDetail                `json:"pods,omitempty"`
	Manifest      unstructured.Unstructured           `json:"manifest,omitempty"`
	ClusterName   string                              `json:"clusterName,omitempty"`
	NodeGroup     string                              `json:"nodeGroup"`
}
    type NodeConditionObject ¶
type NodeCordonHelper ¶
type NodeCordonHelper struct {
	UnschedulableDesired bool `json:"unschedulableDesired"`
}
    type NodeDetails ¶
type NodeDetails struct {
	NodeName  string                        `json:"nodeName"`
	NodeGroup string                        `json:"nodeGroup"`
	Taints    []*LabelAnnotationTaintObject `json:"taints"`
}
    type NodeDrainHelper ¶
type NodeDrainHelper struct {
	Force              bool `json:"force"`
	DeleteEmptyDirData bool `json:"deleteEmptyDirData"`
	// GracePeriodSeconds is how long to wait for a pod to terminate.
	// IMPORTANT: 0 means "delete immediately"; set to a negative value
	// to use the pod's terminationGracePeriodSeconds.
	GracePeriodSeconds  int  `json:"gracePeriodSeconds"`
	IgnoreAllDaemonSets bool `json:"ignoreAllDaemonSets"`
	// DisableEviction forces drain to use delete rather than evict
	DisableEviction bool `json:"disableEviction"`
	K8sClientSet    *kubernetes.Clientset
}
    func (*NodeDrainHelper) MakeFilters ¶
func (f *NodeDrainHelper) MakeFilters() []PodFilter
type NodeUpdateRequestDto ¶
type NodeUpdateRequestDto struct {
	ClusterId        int               `json:"clusterId"`
	Name             string            `json:"name"`
	ManifestPatch    string            `json:"manifestPatch"`
	Version          string            `json:"version"`
	Kind             string            `json:"kind"`
	Taints           []corev1.Taint    `json:"taints"`
	NodeCordonHelper *NodeCordonHelper `json:"nodeCordonOptions"`
	NodeDrainHelper  *NodeDrainHelper  `json:"nodeDrainOptions"`
}
    type PodCapacityDetail ¶
type PodCapacityDetail struct {
	Name      string                `json:"name"`
	Namespace string                `json:"namespace"`
	Cpu       *ResourceDetailObject `json:"cpu"`
	Memory    *ResourceDetailObject `json:"memory"`
	Age       string                `json:"age"`
	CreatedAt string                `json:"createdAt"`
}
    type PodDelete ¶
type PodDelete struct {
	Pod    corev1.Pod
	Status PodDeleteStatus
}
    PodDelete informs filtering logic whether a pod should be deleted or not
type PodDeleteList ¶
type PodDeleteList struct {
	// contains filtered or unexported fields
}
    PodDeleteList is a wrapper around []PodDelete
func FilterPods ¶
func FilterPods(podList *corev1.PodList, filters []PodFilter) *PodDeleteList
func (*PodDeleteList) Errors ¶
func (l *PodDeleteList) Errors() []error
func (*PodDeleteList) Pods ¶
func (l *PodDeleteList) Pods() []corev1.Pod
Pods returns a list of all pods marked for deletion after filtering.
type PodDeleteStatus ¶
PodDeleteStatus informs filters if a pod should be deleted
func MakePodDeleteStatusOkay ¶
func MakePodDeleteStatusOkay() PodDeleteStatus
MakePodDeleteStatusOkay is a helper method to return the corresponding PodDeleteStatus
func MakePodDeleteStatusSkip ¶
func MakePodDeleteStatusSkip() PodDeleteStatus
MakePodDeleteStatusSkip is a helper method to return the corresponding PodDeleteStatus
func MakePodDeleteStatusWithError ¶
func MakePodDeleteStatusWithError(message string) PodDeleteStatus
MakePodDeleteStatusWithError is a helper method to return the corresponding PodDeleteStatus
func MakePodDeleteStatusWithWarning ¶
func MakePodDeleteStatusWithWarning(delete bool, message string) PodDeleteStatus
MakePodDeleteStatusWithWarning is a helper method to return the corresponding PodDeleteStatus
type PodFilter ¶
type PodFilter func(corev1.Pod) PodDeleteStatus
PodFilter takes a pod and returns a PodDeleteStatus
type ResourceDetailObject ¶
type ResourceDetailObject struct {
	ResourceName      string `json:"name,omitempty"`
	Capacity          string `json:"capacity,omitempty"`
	Allocatable       string `json:"allocatable,omitempty"`
	Usage             string `json:"usage,omitempty"`
	Request           string `json:"request,omitempty"`
	Limit             string `json:"limit,omitempty"`
	UsagePercentage   string `json:"usagePercentage,omitempty"`
	RequestPercentage string `json:"requestPercentage,omitempty"`
	LimitPercentage   string `json:"limitPercentage,omitempty"`
	//below fields to be used at FE for sorting
	CapacityInBytes    int64 `json:"capacityInBytes,omitempty"`
	AllocatableInBytes int64 `json:"allocatableInBytes,omitempty"`
	UsageInBytes       int64 `json:"usageInBytes,omitempty"`
	RequestInBytes     int64 `json:"requestInBytes,omitempty"`
	LimitInBytes       int64 `json:"limitInBytes,omitempty"`
}