Skip to content

Commit 9dc9631

Browse files
authored
1.3.0 (#88)
* added ability to overcommit
1 parent 1196578 commit 9dc9631

12 files changed

Lines changed: 418 additions & 129 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pid_file_dir: /tmp/
104104
# global_database_database: 0
105105
# global_private_key: /Users/{YOUR USER HERE}/.private-key.pem # If you use the same key for all your plugins, you can set it here.
106106
# global_token: github_pat_XXX # If you use the same token for all your plugins, you can set it here.
107+
# global_skip_cpu_and_memory_resource_checks: true # Optional; skip VM CPU/RAM admission checks for all handler plugins (allows overcommit).
107108
# plugins_path: ~/.config/anklet/plugins/ # This sets the location where scripts used by plugins are stored; we don't recommend changing this.
108109
plugins:
109110
```
@@ -136,6 +137,7 @@ It is also possible to use ENVs for several of the items in the config. They ove
136137
| ANKLET_GLOBAL_TOKEN | GitHub token for all plugins (ex: github_pat_XXX) |
137138
| ANKLET_GLOBAL_RECEIVER_SECRET | Secret to use for receiver plugin (ex: "my-secret") |
138139
| ANKLET_GLOBAL_TEMPLATE_DISK_BUFFER | Disk buffer (how much disk space to leave free on the host) percentage for templates (ex: 10.0 for 10%) |
140+
| ANKLET_GLOBAL_SKIP_CPU_AND_MEMORY_RESOURCE_CHECKS | Skip VM CPU/RAM admission checks for all handler plugins (ex: true) |
139141

140142
You can also set or override plugin settings per plugin using envs based on the plugin name:
141143

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.2
1+
1.3.0

internal/config/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type Config struct {
4040
GlobalDatabaseTLSInsecure bool `yaml:"global_database_tls_insecure"`
4141
GlobalReceiverSecret string `yaml:"global_receiver_secret"`
4242
GlobalTemplateDiskBuffer float64 `yaml:"global_template_disk_buffer"` // Global disk buffer percentage (e.g., 10.0 for 10%)
43+
GlobalSkipCPUAndMemoryResourceChecks bool `yaml:"global_skip_cpu_and_memory_resource_checks"` // Global override to skip CPU/RAM resource admission checks
4344
}
4445

4546
type Log struct {
@@ -98,6 +99,7 @@ type Plugin struct {
9899
RegistrationTimeoutSeconds int `yaml:"registration_timeout_seconds"`
99100
TemplateDiskBuffer float64 `yaml:"template_disk_buffer"` // Plugin-specific disk buffer percentage (e.g., 10.0 for 10%)
100101
JobRetryAttempts int `yaml:"job_retry_attempts"` // Maximum number of retry attempts for failed jobs
102+
SkipCPUAndMemoryResourceChecks bool `yaml:"skip_cpu_and_memory_resource_checks"` // Skip CPU/RAM resource admission checks for this plugin
101103
}
102104

103105
// GetQueueOwner returns QueueName if set, otherwise returns Owner.
@@ -250,6 +252,10 @@ func LoadInEnvs(config Config) (Config, error) {
250252
}
251253
config.GlobalTemplateDiskBuffer = buffer
252254
}
255+
envGlobalSkipCPUAndMemoryResourceChecks := os.Getenv("ANKLET_GLOBAL_SKIP_CPU_AND_MEMORY_RESOURCE_CHECKS")
256+
if envGlobalSkipCPUAndMemoryResourceChecks != "" {
257+
config.GlobalSkipCPUAndMemoryResourceChecks = envGlobalSkipCPUAndMemoryResourceChecks == "true"
258+
}
253259

254260
envJobRetryAttempts := os.Getenv("ANKLET_JOB_RETRY_ATTEMPTS")
255261
if envJobRetryAttempts != "" {

internal/config/config_test.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ func TestApplyPluginEnvOverrides(t *testing.T) {
257257

258258
func TestApplyPluginEnvOverrides_BoolFields(t *testing.T) {
259259
tests := []struct {
260-
name string
261-
envVars map[string]string
262-
pluginPrefix string
263-
wantSkipPull bool
260+
name string
261+
envVars map[string]string
262+
pluginPrefix string
263+
wantSkipPull bool
264+
wantSkipCPUAndMemoryResourceChecks bool
264265
}{
265266
{
266267
name: "skip_pull true",
@@ -274,6 +275,12 @@ func TestApplyPluginEnvOverrides_BoolFields(t *testing.T) {
274275
pluginPrefix: "TEST_PLUGIN",
275276
wantSkipPull: false,
276277
},
278+
{
279+
name: "skip_cpu_and_memory_resource_checks true",
280+
envVars: map[string]string{"TEST_PLUGIN_SKIP_CPU_AND_MEMORY_RESOURCE_CHECKS": "true"},
281+
pluginPrefix: "TEST_PLUGIN",
282+
wantSkipCPUAndMemoryResourceChecks: true,
283+
},
277284
}
278285

279286
for _, tt := range tests {
@@ -292,6 +299,13 @@ func TestApplyPluginEnvOverrides_BoolFields(t *testing.T) {
292299
if plugin.SkipPull != tt.wantSkipPull {
293300
t.Errorf("SkipPull = %v, want %v", plugin.SkipPull, tt.wantSkipPull)
294301
}
302+
if plugin.SkipCPUAndMemoryResourceChecks != tt.wantSkipCPUAndMemoryResourceChecks {
303+
t.Errorf(
304+
"SkipCPUAndMemoryResourceChecks = %v, want %v",
305+
plugin.SkipCPUAndMemoryResourceChecks,
306+
tt.wantSkipCPUAndMemoryResourceChecks,
307+
)
308+
}
295309
})
296310
}
297311
}

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ func main() {
152152
if plugin.TemplateDiskBuffer == 0 {
153153
loadedConfig.Plugins[index].TemplateDiskBuffer = 10.0
154154
}
155+
if loadedConfig.GlobalSkipCPUAndMemoryResourceChecks {
156+
loadedConfig.Plugins[index].SkipCPUAndMemoryResourceChecks = true
157+
}
155158
}
156159
}
157160

plugins/handlers/github/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ plugins:
3838
# registration_timeout_seconds: 80 # Optional; defaults to 80 seconds.
3939
# template_disk_buffer: 10.0 # Optional; defaults to 10.0%. How much disk space to leave free on the host for templates.
4040
# job_retry_attempts: 10 # Override the default of 5
41+
# skip_cpu_and_memory_resource_checks: true # Optional; allows CPU/RAM overcommit by skipping VM admission checks on this host.
4142
#database:
4243
# enabled: true
4344
# url: localhost
@@ -57,6 +58,7 @@ plugins:
5758
- If you are attempting to register runners for an entire organization, do NOT set `repo` and make sure your Github App has `Self-hosted runners` > `Read and write` permissions.
5859
- If your Organization level runner is registered and your public repo jobs are not picking it up even though the labels are a perfect match, make sure the Runner groups (likely `Default`) has `Allow public repositories`.
5960
- There are times when github will not register the runner for some reason. `registration_timeout_seconds` is available to set the custom seconds to wait before considering the runner registration failed (and retry on a new VM).
61+
- `skip_cpu_and_memory_resource_checks` (or global `global_skip_cpu_and_memory_resource_checks`) is intended for overcommit fleets. It allows multiple VMs to start even when host CPU/RAM capacity checks would normally block them, which can improve throughput in bursty workloads but may increase contention and job runtime variance under sustained load.
6062

6163
---
6264

0 commit comments

Comments
 (0)