Skip to content

Commit 48bb61b

Browse files
committed
atc: fix mode override to be read from annotation instead of label
1 parent 84e8cf7 commit 48bb61b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

cmd/atc/main_test.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -1261,10 +1261,13 @@ func TestAirwayModes(t *testing.T) {
12611261
testBE, err := backendIntf.Get(ctx, "test", metav1.GetOptions{})
12621262
require.NoError(t, err)
12631263

1264-
labels := testBE.GetLabels()
1265-
labels[flight.AnnotationOverrideMode] = string(v1alpha1.AirwayModeDynamic)
1264+
annotations := testBE.GetAnnotations()
1265+
if annotations == nil {
1266+
annotations = map[string]string{}
1267+
}
1268+
annotations[flight.AnnotationOverrideMode] = string(v1alpha1.AirwayModeDynamic)
12661269

1267-
testBE.SetLabels(labels)
1270+
testBE.SetAnnotations(annotations)
12681271

12691272
_, err = backendIntf.Update(ctx, testBE, metav1.UpdateOptions{FieldManager: "test"})
12701273
require.NoError(t, err)

internal/atc/atc.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,11 @@ func (atc atc) FlightReconciler(params FlightReconcilerParams) ctrl.HandleFunc {
503503
}
504504

505505
overrideMode := func() v1alpha1.AirwayMode {
506-
labels := resource.GetLabels()
507-
if labels == nil {
506+
annotations := resource.GetAnnotations()
507+
if annotations == nil {
508508
return ""
509509
}
510-
override := v1alpha1.AirwayMode(labels[flight.AnnotationOverrideMode])
510+
override := v1alpha1.AirwayMode(annotations[flight.AnnotationOverrideMode])
511511
if !slices.Contains(v1alpha1.Modes(), override) {
512512
return ""
513513
}

0 commit comments

Comments
 (0)