Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions api/external/nova/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ type ExternalSchedulerRequest struct {
// Request context from Nova that contains additional meta information.
Context NovaRequestContext `json:"context"`

// Whether the request is a reservation.
Reservation bool `json:"reservation"`

Hosts []ExternalSchedulerHost `json:"hosts"`
Weights map[string]float64 `json:"weights"`

Expand Down
3 changes: 1 addition & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "nova FilterWeigherPipelineController")
os.Exit(1)
}
httpAPIConf := conf.GetConfigOrDie[nova.HTTPAPIConfig]()
nova.NewAPI(httpAPIConf, filterWeigherController).Init(mux)
nova.NewAPI(filterWeigherController).Init(mux)

// Initialize commitments API for LIQUID interface
commitmentsAPI := commitments.NewAPI(multiclusterClient)
Expand Down
253 changes: 12 additions & 241 deletions helm/bundles/cortex-nova/templates/pipelines_kvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ spec:
This step selects hosts not in the instance group specified in the nova
scheduler request spec, but only until the max_server_per_host limit is
reached (default = 1).
- name: filter_has_enough_capacity
description: |
This step will filter out hosts that do not have enough available capacity
to host the requested flavor. If enabled, this step will subtract the
current reservations residing on this host from the available capacity.
params:
# If reserved space should be locked even for matching requests.
# For the reservations pipeline, we don't want to unlock
# reserved space, to avoid reservations for the same project
# and flavor to overlap.
- {key: lockReserved, boolValue: false}
- name: filter_allowed_projects
description: |
This step filters hosts based on allowed projects defined in the
Expand Down Expand Up @@ -179,200 +190,6 @@ spec:
This step selects hosts not in the instance group specified in the nova
scheduler request spec, but only until the max_server_per_host limit is
reached (default = 1).
- name: filter_allowed_projects
description: |
This step filters hosts based on allowed projects defined in the
hypervisor resource. Note that hosts allowing all projects are still
accessible and will not be filtered out. In this way some hypervisors
are made accessible to some projects only.
- name: filter_live_migratable
description: |
This step ensures that the target host of a live migration can accept
the migrating VM, by checking cpu architecture, cpu features, emulated
devices, and cpu modes.
- name: filter_requested_destination
params: {{ .Values.kvm.filterRequestedDestinationParams | toYaml | nindent 8 }}
description: |
This step filters hosts based on the `requested_destination` instruction
from the nova scheduler request spec. It supports filtering by host and
by aggregates.
weighers:
- name: kvm_prefer_smaller_hosts
params:
- {key: resourceWeights, floatMapValue: {"memory": 1.0}}
description: |
This step pulls virtual machines onto smaller hosts (by capacity). This
ensures that larger hosts are not overly fragmented with small VMs,
and can still accommodate larger VMs when they need to be scheduled.
- name: kvm_instance_group_soft_affinity
description: |
This weigher implements the "soft affinity" and "soft anti-affinity" policy
for instance groups in nova.
It assigns a weight to each host based on how many instances of the same
instance group are already running on that host. The more instances of the
same group on a host, the lower (for soft-anti-affinity) or higher
(for soft-affinity) the weight, which makes it less likely or more likely,
respectively, for the scheduler to choose that host for new instances of
the same group.
- name: kvm_binpack
params:
- {key: resourceWeights, floatMapValue: {"memory": 1.0}}
description: |
This step implements a binpacking weigher for workloads on kvm hypervisors.
It pulls the requested vm into the smallest gaps possible, to ensure
other hosts with less allocation stay free for bigger vms.
In this pipeline, the binpacking will focus on hana virtual machines.
---
apiVersion: cortex.cloud/v1alpha1
kind: Pipeline
metadata:
name: kvm-general-purpose-load-balancing-all-filters-enabled
spec:
schedulingDomain: nova
description: |
This pipeline uses the same filtering steps as implemented in the
nova service, ensuring a valid placement. Note: this pipeline is
currently under testing and should not be used for production workloads yet.

