rules

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxConcurrentTasks  = 16
	TaskDeadLineSeconds = 60
)

Variables

View Source
var (
	PollingManager = newPollingManager(context.TODO())
)

Functions

func ExtractFieldPathAsString

func ExtractFieldPathAsString(obj interface{}, fieldPath string) (string, error)

func ExtractValueFromPod

func ExtractValueFromPod(pod *corev1.Pod, key, fieldPath string) (value string, err error)

func GetFieldRef

func GetFieldRef(obj runtime.Object, fieldRef string) (interface{}, error)

func Intersection added in v0.2.0

func Intersection(s sets.String, t []string) (res []string)

func NewTrace

func NewTrace() string

Types

type AvailableRuler

type AvailableRuler struct {
	Name string

	MinAvailableValue   *intstr.IntOrString
	MaxUnavailableValue *intstr.IntOrString

	Client client.Client
}

func (*AvailableRuler) Filter

func (r *AvailableRuler) Filter(podTransitionRule *appsv1alpha1.PodTransitionRule, targets map[string]*corev1.Pod, subjects sets.String) *FilterResult

Filter unavailable pods and try approve available pods as much as possible

type FilterResult

type FilterResult struct {
	Passed   sets.String
	Rejected map[string]string
	Interval *time.Duration
	Err      error

	RuleState *appsv1alpha1.RuleState
}

type HttpJob

type HttpJob struct {
	Url      string
	CaBundle []byte

	Timeout  int32
	Interval int32

	Body    interface{}
	TraceId string

	Action string
}

type LabelCheckRuler

type LabelCheckRuler struct {
	Name     string
	Selector *metav1.LabelSelector
}

func (*LabelCheckRuler) Filter

func (l *LabelCheckRuler) Filter(podTransitionRule *appsv1alpha1.PodTransitionRule, targets map[string]*corev1.Pod, subjects sets.String) *FilterResult

type ManualRuler

type ManualRuler struct {
	Name string
	Pass bool
}

func (*ManualRuler) Filter

func (r *ManualRuler) Filter(podTransitionRule *appsv1alpha1.PodTransitionRule, targets map[string]*corev1.Pod, subjects sets.String) *FilterResult

type PollResult added in v0.2.0

type PollResult struct {
	Count         int
	Stopped       bool
	ApproveAll    bool
	Approved      sets.String
	LastMessage   string
	Info          string
	LastError     error
	LastQueryTime time.Time
}

type PollingManagerInterface added in v0.2.0

type PollingManagerInterface interface {
	Delete(id string)
	Add(id, url, caBundle, resourceKey string, timeout, interval time.Duration)
	GetResult(id string) *PollResult
	Start(ctx context.Context)
	AddListener(chan<- event.GenericEvent)
}

type Ruler

type Ruler interface {
	Filter(podTransitionRule *appsv1alpha1.PodTransitionRule, targets map[string]*corev1.Pod, subjects sets.String) *FilterResult
}

func GetRuler

func GetRuler(rule *appsv1alpha1.TransitionRule, client client.Client) Ruler

type Webhook

type Webhook struct {
	Key      string
	RuleName string
	Stage    *string

	Webhook *appsv1alpha1.TransitionRuleWebhook
	State   *appsv1alpha1.RuleState

	Approved func(string) bool
	// contains filtered or unexported fields
}

func GetWebhook

func GetWebhook(pt *appsv1alpha1.PodTransitionRule, names ...string) (webs []*Webhook)

func (*Webhook) Do

func (w *Webhook) Do(targets map[string]*corev1.Pod, subjects sets.String) *FilterResult

type WebhookRuler

type WebhookRuler struct {
	Name string
}

func (*WebhookRuler) Filter

func (r *WebhookRuler) Filter(
	podTransitionRule *appsv1alpha1.PodTransitionRule,
	targets map[string]*corev1.Pod,
	subjects sets.String,
) *FilterResult

Jump to

Keyboard shortcuts

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