diff --git a/CHANGELOG.md b/CHANGELOG.md index 9319b4b16..532970022 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## Changelog — cortex 0.9.3 + +**Release PR:** [#1545](https://github.com/cobaltcore-dev/cortex/pull/1545) +**Date:** 2026-11-17 +**App Version:** `sha-67c88600` + +### Bumped Versions + +| Package | Previous | New | +|---|---|---| +| cortex | 0.9.2 | 0.9.3 | +| cortex-postgres | 0.6.34 | 0.6.35 | +| cortex-shim | 0.1.40 | 0.1.41 | +| bundles | 0.0.116 | 0.0.117 | +| cortex-placement-shim | 0.1.40 | 0.1.41 | + +### Bug Fixes + +- **Fixed false host oversubscription alerts after capacity refactoring** ([#1543](https://github.com/cobaltcore-dev/cortex/pull/1543)) — After the unified capacity calculation refactoring (#1504), the `computeViolations` function in `HostOversubscriptionController` incorrectly counted `FailoverHost` reservations at full `Spec.Resources` (i.e., entire host capacity). This caused every host with committed-resource reservations **and** running VMs to be falsely reported as oversubscribed. The fix rewrites the violation computation to explicitly select only reservation types that represent real demand on a host's capacity (`CommittedResource`, `Failover`, `InFlight`), excluding `FailoverHost` reservations which block full host capacity for evacuation and are already policed by a dedicated filter. Violations are now computed as `Used + Reserved − Total` per resource, only flagging positive excess. A regression test was added to verify that a failover host reservation with running VMs does not trigger false oversubscription. + ## cortex 0.9.2 ### Fixes diff --git a/helm/bundles/cortex-cinder/Chart.yaml b/helm/bundles/cortex-cinder/Chart.yaml index d86cc6977..5fdb4b0d8 100644 --- a/helm/bundles/cortex-cinder/Chart.yaml +++ b/helm/bundles/cortex-cinder/Chart.yaml @@ -5,23 +5,23 @@ apiVersion: v2 name: cortex-cinder description: A Helm chart deploying Cortex for Cinder. type: application -version: 0.0.116 +version: 0.0.117 appVersion: 0.1.0 dependencies: # from: file://../../library/cortex-postgres - name: cortex-postgres repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.6.34 + version: 0.6.35 # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 alias: cortex-knowledge-controllers # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 alias: cortex-scheduling-controllers # Owner info adds a configmap to the kubernetes cluster with information on diff --git a/helm/bundles/cortex-crds/Chart.yaml b/helm/bundles/cortex-crds/Chart.yaml index a9a3f64f4..a6bbb6a10 100644 --- a/helm/bundles/cortex-crds/Chart.yaml +++ b/helm/bundles/cortex-crds/Chart.yaml @@ -5,13 +5,13 @@ apiVersion: v2 name: cortex-crds description: A Helm chart deploying Cortex CRDs. type: application -version: 0.0.116 +version: 0.0.117 appVersion: 0.1.0 dependencies: # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 # Owner info adds a configmap to the kubernetes cluster with information on # the service owner. This makes it easier to find out who to contact in case diff --git a/helm/bundles/cortex-ironcore/Chart.yaml b/helm/bundles/cortex-ironcore/Chart.yaml index 9a8b966e1..14ebd4318 100644 --- a/helm/bundles/cortex-ironcore/Chart.yaml +++ b/helm/bundles/cortex-ironcore/Chart.yaml @@ -5,13 +5,13 @@ apiVersion: v2 name: cortex-ironcore description: A Helm chart deploying Cortex for IronCore. type: application -version: 0.0.116 +version: 0.0.117 appVersion: 0.1.0 dependencies: # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 # Owner info adds a configmap to the kubernetes cluster with information on # the service owner. This makes it easier to find out who to contact in case diff --git a/helm/bundles/cortex-manila/Chart.yaml b/helm/bundles/cortex-manila/Chart.yaml index 881473c78..bcce4d43e 100644 --- a/helm/bundles/cortex-manila/Chart.yaml +++ b/helm/bundles/cortex-manila/Chart.yaml @@ -5,23 +5,23 @@ apiVersion: v2 name: cortex-manila description: A Helm chart deploying Cortex for Manila. type: application -version: 0.0.116 +version: 0.0.117 appVersion: 0.1.0 dependencies: # from: file://../../library/cortex-postgres - name: cortex-postgres repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.6.34 + version: 0.6.35 # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 alias: cortex-knowledge-controllers # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 alias: cortex-scheduling-controllers # Owner info adds a configmap to the kubernetes cluster with information on diff --git a/helm/bundles/cortex-nova/Chart.yaml b/helm/bundles/cortex-nova/Chart.yaml index e03a1b61d..eb2b88446 100644 --- a/helm/bundles/cortex-nova/Chart.yaml +++ b/helm/bundles/cortex-nova/Chart.yaml @@ -5,23 +5,23 @@ apiVersion: v2 name: cortex-nova description: A Helm chart deploying Cortex for Nova. type: application -version: 0.0.116 +version: 0.0.117 appVersion: 0.1.0 dependencies: # from: file://../../library/cortex-postgres - name: cortex-postgres repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.6.34 + version: 0.6.35 # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 alias: cortex-knowledge-controllers # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 alias: cortex-scheduling-controllers # Owner info adds a configmap to the kubernetes cluster with information on diff --git a/helm/bundles/cortex-placement-shim/Chart.yaml b/helm/bundles/cortex-placement-shim/Chart.yaml index 19e4f3628..112753310 100644 --- a/helm/bundles/cortex-placement-shim/Chart.yaml +++ b/helm/bundles/cortex-placement-shim/Chart.yaml @@ -5,13 +5,13 @@ apiVersion: v2 name: cortex-placement-shim description: A Helm chart deploying the Cortex placement shim. type: application -version: 0.1.40 +version: 0.1.41 appVersion: 0.1.0 dependencies: # from: file://../../library/cortex-shim - name: cortex-shim repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.1.40 + version: 0.1.41 # Owner info adds a configmap to the kubernetes cluster with information on # the service owner. This makes it easier to find out who to contact in case # of issues. See: https://github.com/sapcc/helm-charts/pkgs/container/helm-charts%2Fowner-info diff --git a/helm/bundles/cortex-pods/Chart.yaml b/helm/bundles/cortex-pods/Chart.yaml index a51079a47..ae841da58 100644 --- a/helm/bundles/cortex-pods/Chart.yaml +++ b/helm/bundles/cortex-pods/Chart.yaml @@ -5,13 +5,13 @@ apiVersion: v2 name: cortex-pods description: A Helm chart deploying Cortex for Pods. type: application -version: 0.0.116 +version: 0.0.117 appVersion: 0.1.0 dependencies: # from: file://../../library/cortex - name: cortex repository: oci://ghcr.io/cobaltcore-dev/cortex/charts - version: 0.9.2 + version: 0.9.3 # Owner info adds a configmap to the kubernetes cluster with information on # the service owner. This makes it easier to find out who to contact in case diff --git a/helm/library/cortex-postgres/Chart.yaml b/helm/library/cortex-postgres/Chart.yaml index 61ef34521..98c934d97 100644 --- a/helm/library/cortex-postgres/Chart.yaml +++ b/helm/library/cortex-postgres/Chart.yaml @@ -5,5 +5,5 @@ apiVersion: v2 name: cortex-postgres description: Postgres setup for Cortex. type: application -version: 0.6.34 +version: 0.6.35 appVersion: "sha-f69b58ee" diff --git a/helm/library/cortex-shim/Chart.yaml b/helm/library/cortex-shim/Chart.yaml index c20d13aff..f109d06d1 100644 --- a/helm/library/cortex-shim/Chart.yaml +++ b/helm/library/cortex-shim/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: cortex-shim description: A Helm chart to distribute cortex shims. type: application -version: 0.1.40 +version: 0.1.41 appVersion: "sha-01a68db0" icon: "https://example.com/icon.png" dependencies: [] diff --git a/helm/library/cortex/Chart.yaml b/helm/library/cortex/Chart.yaml index 358724252..0fada199e 100644 --- a/helm/library/cortex/Chart.yaml +++ b/helm/library/cortex/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: cortex description: A Helm chart to distribute cortex. type: application -version: 0.9.2 -appVersion: "sha-cdb4dfaa" +version: 0.9.3 +appVersion: "sha-67c88600" icon: "https://example.com/icon.png" dependencies: [] diff --git a/internal/scheduling/reservations/commitments/host_oversubscription_controller.go b/internal/scheduling/reservations/commitments/host_oversubscription_controller.go index 34d7667f2..afc3e66bb 100644 --- a/internal/scheduling/reservations/commitments/host_oversubscription_controller.go +++ b/internal/scheduling/reservations/commitments/host_oversubscription_controller.go @@ -269,13 +269,25 @@ func (r *HostOversubscriptionController) SetupWithManager(mgr ctrl.Manager, mcl // the host is over-subscribed. Returns nil if capacity data is unavailable, empty map if no violation. func computeViolations(allReservations []v1alpha1.Reservation, hv hv1.Hypervisor) map[hv1.ResourceName]resource.Quantity { rep := capacity.NewHostUsageReport(hv, allReservations) - if rep.Oversubscribed == nil { + if rep.Total == nil { return nil // no capacity data } + // Only count types that represent real demand on this host's capacity. + // ReservationTypeFailoverHost is excluded: it blocks Spec.Resources = full host capacity + // for evacuation and is policed by a dedicated filter — counting it here would make every + // host with running VMs appear oversubscribed. + reserved := rep.ReservedTotal( + v1alpha1.ReservationTypeCommittedResource, + v1alpha1.ReservationTypeFailover, + v1alpha1.ReservationTypeInFlight, + ) violations := make(map[hv1.ResourceName]resource.Quantity) - for rn, excess := range rep.Oversubscribed { - if excess.Sign() > 0 { - violations[rn] = excess + for rn, total := range rep.Total { + demand := rep.Used[rn].DeepCopy() + demand.Add(reserved[rn]) + if demand.Cmp(total) > 0 { + demand.Sub(total) + violations[rn] = demand } } return violations diff --git a/internal/scheduling/reservations/commitments/host_oversubscription_controller_test.go b/internal/scheduling/reservations/commitments/host_oversubscription_controller_test.go index 12bc8fc7b..54b0125e1 100644 --- a/internal/scheduling/reservations/commitments/host_oversubscription_controller_test.go +++ b/internal/scheduling/reservations/commitments/host_oversubscription_controller_test.go @@ -101,6 +101,31 @@ func TestComputeViolations(t *testing.T) { Status: v1alpha1.ReservationStatus{Host: "host-1"}, }}, }, + { + // Regression: after the pkg/capacity refactor (31b2fe82), FailoverHost reservations + // were counted at full Spec.Resources (= entire host) instead of zero. + // With VMs running: Available = Total − Used − Total = −Used → false oversubscription. + name: "failover host reservation with running VMs does not cause false oversubscription", + hv: hv1.Hypervisor{ + ObjectMeta: metav1.ObjectMeta{Name: "host-1"}, + Status: hv1.HypervisorStatus{ + EffectiveCapacity: map[hv1.ResourceName]resource.Quantity{ + hv1.ResourceMemory: testGiB(512), + }, + Allocation: map[hv1.ResourceName]resource.Quantity{ + hv1.ResourceMemory: testGiB(256), + }, + }, + }, + slots: []v1alpha1.Reservation{{ + Spec: v1alpha1.ReservationSpec{ + Type: v1alpha1.ReservationTypeFailoverHost, + TargetHost: "host-1", + Resources: map[hv1.ResourceName]resource.Quantity{hv1.ResourceMemory: testGiB(512)}, + }, + Status: v1alpha1.ReservationStatus{Host: "host-1"}, + }}, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {