extcommon

package
v2.6.10 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNodeLabels

func AddNodeLabels(nodes []*corev1.Node, nodeName string, attributes map[string][]string) map[string][]string

func GetDomainnames

func GetDomainnames(node *v1.Node) []string

func GetHostname

func GetHostname(node *v1.Node) string

func GetKubeScoreForDaemonSet

func GetKubeScoreForDaemonSet(daemonSet *appsv1.DaemonSet, services []*corev1.Service) map[string][]string

func GetKubeScoreForDeployment

func GetKubeScoreForDeployment(deployment *appsv1.Deployment, services []*corev1.Service, hpa *autoscalingv2.HorizontalPodAutoscaler) map[string][]string

func GetKubeScoreForStatefulSet

func GetKubeScoreForStatefulSet(statefulSet *appsv1.StatefulSet, services []*corev1.Service) map[string][]string

func GetNodeHostnameAndFQDNs

func GetNodeHostnameAndFQDNs(nodes []*v1.Node, name string) (hostname string, fqdn []string)

func GetPodBasedAttributes

func GetPodBasedAttributes(ownerType string, owner metav1.ObjectMeta, pods []*v1.Pod, nodes []*v1.Node) map[string][]string

func GetServiceNames

func GetServiceNames(services []*v1.Service) map[string][]string

func NewAttributeDescriber

func NewAttributeDescriber() discovery_kit_sdk.AttributeDescriber

func TriggerOnKubernetesResourceChange

func TriggerOnKubernetesResourceChange(k8s *client.Client, t ...reflect.Type) chan struct{}

Types

type CheckMode

type CheckMode string
const (
	PodCountMin1                      CheckMode = "podCountMin1"
	PodCountEqualsDesiredCount        CheckMode = "podCountEqualsDesiredCount"
	PodCountGreaterEqualsDesiredCount CheckMode = "podCountGreaterEqualsDesiredCount"
	PodCountLessThanDesiredCount      CheckMode = "podCountLessThanDesiredCount"
	PodCountDecreased                 CheckMode = "podCountDecreased"
	PodCountIncreased                 CheckMode = "podCountIncreased"
)

type DaemonSet added in v2.6.7

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

func (DaemonSet) FileLocation added in v2.6.7

func (d DaemonSet) FileLocation() ks.FileLocation

func (DaemonSet) GetObjectMeta added in v2.6.7

func (d DaemonSet) GetObjectMeta() metav1.ObjectMeta

func (DaemonSet) GetPodTemplateSpec added in v2.6.7

func (d DaemonSet) GetPodTemplateSpec() corev1.PodTemplateSpec

func (DaemonSet) GetTypeMeta added in v2.6.7

func (d DaemonSet) GetTypeMeta() metav1.TypeMeta

type Deployment added in v2.6.7

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

func (Deployment) Deployment added in v2.6.7

func (d Deployment) Deployment() appsv1.Deployment

func (Deployment) FileLocation added in v2.6.7

func (d Deployment) FileLocation() ks.FileLocation

func (Deployment) GetObjectMeta added in v2.6.7

func (d Deployment) GetObjectMeta() metav1.ObjectMeta

func (Deployment) GetPodTemplateSpec added in v2.6.7

func (d Deployment) GetPodTemplateSpec() corev1.PodTemplateSpec

func (Deployment) GetTypeMeta added in v2.6.7

func (d Deployment) GetTypeMeta() metav1.TypeMeta

type FileLocation added in v2.6.7

type FileLocation struct {
}

func (FileLocation) FileLocation added in v2.6.7

func (f FileLocation) FileLocation() ks.FileLocation

type HpaTargeter added in v2.6.7

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

func (HpaTargeter) FileLocation added in v2.6.7

func (h HpaTargeter) FileLocation() ks.FileLocation

func (HpaTargeter) GetObjectMeta added in v2.6.7

func (h HpaTargeter) GetObjectMeta() metav1.ObjectMeta

func (HpaTargeter) GetTypeMeta added in v2.6.7

func (h HpaTargeter) GetTypeMeta() metav1.TypeMeta

func (HpaTargeter) HpaTarget added in v2.6.7

func (HpaTargeter) MinReplicas added in v2.6.7

func (h HpaTargeter) MinReplicas() *int32

type KubeScoreObjects added in v2.6.7

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

func NewScoreObjects added in v2.6.7

func NewScoreObjects(objects []kubeScoreInput) KubeScoreObjects

func (*KubeScoreObjects) CronJobs added in v2.6.7

func (p *KubeScoreObjects) CronJobs() []ks.CronJob

func (*KubeScoreObjects) Deployments added in v2.6.7

func (p *KubeScoreObjects) Deployments() []ks.Deployment

func (*KubeScoreObjects) HorizontalPodAutoscalers added in v2.6.7

func (p *KubeScoreObjects) HorizontalPodAutoscalers() []ks.HpaTargeter

func (*KubeScoreObjects) Ingresses added in v2.6.7

func (p *KubeScoreObjects) Ingresses() []ks.Ingress

func (*KubeScoreObjects) Metas added in v2.6.7

func (p *KubeScoreObjects) Metas() []ks.BothMeta

func (*KubeScoreObjects) NetworkPolicies added in v2.6.7

