Skip to content

Commit f7c0eed

Browse files
Fix dep conf vals and add meta-deps for nova scheduler (#169)
1 parent 838ccc4 commit f7c0eed

4 files changed

Lines changed: 62 additions & 42 deletions

File tree

helm/cortex/values.yaml

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,16 @@ conf:
251251
- servers
252252
- name: vrops_hostsystem_contention_long_term_extractor
253253
dependencies:
254-
features:
255-
extractors:
256-
- vrops_hostsystem_resolver
254+
extractors:
255+
- vrops_hostsystem_resolver
257256
sync:
258257
prometheus:
259258
metrics:
260259
- alias: vrops_hostsystem_cpu_contention_long_term_percentage
261260
- name: vrops_hostsystem_contention_short_term_extractor
262261
dependencies:
263-
features:
264-
extractors:
265-
- vrops_hostsystem_resolver
262+
extractors:
263+
- vrops_hostsystem_resolver
266264
sync:
267265
prometheus:
268266
metrics:
@@ -340,30 +338,25 @@ conf:
340338
# VMware-specific KPIs.
341339
- name: vmware_host_contention_kpi
342340
dependencies:
343-
features:
344-
extractors:
345-
- vrops_hostsystem_contention_long_term_extractor
341+
extractors:
342+
- vrops_hostsystem_contention_long_term_extractor
346343
- name: vmware_project_noisiness_kpi
347344
dependencies:
348-
features:
349-
extractors:
350-
- vrops_project_noisiness_extractor
345+
extractors:
346+
- vrops_project_noisiness_extractor
351347
# Shared KPIs.
352348
- name: host_utilization_kpi
353349
dependencies:
354-
features:
355-
extractors:
356-
- host_utilization_extractor
350+
extractors:
351+
- host_utilization_extractor
357352
- name: vm_migration_statistics_kpi
358353
dependencies:
359-
features:
360-
extractors:
354+
extractors:
361355
- vm_host_residency_extractor
362356
- name: vm_life_span_kpi
363357
dependencies:
364-
features:
365-
extractors:
366-
- vm_life_span_histogram_extractor
358+
extractors:
359+
- vm_life_span_histogram_extractor
367360

368361
scheduler:
369362
api:
@@ -390,11 +383,17 @@ conf:
390383
utilizedActivationLowerBound: 0.0
391384
utilizedActivationUpperBound: 1.0
392385
dependencies:
393-
features:
394-
extractors:
395-
- storage_pool_utilization_extractor
386+
extractors:
387+
- storage_pool_utilization_extractor
396388

397389
nova:
390+
# Dependencies needed by all the Nova scheduler steps.
391+
dependencies:
392+
extractors:
393+
# Needed for the step scoper which checks stuff like the hypervisor
394+
# type and traits as well as the vm flavor in the request spec.
395+
- host_capabilities_extractor
396+
398397
# Configuration of scheduler steps that modify the Nova scheduler weights.
399398
# Each scheduler step can specify its own dependencies on extractors and
400399
# synced data.
@@ -413,9 +412,8 @@ conf:
413412
avgCPUUsageActivationLowerBound: 0.0
414413
avgCPUUsageActivationUpperBound: -1.0
415414
dependencies:
416-
features:
417-
extractors:
418-
- vrops_project_noisiness_extractor
415+
extractors:
416+
- vrops_project_noisiness_extractor
419417
- name: vmware_avoid_long_term_contended_hosts
420418
options:
421419
# Min-max scaling for avg CPU contention on the host.
@@ -429,9 +427,8 @@ conf:
429427
maxCPUContentionActivationLowerBound: 0.0
430428
maxCPUContentionActivationUpperBound: -0.25
431429
dependencies:
432-
features:
433-
extractors:
434-
- vrops_hostsystem_contention_long_term_extractor
430+
extractors:
431+
- vrops_hostsystem_contention_long_term_extractor
435432
- name: vmware_avoid_short_term_contended_hosts
436433
options:
437434
# Min-max scaling for avg CPU contention on the host.
@@ -445,9 +442,8 @@ conf:
445442
maxCPUContentionActivationLowerBound: 0.0
446443
maxCPUContentionActivationUpperBound: -0.25
447444
dependencies:
448-
features:
449-
extractors:
450-
- vrops_hostsystem_contention_short_term_extractor
445+
extractors:
446+
- vrops_hostsystem_contention_short_term_extractor
451447

452448
# KVM specific scheduler steps.
453449
- name: kvm_avoid_overloaded_hosts_cpu
@@ -463,9 +459,8 @@ conf:
463459
maxCPUUsageActivationLowerBound: 0.0
464460
maxCPUUsageActivationUpperBound: -0.25
465461
dependencies:
466-
features:
467-
extractors:
468-
- node_exporter_host_cpu_usage_extractor
462+
extractors:
463+
- node_exporter_host_cpu_usage_extractor
469464
- name: kvm_avoid_overloaded_hosts_memory
470465
options:
471466
# Min-max scaling for avg memory usage on the host.
@@ -479,9 +474,8 @@ conf:
479474
maxMemoryUsageActivationLowerBound: 0.0
480475
maxMemoryUsageActivationUpperBound: -0.25
481476
dependencies:
482-
features:
483-
extractors:
484-
- node_exporter_host_memory_active_extractor
477+
extractors:
478+
- node_exporter_host_memory_active_extractor
485479

486480
# Balance general-purpose vms
487481
- name: shared_resource_balancing
@@ -516,10 +510,8 @@ conf:
516510
diskUtilizedActivationLowerBound: 1.0
517511
diskUtilizedActivationUpperBound: 0.0
518512
dependencies:
519-
features:
520-
extractors:
521-
- host_utilization_extractor
522-
- host_capabilities_extractor # Needed due to the host scope.
513+
extractors:
514+
- host_utilization_extractor
523515

524516
# Generic modifiers added on the initial creation of this helm chart.
525517

internal/conf/conf.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ type ManilaSchedulerConfig struct {
165165
type NovaSchedulerConfig struct {
166166
// Scheduler step plugins by their name.
167167
Plugins []SchedulerStepConfig `json:"plugins"`
168+
169+
// Dependencies needed by all the Nova scheduler steps.
170+
DependencyConfig `json:"dependencies,omitempty"`
168171
}
169172

170173
type SchedulerStepConfig struct {

internal/conf/validation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ func (c *config) Validate() error {
104104
return err
105105
}
106106
}
107+
// Check general dependencies needed by all scheduler steps.
108+
if err := c.Nova.validate(*c); err != nil {
109+
return err
110+
}
107111
if c.API.LogRequestBodies {
108112
slog.Warn("logging request bodies is enabled (debug feature)")
109113
}

internal/conf/validation_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,24 @@ func TestInvalidConf_MissingFeatureForKPI(t *testing.T) {
222222
t.Fatalf("expected error, got nil")
223223
}
224224
}
225+
226+
func TestInvalidConf_NovaSchedulerDependency(t *testing.T) {
227+
content := `
228+
{
229+
"extractor": {
230+
"plugins": [
231+
{
232+
"name": "extractor_1"
233+
}
234+
]
235+
},
236+
"scheduler": {
237+
"nova": { "dependencies": { "extractors": ["extractor_2"] } }
238+
}
239+
}
240+
`
241+
conf := newConfigFromBytes([]byte(content))
242+
if err := conf.Validate(); err == nil {
243+
t.Fatalf("expected error, got nil")
244+
}
245+
}

0 commit comments

Comments
 (0)