watchdog

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

+kubebuilder:validation:Optional

Ported from - https://github.com/raulk/go-watchdog

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Module is a fx module that provides annotated Watchdog jobs and triggers Watchdog checks.

Types

type AdaptivePolicy

type AdaptivePolicy struct {
	PolicyCommon `json:",inline"`

	// Factor sets user-configured limit of available memory
	Factor float64 `json:"factor" validate:"gte=0,lte=1" default:"0.50"`
}

AdaptivePolicy creates a policy that forces GC when the usage surpasses the configured factor of the available memory. This policy calculates next target as usage+(limit-usage)*factor. swagger:model +kubebuilder:object:generate=true

func (*AdaptivePolicy) DeepCopy added in v0.1.2

func (in *AdaptivePolicy) DeepCopy() *AdaptivePolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptivePolicy.

func (*AdaptivePolicy) DeepCopyInto added in v0.1.2

func (in *AdaptivePolicy) DeepCopyInto(out *AdaptivePolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Constructor

type Constructor struct {
	// ConfigKey for config
	ConfigKey string
	// Default config
	DefaultConfig WatchdogConfig
}

Constructor holds fields to set up the Watchdog.

type HeapConfig

type HeapConfig struct {
	WatchdogPolicyType `json:",inline"`

	HeapLimit `json:",inline"`
}

HeapConfig holds configuration for heap Watchdog. swagger:model +kubebuilder:object:generate=true

func (*HeapConfig) DeepCopy added in v0.1.2

func (in *HeapConfig) DeepCopy() *HeapConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeapConfig.

func (*HeapConfig) DeepCopyInto added in v0.1.2

func (in *HeapConfig) DeepCopyInto(out *HeapConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HeapLimit

type HeapLimit struct {
	// Minimum GoGC sets the minimum garbage collection target percentage for heap driven Watchdogs. This setting helps avoid overscheduling.
	MinGoGC int `json:"min_gogc" validate:"gt=0,lte=100" default:"25"`

	// Maximum memory (in bytes) sets limit of process usage. Default = 256MB.
	Limit uint64 `json:"limit" validate:"gt=0" default:"268435456"`
}

HeapLimit holds configuration for Watchdog heap limit. swagger:model +kubebuilder:object:generate=true

func (*HeapLimit) DeepCopy added in v0.1.2

func (in *HeapLimit) DeepCopy() *HeapLimit

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeapLimit.

func (*HeapLimit) DeepCopyInto added in v0.1.2

func (in *HeapLimit) DeepCopyInto(out *HeapLimit)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PolicyCommon

type PolicyCommon struct {
	// Flag to enable the policy
	Enabled bool `json:"enabled" default:"false"`
	// contains filtered or unexported fields
}

PolicyCommon holds common configuration for Watchdog policies. swagger:model +kubebuilder:object:generate=true

func (*PolicyCommon) DeepCopy added in v0.1.2

func (in *PolicyCommon) DeepCopy() *PolicyCommon

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyCommon.

func (*PolicyCommon) DeepCopyInto added in v0.1.2

func (in *PolicyCommon) DeepCopyInto(out *PolicyCommon)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WatchdogConfig

type WatchdogConfig struct {
	Job jobs.JobConfig `json:"job"`

	CGroup WatchdogPolicyType `json:"cgroup"`

	System WatchdogPolicyType `json:"system"`

	Heap HeapConfig `json:"heap"`
}

WatchdogConfig holds configuration for Watchdog Policy. For each policy, either watermark or adaptive should be configured. swagger:model +kubebuilder:object:generate=true

func (*WatchdogConfig) DeepCopy added in v0.1.2

func (in *WatchdogConfig) DeepCopy() *WatchdogConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WatchdogConfig.

func (*WatchdogConfig) DeepCopyInto added in v0.1.2

func (in *WatchdogConfig) DeepCopyInto(out *WatchdogConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WatchdogIn

type WatchdogIn struct {
	fx.In

	StatusRegistry status.Registry
	JobGroup       *jobs.JobGroup `name:"liveness"`
	Unmarshaller   config.Unmarshaller
	Lifecycle      fx.Lifecycle
}

WatchdogIn holds parameters for setupWatchdog.

type WatchdogPolicyType

type WatchdogPolicyType struct {
	WatermarksPolicy WatermarksPolicy `json:"watermarks_policy"`

	AdaptivePolicy AdaptivePolicy `json:"adaptive_policy"`
}

WatchdogPolicyType holds configuration Watchdog Policy algorithms. If both algorithms are configured then only watermark algorithm is used. swagger:model WatchdogPolicyType +kubebuilder:object:generate=true

func (*WatchdogPolicyType) DeepCopy added in v0.1.2

func (in *WatchdogPolicyType) DeepCopy() *WatchdogPolicyType

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WatchdogPolicyType.

func (*WatchdogPolicyType) DeepCopyInto added in v0.1.2

func (in *WatchdogPolicyType) DeepCopyInto(out *WatchdogPolicyType)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WatermarksPolicy

type WatermarksPolicy struct {
	// Watermarks are increasing limits on which to trigger GC. Watchdog disarms when the last watermark is surpassed. It is recommended to set an extreme watermark for the last element (e.g. 0.99).
	Watermarks []float64 `json:"watermarks,omitempty" validate:"omitempty,dive,gte=0,lte=1" default:"[0.50,0.75,0.80,0.85,0.90,0.95,0.99]"`

	PolicyCommon `json:",inline"`
	// contains filtered or unexported fields
}

WatermarksPolicy creates a Watchdog policy that schedules GC at concrete watermarks. swagger:model +kubebuilder:object:generate=true

func (*WatermarksPolicy) DeepCopy added in v0.1.2

func (in *WatermarksPolicy) DeepCopy() *WatermarksPolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WatermarksPolicy.

func (*WatermarksPolicy) DeepCopyInto added in v0.1.2

func (in *WatermarksPolicy) DeepCopyInto(out *WatermarksPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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