Skip to content

Commit 4498d35

Browse files
Wei WengWei Weng
authored andcommitted
Revert "ignore some pvc annotations"
This reverts commit 9ba69dd.
1 parent f42f07c commit 4498d35

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

pkg/controllers/placement/resource_selector.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"k8s.io/apimachinery/pkg/runtime"
3131
"k8s.io/apimachinery/pkg/runtime/schema"
3232
"k8s.io/apimachinery/pkg/types"
33-
pvutil "k8s.io/component-helpers/storage/volume"
3433
"k8s.io/klog/v2"
3534
"k8s.io/kubectl/pkg/util/deployment"
3635
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -445,15 +444,6 @@ func generateRawContent(object *unstructured.Unstructured) ([]byte, error) {
445444
delete(annots, corev1.LastAppliedConfigAnnotation)
446445
// Remove the revision annotation set by deployment controller.
447446
delete(annots, deployment.RevisionAnnotation)
448-
// Remove node-specific annotations from PVCs that would break when propagated to member clusters
449-
// These annotations reference specific nodes from the hub cluster which don't exist on member clusters
450-
// The member cluster's storage provisioner will set appropriate values for its own nodes
451-
// All annotations below are listed in well-known labels, annotations and taints document:
452-
// https://kubernetes.io/docs/reference/labels-annotations-taints/
453-
delete(annots, pvutil.AnnSelectedNode) // Node selected for volume binding
454-
delete(annots, pvutil.AnnBindCompleted) // Binding completion status
455-
delete(annots, pvutil.AnnBoundByController) // Controller binding status
456-
delete(annots, pvutil.AnnBetaStorageProvisioner) // Beta storage provisioner annotation
457447
if len(annots) == 0 {
458448
object.SetAnnotations(nil)
459449
} else {

pkg/controllers/placement/resource_selector_test.go

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ import (
2727
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2828
apierrors "k8s.io/apimachinery/pkg/api/errors"
2929
"k8s.io/apimachinery/pkg/api/meta"
30-
"k8s.io/apimachinery/pkg/api/resource"
3130
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3231
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3332
"k8s.io/apimachinery/pkg/runtime"
3433
"k8s.io/apimachinery/pkg/runtime/schema"
3534
"k8s.io/apimachinery/pkg/types"
3635
utilrand "k8s.io/apimachinery/pkg/util/rand"
37-
pvutil "k8s.io/component-helpers/storage/volume"
3836
"k8s.io/kubectl/pkg/util/deployment"
3937
"k8s.io/utils/ptr"
4038

@@ -245,60 +243,6 @@ func TestGenerateResourceContent(t *testing.T) {
245243
},
246244
},
247245
},
248-
"PersistentVolumeClaim with node-specific annotations": {
249-
resource: corev1.PersistentVolumeClaim{
250-
TypeMeta: metav1.TypeMeta{
251-
APIVersion: "v1",
252-
Kind: "PersistentVolumeClaim",
253-
},
254-
ObjectMeta: metav1.ObjectMeta{
255-
Name: "test-pvc",
256-
Namespace: "test-namespace",
257-
Annotations: map[string]string{
258-
pvutil.AnnSelectedNode: "hub-control-plane",
259-
pvutil.AnnBindCompleted: "yes",
260-
pvutil.AnnBoundByController: "yes",
261-
pvutil.AnnBetaStorageProvisioner: "kubernetes.io/no-provisioner",
262-
"custom-annotation": "should-remain",
263-
},
264-
},
265-
Spec: corev1.PersistentVolumeClaimSpec{
266-
AccessModes: []corev1.PersistentVolumeAccessMode{
267-
corev1.ReadWriteOnce,
268-
},
269-
Resources: corev1.VolumeResourceRequirements{
270-
Requests: corev1.ResourceList{
271-
corev1.ResourceStorage: resource.MustParse("1Gi"),
272-
},
273-
},
274-
StorageClassName: ptr.To("standard"),
275-
},
276-
},
277-
wantResource: corev1.PersistentVolumeClaim{
278-
TypeMeta: metav1.TypeMeta{
279-
APIVersion: "v1",
280-
Kind: "PersistentVolumeClaim",
281-
},
282-
ObjectMeta: metav1.ObjectMeta{
283-
Name: "test-pvc",
284-
Namespace: "test-namespace",
285-
Annotations: map[string]string{
286-
"custom-annotation": "should-remain",
287-
},
288-
},
289-
Spec: corev1.PersistentVolumeClaimSpec{
290-
AccessModes: []corev1.PersistentVolumeAccessMode{
291-
corev1.ReadWriteOnce,
292-
},
293-
Resources: corev1.VolumeResourceRequirements{
294-
Requests: corev1.ResourceList{
295-
corev1.ResourceStorage: resource.MustParse("1Gi"),
296-
},
297-
},
298-
StorageClassName: ptr.To("standard"),
299-
},
300-
},
301-
},
302246
}
303247

304248
for testName, tt := range tests {

0 commit comments

Comments
 (0)