diff --git a/.golangci.yml b/.golangci.yml index 811989a1b..93e3798b3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -56,6 +56,8 @@ linters-settings: - '^github.com/prometheus/client_golang/prometheus(/.*)?\.\w+Opts$' - '^github\.com/containerd/cgroups/v3/cgroup2\.(Resources|Memory)' - '^github\.com/tychoish/fun/pubsub\.BrokerOptions$' + - '^github\.com/neondatabase/autoscaling/pkg/util\.JSONPatch$' + - '^github\.com/neondatabase/autoscaling/pkg/util/watch\.HandlerFuncs$' # vmapi.{VirtualMachine,VirtualMachineSpec,VirtualMachineMigration,VirtualMachineMigrationSpec} - '^github\.com/neondatabase/autoscaling/neonvm/apis/neonvm/v1\.VirtualMachine(Migration)?(Spec)?$' diff --git a/pkg/plugin/config.go b/pkg/plugin/config.go index 75d3ebbab..79a349758 100644 --- a/pkg/plugin/config.go +++ b/pkg/plugin/config.go @@ -273,6 +273,7 @@ func (c *nodeConfig) vCpuLimits(total *resource.Quantity) (_ nodeResourceState[v Total: vmapi.MilliCPU(totalMilli), Watermark: vmapi.MilliCPU(c.Cpu.Watermark * float32(totalMilli)), Reserved: 0, + Buffer: 0, CapacityPressure: 0, PressureAccountedFor: 0, }, margin, nil @@ -301,6 +302,7 @@ func (c *nodeConfig) memoryLimits( Total: uint16(totalSlots), Watermark: uint16(c.Memory.Watermark * float32(totalSlots)), Reserved: 0, + Buffer: 0, CapacityPressure: 0, PressureAccountedFor: 0, }, margin, nil diff --git a/pkg/util/watch/watch.go b/pkg/util/watch/watch.go index 62a8d78af..43863b2df 100644 --- a/pkg/util/watch/watch.go +++ b/pkg/util/watch/watch.go @@ -149,12 +149,15 @@ func Watch[C Client[L], L metav1.ListMetaAccessor, T any, P Object[T]]( sendStop, stopSignal := util.NewSingleSignalPair[struct{}]() store := Store[T]{ + mutex: sync.Mutex{}, objects: make(map[types.UID]*T), triggerRelist: make(chan struct{}, 1), // ensure sends are non-blocking relisted: make(chan struct{}), nextIndexID: 0, indexes: make(map[uint64]Index[T]), stopSignal: sendStop, + stopped: atomic.Bool{}, + failing: atomic.Bool{}, } items := accessors.Items(initialList)