extcommon

package
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: MIT Imports: 41 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 KubectlAction

type KubectlAction struct {
	Description  action_kit_api.ActionDescription
	OptsProvider KubectlOptsProvider
}

func (KubectlAction) Describe

func (KubectlAction) NewEmptyState

func (a KubectlAction) NewEmptyState() KubectlActionState

func (KubectlAction) Start

func (KubectlAction) Status

func (KubectlAction) Stop

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 (PodCountCheckAction) NewEmptyState

func (f PodCountCheckAction) NewEmptyState() PodCountCheckState

func (PodCountCheckAction) Start

func (PodCountCheckAction) Status

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
}

Jump to

Keyboard shortcuts

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