Skip to content
3 changes: 3 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ for (bundle_chart_path, bundle_chart_name) in bundle_charts:
local('sh helm/sync.sh ' + dep_chart_path)
pkg_out = str(local('helm package ' + dep_chart_path)).strip()
gen_tgz = os.path.basename(pkg_out)
# Always remove stale old versions of this chart (e.g. cortex-0.5.1.tgz when current is 0.9.0).
# Uses [0-9] prefix so cortex-[0-9]*.tgz does not accidentally match cortex-postgres-*.tgz.
local('find ' + bundle_chart_path + '/charts/ -maxdepth 1 -name "' + dep_chart_name + '-[0-9]*.tgz" ! -name "' + gen_tgz + '" -delete')
# If the file isn't there yet, copy it over.
if not os.path.exists(bundle_chart_path + '/charts/' + gen_tgz):
print('Adding ' + dep_chart_name + ' to ' + bundle_chart_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,14 @@ func (e *FlavorGroupExtractor) Extract() ([]plugins.Feature, error) {
continue
}

// Sort flavors by size descending (largest first), tie break by name for consistent ordering
// Sort flavors by memory descending (largest first); tie-break by fewest vCPUs to
// minimize CPU blocking when multiple flavors share the same memory size.
sort.Slice(flavors, func(i, j int) bool {
if flavors[i].MemoryMB != flavors[j].MemoryMB {
return flavors[i].MemoryMB > flavors[j].MemoryMB
}
if flavors[i].VCPUs != flavors[j].VCPUs {
return flavors[i].VCPUs > flavors[j].VCPUs
return flavors[i].VCPUs < flavors[j].VCPUs
}
return flavors[i].Name < flavors[j].Name
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestFlavorGroupExtractor_Extract(t *testing.T) {
Ephemeral: 5,
ExtraSpecs: `{"capabilities:hypervisor_type":"CH","quota:hw_version":"ch"}`,
},
// Corner case: Same memory as gp_c8_m32_v2 but MORE VCPUs (should come first)
// Corner case: Same memory as gp_c8_m32_v2 but MORE VCPUs (should come last, after fewer-VCPUs flavor)
&nova.Flavor{
ID: "8",
Name: "gp_c12_m32_v2",
Expand Down Expand Up @@ -178,15 +178,17 @@ func TestFlavorGroupExtractor_Extract(t *testing.T) {
t.Errorf("expected largest flavor to have quota:hw_version=v2, got %s", v2Group.LargestFlavor.ExtraSpecs["quota:hw_version"])
}

// Verify smallest flavor in v2 group should be gp_c4_m16_ch is NOT in v2, so it's gp_c8_m32_v2 (lowest memory among v2 flavors)
if v2Group.SmallestFlavor.Name != "gp_c8_m32_v2" {
t.Errorf("expected smallest flavor to be gp_c8_m32_v2, got %s", v2Group.SmallestFlavor.Name)
// Verify smallest flavor in v2 group: at 32768 MB we have gp_c8_m32_v2 (8 VCPUs),
// gp_c12_m32_alt (12 VCPUs), and gp_c12_m32_v2 (12 VCPUs). With fewest-VCPUs-first
// tiebreak, gp_c8_m32_v2 sorts first and gp_c12_m32_v2 sorts last → smallest.
if v2Group.SmallestFlavor.Name != "gp_c12_m32_v2" {
t.Errorf("expected smallest flavor to be gp_c12_m32_v2, got %s", v2Group.SmallestFlavor.Name)
}
if v2Group.SmallestFlavor.MemoryMB != 32768 {
t.Errorf("expected smallest flavor memory to be 32768 MB, got %d", v2Group.SmallestFlavor.MemoryMB)
}
if v2Group.SmallestFlavor.VCPUs != 8 {
t.Errorf("expected smallest flavor VCPUs to be 8, got %d", v2Group.SmallestFlavor.VCPUs)
if v2Group.SmallestFlavor.VCPUs != 12 {
t.Errorf("expected smallest flavor VCPUs to be 12, got %d", v2Group.SmallestFlavor.VCPUs)
}

// Verify Cloud-Hypervisor group
Expand Down Expand Up @@ -224,8 +226,8 @@ func TestFlavorGroupExtractor_Extract(t *testing.T) {
fg.Name, current.Name, current.MemoryMB, next.Name, next.MemoryMB)
}

// Secondary sort: if memory equal, VCPUs descending
if current.MemoryMB == next.MemoryMB && current.VCPUs < next.VCPUs {
// Secondary sort: if memory equal, VCPUs ascending (fewest VCPUs first)
if current.MemoryMB == next.MemoryMB && current.VCPUs > next.VCPUs {
t.Errorf("Flavors in group %s with equal memory not sorted by VCPUs: %s (%d VCPUs) should come after %s (%d VCPUs)",
fg.Name, current.Name, current.VCPUs, next.Name, next.VCPUs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ type crSnapshot struct {
// HandleChangeCommitments implements POST /commitments/v1/change-commitments from the Limes LIQUID API.
// It writes CommittedResource CRDs (one per commitment) and polls their status conditions until
// the controller confirms or rejects each one. On any failure the whole batch is rolled back.
// TODO (#786): replace direct CR writes + changeMutex with a CommittedResourceChange (source=api);
// poll CRC terminal phase and map Accepted/Rejected/Superseded to HTTP response. Flag-gated switchover.
//
// See: https://github.com/sapcc/go-api-declarations/blob/main/liquid/commitment.go
// See: https://pkg.go.dev/github.com/sapcc/go-api-declarations/liquid
Expand Down Expand Up @@ -228,6 +230,8 @@ func (api *HTTPAPI) HandleChangeCommitments(w http.ResponseWriter, r *http.Reque
}
}

// TODO (#788): once #786 switchover is stable, remove: changeMutex, crSnapshot type, reverse-order
// rollbackCR, performDryRun probe CRs, and this direct-write path entirely.
func (api *HTTPAPI) processCommitmentChanges(ctx context.Context, w http.ResponseWriter, logger logr.Logger, req liquid.CommitmentChangeRequest, resp *liquid.CommitmentChangeResponse) error {
flavorGroups, err := knowledge.GetAllFlavorGroups(ctx, api.client, nil)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ func (r *CommittedResourceChangeReconciler) markError(ctx context.Context, tx *v
}
}

// TODO (#781): add a TTL/GC controller that deletes terminal CommittedResourceChanges after their
// retention window (Accepted ~1h, Rejected ~5d). Non-terminal CRCs must never be GC'd — deleting
// one loses the rollback journal and the #783 AZ active-marker.

// SetupWithManager registers the controller and configures watches.
// TODO (#783): set MaxConcurrentReconciles: 1 via WithOptions(controller.Options{MaxConcurrentReconciles: 1}).
// TODO (#783): add predicate on WatchesMulticluster() to re-trigger same-AZ non-terminal siblings on terminal transition.
Expand Down
Loading
Loading