func (p *KubeScoreObjects) NetworkPolicies() []ks.NetworkPolicy

func (*KubeScoreObjects) PodDisruptionBudgets added in v2.6.7

func (p *KubeScoreObjects) PodDisruptionBudgets() []ks.PodDisruptionBudget

func (*KubeScoreObjects) PodSpeccers added in v2.6.7

func (p *KubeScoreObjects) PodSpeccers() []ks.PodSpecer

func (*KubeScoreObjects) Pods added in v2.6.7

func (p *KubeScoreObjects) Pods() []ks.Pod

func (*KubeScoreObjects) Services added in v2.6.7

func (p *KubeScoreObjects) Services() []ks.Service

func (*KubeScoreObjects) StatefulSets added in v2.6.7

func (p *KubeScoreObjects) StatefulSets() []ks.StatefulSet

type KubectlAction

type KubectlAction struct {
	Description  action_kit_api.ActionDescription
	OptsProvider KubectlOptsProvider
}

func (KubectlAction) Describe

func (a KubectlAction) Describe() action_kit_api.ActionDescription

func (KubectlAction) NewEmptyState

func (a KubectlAction) NewEmptyState() KubectlActionState

func (KubectlAction) Prepare

func (a KubectlAction) Prepare(ctx context.Context, state *KubectlActionState, request action_kit_api.PrepareActionRequestBody) (*action_kit_api.PrepareResult, error)

func (KubectlAction) Start

func (a KubectlAction) Start(_ context.Context, state *KubectlActionState) (*action_kit_api.StartResult, error)

func (KubectlAction) Status

func (a KubectlAction) Status(_ context.Context, state *KubectlActionState) (*action_kit_api.StatusResult, error)

func (KubectlAction) Stop

func (a KubectlAction) Stop(_ context.Context, state *KubectlActionState) (*action_kit_api.StopResult, error)

type KubectlActionState

type KubectlActionState struct {
	Opts             KubectlOpts `json:"opts"`
	CmdStateID       string      `json:"cmdStateId"`
	Pid              int         `json:"pid"`
	CommandCompleted bool        `json:"commandCompleted"`
}

type KubectlOpts

type KubectlOpts struct {
	Command                     []string `json:"command"`
	RollbackPreconditionCommand []string `json:"rollbackPreconditionCommand,omitempty"`
	RollbackCommand             []string `json:"rollbackCommand,omitempty"`
	LogTargetType               string   `json:"targetType"`
	LogTargetName               string   `json:"targetName"`
	LogActionName               string   `json:"actionName"`
}

type KubectlOptsProvider

type KubectlOptsProvider func(ctx context.Context, request action_kit_api.PrepareActionRequestBody) (*KubectlOpts, error)

type PodCountCheckAction

type PodCountCheckAction struct {
	Client                       *client.Client
	ActionId                     string
	TargetType                   string
	TargetTypeLabel              string
	SelectionTemplates           *action_kit_api.TargetSelectionTemplates
	GetTarget                    func(request action_kit_api.PrepareActionRequestBody) string
	GetDesiredAndCurrentPodCount func(k8s *client.Client, namespace string, target string) (*int32, int32, error)
}

func (PodCountCheckAction) Describe

func (f PodCountCheckAction) Describe() action_kit_api.ActionDescription

func (PodCountCheckAction) NewEmptyState

func (f PodCountCheckAction) NewEmptyState() PodCountCheckState

func (PodCountCheckAction) Prepare

func (f PodCountCheckAction) Prepare(_ context.Context, state *PodCountCheckState, request action_kit_api.PrepareActionRequestBody) (*action_kit_api.PrepareResult, error)

func (PodCountCheckAction) Start

func (f PodCountCheckAction) Start(_ context.Context, _ *PodCountCheckState) (*action_kit_api.StartResult, error)

func (PodCountCheckAction) Status

func (f PodCountCheckAction) Status(_ context.Context, state *PodCountCheckState) (*action_kit_api.StatusResult, error)

type PodCountCheckConfig

type PodCountCheckConfig struct {
	Duration          int
	PodCountCheckMode CheckMode
}

type PodCountCheckState

type PodCountCheckState struct {
	Timeout           time.Time
	PodCountCheckMode CheckMode
	Namespace         string
	Target            string
	InitialCount      int
}

type Service added in v2.6.7

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

func (Service) FileLocation added in v2.6.7

func (d Service) FileLocation() ks.FileLocation

func (Service) Service added in v2.6.7

func (d Service) Service() corev1.Service

type StatefulSet added in v2.6.7

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

func (StatefulSet) FileLocation added in v2.6.7

func (s StatefulSet) FileLocation() ks.FileLocation

func (StatefulSet) GetObjectMeta added in v2.6.7

func (s StatefulSet) GetObjectMeta() metav1.ObjectMeta

func (StatefulSet) GetPodTemplateSpec added in v2.6.7

func (s StatefulSet) GetPodTemplateSpec() corev1.PodTemplateSpec

func (StatefulSet) GetTypeMeta added in v2.6.7

func (s StatefulSet) GetTypeMeta() metav1.TypeMeta

func (StatefulSet) StatefulSet added in v2.6.7

func (s StatefulSet) StatefulSet() appsv1.StatefulSet

Jump to

Keyboard shortcuts

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