Skip to content

Commit e522379

Browse files
committed
Use the new prefix instead of fleet.azure.com
Signed-off-by: Liqian Luo <[email protected]>
1 parent 2fa52b9 commit e522379

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

apis/placement/v1beta1/work_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ const (
4545
// LastAppliedConfigAnnotation is to record the last applied configuration on the object.
4646
LastAppliedConfigAnnotation = fleetPrefix + "last-applied-configuration"
4747

48+
// SourcePlacementAnnotation is the annotation key used to track the source placement of applied resources.
49+
SourcePlacementAnnotation = fleetPrefix + "source-placement"
50+
4851
// WorkConditionTypeApplied represents workload in Work is applied successfully on the spoke cluster.
4952
WorkConditionTypeApplied = "Applied"
5053

pkg/controllers/workapplier/apply.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
"sigs.k8s.io/controller-runtime/pkg/client"
3636

3737
fleetv1beta1 "github.com/kubefleet-dev/kubefleet/apis/placement/v1beta1"
38-
"github.com/kubefleet-dev/kubefleet/pkg/utils"
3938
"github.com/kubefleet-dev/kubefleet/pkg/utils/controller"
4039
"github.com/kubefleet-dev/kubefleet/pkg/utils/resource"
4140
)
@@ -490,7 +489,7 @@ func setSourcePlacementAnnotation(manifestObj *unstructured.Unstructured, work *
490489
if annotations == nil {
491490
annotations = map[string]string{}
492491
}
493-
annotations[utils.SourcePlacementAnnotation] = placementName
492+
annotations[fleetv1beta1.SourcePlacementAnnotation] = placementName
494493
manifestObj.SetAnnotations(annotations)
495494

496495
klog.V(2).InfoS("Set source placement annotation on manifest",

pkg/controllers/workapplier/apply_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"sigs.k8s.io/controller-runtime/pkg/client"
3232

3333
fleetv1beta1 "github.com/kubefleet-dev/kubefleet/apis/placement/v1beta1"
34-
"github.com/kubefleet-dev/kubefleet/pkg/utils"
3534
)
3635

3736
// Note (chenyu1): The fake client Fleet uses for unit tests has trouble processing certain requests
@@ -579,7 +578,7 @@ func TestSetSourcePlacementAnnotation(t *testing.T) {
579578
manifestObj1 := toUnstructured(t, ns.DeepCopy())
580579
wantManifestObj1 := toUnstructured(t, ns.DeepCopy())
581580
wantManifestObj1.SetAnnotations(map[string]string{
582-
utils.SourcePlacementAnnotation: "test-placement",
581+
fleetv1beta1.SourcePlacementAnnotation: "test-placement",
583582
})
584583

585584
// Test case 2: Work without placement tracking label (no labels at all)
@@ -624,9 +623,9 @@ func TestSetSourcePlacementAnnotation(t *testing.T) {
624623
})
625624
wantManifestObj4 := toUnstructured(t, ns.DeepCopy())
626625
wantManifestObj4.SetAnnotations(map[string]string{
627-
"existing.annotation": "existing-value",
628-
"another.annotation": "another-value",
629-
utils.SourcePlacementAnnotation: "another-placement",
626+
"existing.annotation": "existing-value",
627+
"another.annotation": "another-value",
628+
fleetv1beta1.SourcePlacementAnnotation: "another-placement",
630629
})
631630

632631
testCases := []struct {

pkg/utils/common.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ const (
109109

110110
// FleetAnnotationPrefix is the prefix used to annotate fleet member cluster resources.
111111
FleetAnnotationPrefix = "fleet.azure.com"
112-
113-
// SourcePlacementAnnotation is the annotation key used to track the source placement of applied resources.
114-
SourcePlacementAnnotation = FleetAnnotationPrefix + "/source-placement"
115112
)
116113

117114
var (

0 commit comments

Comments
 (0)