pomerium/config/runtime_flags.go
Joe Kralicky 927f24e1ff
Envoy resource monitoring & overload manager configuration (#5106)
* Initial envoy cgroup resource monitor implementation

* Add cgroupv1 support; add metrics instrumentation

* Slight refactor for more efficient memory limit detection

Instead of reading memory.max/limit_in_bytes on every tick, we
read it once, then again only when it is modified.

To support this change, logic for computing the saturation was moved out
of the cgroup driver and into the resource monitor, and the driver
interface now has separate methods for reading memory usage and limit.

* Code cleanup/lint fixes

* Add platform build tags

* Add unit tests

* Fix lint issues

* Add runtime flag to allow disabling resource monitor

* Clamp saturation values to the range [0.0, 1.0]

* Switch to x/sys/unix; handle inotify IN_IGNORED events
2024-05-28 16:57:09 -04:00

34 lines
1.1 KiB
Go

package config
import "golang.org/x/exp/maps"
var (
// RuntimeFlagGRPCDatabrokerKeepalive enables gRPC keepalive to the databroker service
RuntimeFlagGRPCDatabrokerKeepalive = runtimeFlag("grpc_databroker_keepalive", false)
// RuntimeFlagMatchAnyIncomingPort enables ignoring the incoming port when matching routes
RuntimeFlagMatchAnyIncomingPort = runtimeFlag("match_any_incoming_port", true)
// RuntimeFlagLegacyIdentityManager enables the legacy identity manager
RuntimeFlagLegacyIdentityManager = runtimeFlag("legacy_identity_manager", false)
RuntimeFlagEnvoyResourceManagerEnabled = runtimeFlag("envoy_resource_manager_enabled", true)
)
// RuntimeFlag is a runtime flag that can flip on/off certain features
type RuntimeFlag string
// RuntimeFlags is a map of runtime flags
type RuntimeFlags map[RuntimeFlag]bool
func runtimeFlag(txt string, def bool) RuntimeFlag {
key := RuntimeFlag(txt)
defaultRuntimeFlags[key] = def
return key
}
var defaultRuntimeFlags = map[RuntimeFlag]bool{}
func DefaultRuntimeFlags() RuntimeFlags {
return maps.Clone(defaultRuntimeFlags)
}