This is the pipeline used for KVM hypervisors (qemu and cloud-hypervisor).
Specifically, this pipeline is used for general purpose workloads.
It is also used for (CR/HA) reservation requests.
type: filter-weigher
createDecisions: false
# Fetch all placement candidates, ignoring nova's preselection.
ignorePreselection: true
filters:
- name: filter_host_instructions
description: |
This step will consider the `ignore_hosts` and `force_hosts` instructions
from the nova scheduler request spec to filter out or exclusively allow
certain hosts.
- name: filter_has_enough_capacity
description: |
This step will filter out hosts that do not have enough available capacity
to host the requested flavor. If enabled, this step will subtract the
current reservations residing on this host from the available capacity.
params:
# If reserved space should be locked even for matching requests.
# For the reservations pipeline, we don't want to unlock
# reserved space, to avoid reservations for the same project
# and flavor to overlap.
- {key: lockReserved, boolValue: true}
- name: filter_has_requested_traits
description: |
This step filters hosts that do not have the requested traits given by the
nova flavor extra spec: "trait:<trait>": "forbidden" means the host must
not have the specified trait. "trait:<trait>": "required" means the host
must have the specified trait.
- name: filter_has_accelerators
description: |
This step will filter out hosts without the trait `COMPUTE_ACCELERATORS` if
the nova flavor extra specs request accelerators via "accel:device_profile".
- name: filter_correct_az
description: |
This step will filter out hosts whose aggregate information indicates they
are not placed in the requested availability zone.
- name: filter_status_conditions
description: |
This step will filter out hosts for which the hypervisor status conditions
do not meet the expected values, for example, that the hypervisor is ready
and not disabled.
- name: filter_external_customer
description: |
This step prefix-matches the domain name for external customer domains and
filters out hosts that are not intended for external customers. It considers
the `CUSTOM_EXTERNAL_CUSTOMER_SUPPORTED` trait on hosts as well as the
`domain_name` scheduler hint from the nova request spec.
params:
- {key: domainNamePrefixes, stringListValue: ["iaas-"]}
- name: filter_allowed_projects
description: |
This step filters hosts based on allowed projects defined in the
hypervisor resource. Note that hosts allowing all projects are still
accessible and will not be filtered out. In this way some hypervisors
are made accessible to some projects only.
- name: filter_capabilities
description: |
This step will filter out hosts that do not meet the compute capabilities
requested by the nova flavor extra specs, like `{"arch": "x86_64",
"maxphysaddr:bits": 46, ...}`.

Note: currently, advanced boolean/numeric operators for the capabilities
like `>`, `!`, ... are not supported because they are not used by any of our
flavors in production.
- name: filter_instance_group_affinity
description: |
This step selects hosts in the instance group specified in the nova
scheduler request spec.
- name: filter_instance_group_anti_affinity
description: |
This step selects hosts not in the instance group specified in the nova
scheduler request spec, but only until the max_server_per_host limit is
reached (default = 1).
- name: filter_live_migratable
description: |
This step ensures that the target host of a live migration can accept
the migrating VM, by checking cpu architecture, cpu features, emulated
devices, and cpu modes.
- name: filter_requested_destination
params: {{ .Values.kvm.filterRequestedDestinationParams | toYaml | nindent 8 }}
description: |
This step filters hosts based on the `requested_destination` instruction
from the nova scheduler request spec. It supports filtering by host and
by aggregates.
weighers:
- name: kvm_prefer_smaller_hosts
params:
- {key: resourceWeights, floatMapValue: {"memory": 1.0}}
description: |
This step pulls virtual machines onto smaller hosts (by capacity). This
ensures that larger hosts are not overly fragmented with small VMs,
and can still accommodate larger VMs when they need to be scheduled.
- name: kvm_instance_group_soft_affinity
description: |
This weigher implements the "soft affinity" and "soft anti-affinity" policy
for instance groups in nova.

It assigns a weight to each host based on how many instances of the same
instance group are already running on that host. The more instances of the
same group on a host, the lower (for soft-anti-affinity) or higher
(for soft-affinity) the weight, which makes it less likely or more likely,
respectively, for the scheduler to choose that host for new instances of
the same group.
- name: kvm_binpack
multiplier: -1.0 # inverted = balancing
params:
- {key: resourceWeights, floatMapValue: {"memory": 1.0}}
description: |
This step implements a balancing weigher for workloads on kvm hypervisors,
which is the opposite of binpacking. Instead of pulling the requested vm
into the smallest gaps possible, it spreads the load to ensure
workloads are balanced across hosts. In this pipeline, the balancing will
focus on general purpose virtual machines.
---
apiVersion: cortex.cloud/v1alpha1
kind: Pipeline
metadata:
name: kvm-hana-bin-packing-all-filters-enabled
spec:
schedulingDomain: nova
description: |
This pipeline uses the same filtering steps as implemented in the
nova service, ensuring a valid placement. Note: this pipeline is
currently under testing and should not be used for production workloads yet.

This is the pipeline used for KVM hypervisors (qemu and cloud-hypervisor).
Specifically, this pipeline is used for hana virtual machines.
type: filter-weigher
createDecisions: false
# Fetch all placement candidates, ignoring nova's preselection.
ignorePreselection: true
filters:
- name: filter_host_instructions
description: |
This step will consider the `ignore_hosts` and `force_hosts` instructions
from the nova scheduler request spec to filter out or exclusively allow
certain hosts.
- name: filter_has_enough_capacity
description: |
This step will filter out hosts that do not have enough available capacity
Expand All @@ -383,58 +200,13 @@ spec:
# For the reservations pipeline, we don't want to unlock
# reserved space, to avoid reservations for the same project
# and flavor to overlap.
- {key: lockReserved, boolValue: true}
- name: filter_has_requested_traits
description: |
This step filters hosts that do not have the requested traits given by the
nova flavor extra spec: "trait:<trait>": "forbidden" means the host must
not have the specified trait. "trait:<trait>": "required" means the host
must have the specified trait.
- name: filter_has_accelerators
description: |
This step will filter out hosts without the trait `COMPUTE_ACCELERATORS` if
the nova flavor extra specs request accelerators via "accel:device_profile".
- name: filter_correct_az
description: |
This step will filter out hosts whose aggregate information indicates they
are not placed in the requested availability zone.
- name: filter_status_conditions
description: |
This step will filter out hosts for which the hypervisor status conditions
do not meet the expected values, for example, that the hypervisor is ready
and not disabled.
- name: filter_external_customer
description: |
This step prefix-matches the domain name for external customer domains and
filters out hosts that are not intended for external customers. It considers
the `CUSTOM_EXTERNAL_CUSTOMER_SUPPORTED` trait on hosts as well as the
`domain_name` scheduler hint from the nova request spec.
params:
- {key: domainNamePrefixes, stringListValue: ["iaas-"]}
- {key: lockReserved, boolValue: false}
- name: filter_allowed_projects
description: |
This step filters hosts based on allowed projects defined in the
hypervisor resource. Note that hosts allowing all projects are still
accessible and will not be filtered out. In this way some hypervisors
are made accessible to some projects only.
- name: filter_capabilities
description: |
This step will filter out hosts that do not meet the compute capabilities
requested by the nova flavor extra specs, like `{"arch": "x86_64",
"maxphysaddr:bits": 46, ...}`.

Note: currently, advanced boolean/numeric operators for the capabilities
like `>`, `!`, ... are not supported because they are not used by any of our
flavors in production.
- name: filter_instance_group_affinity
description: |
This step selects hosts in the instance group specified in the nova
scheduler request spec.
- name: filter_instance_group_anti_affinity
description: |
This step selects hosts not in the instance group specified in the nova
scheduler request spec, but only until the max_server_per_host limit is
reached (default = 1).
- name: filter_live_migratable
description: |
This step ensures that the target host of a live migration can accept
Expand All @@ -458,7 +230,6 @@ spec:
description: |
This weigher implements the "soft affinity" and "soft anti-affinity" policy
for instance groups in nova.

It assigns a weight to each host based on how many instances of the same
instance group are already running on that host. The more instances of the
same group on a host, the lower (for soft-anti-affinity) or higher
Expand Down
10 changes: 4 additions & 6 deletions helm/bundles/cortex-nova/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ cortex-scheduling-controllers:
conf:
<<: *cortexConf
leaderElectionID: cortex-nova-scheduling
# OpenStack projects that use experimental features.
experimentalProjectIDs: []
monitoring:
labels:
<<: *cortexMonitoringLabels
Expand All @@ -142,11 +140,11 @@ cortex-scheduling-controllers:
# CommittedResourceFlavorGroupPipelines maps flavor group IDs to pipeline names for CR reservations
# This allows different scheduling strategies per flavor group (e.g., HANA vs GP)
committedResourceFlavorGroupPipelines:
"2152": "kvm-hana-bin-packing-all-filters-enabled" # HANA flavor group
"2101": "kvm-general-purpose-load-balancing-all-filters-enabled" # General Purpose flavor group
"*": "kvm-general-purpose-load-balancing-all-filters-enabled" # Catch-all fallback
"2152": "kvm-hana-bin-packing" # HANA flavor group
"2101": "kvm-general-purpose-load-balancing" # General Purpose flavor group
"*": "kvm-general-purpose-load-balancing" # Catch-all fallback
# Default pipeline for CR reservations when no CommittedResourceFlavorGroupPipelines entry matches
committedResourcePipelineDefault: "kvm-general-purpose-load-balancing-all-filters-enabled"
committedResourcePipelineDefault: "kvm-general-purpose-load-balancing"
# How often to re-verify active reservations
# 5m = 300000000000 nanoseconds
committedResourceRequeueIntervalActive: 300000000000
Expand Down
2 changes: 1 addition & 1 deletion internal/scheduling/nova/e2e_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func randomRequest(dc datacenter, seed int) api.ExternalSchedulerRequest {
if err != nil {
slog.Info("failed to determine hypervisor type, using default pipeline", "error", err)
} else if hvType == api.HypervisorTypeQEMU || hvType == api.HypervisorTypeCH {
request.Pipeline = "kvm-general-purpose-load-balancing-all-filters-enabled"
request.Pipeline = "kvm-general-purpose-load-balancing"
}
return request
}
Expand Down
Loading
Loading