@@ -30,7 +30,6 @@ import (
3030 "github.com/OpenCIDN/cidn/pkg/internal/utils"
3131 apierrors "k8s.io/apimachinery/pkg/api/errors"
3232 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
33- "k8s.io/apimachinery/pkg/labels"
3433 "k8s.io/client-go/tools/cache"
3534 "k8s.io/client-go/util/workqueue"
3635 "k8s.io/klog/v2"
@@ -109,11 +108,8 @@ func (c *BearerToChunkController) runWorker(ctx context.Context) {
109108}
110109
111110func (c * BearerToChunkController ) cleanupBearer (bearer * v1alpha1.Bearer ) {
112- err := c .client .TaskV1alpha1 ().Chunks ().DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {
113- LabelSelector : labels.Set {
114- BearerUIDLabelKey : string (bearer .UID ),
115- }.String (),
116- })
111+ chunkName := buildBearerChunkName (bearer .Name )
112+ err := c .client .TaskV1alpha1 ().Chunks ().Delete (context .Background (), chunkName , metav1.DeleteOptions {})
117113 if err != nil {
118114 klog .Errorf ("failed to delete chunks for bearer %s: %v" , bearer .Name , err )
119115 }
@@ -185,21 +181,11 @@ func (c *BearerToChunkController) toChunk(ctx context.Context, bearer *v1alpha1.
185181
186182 chunk := & v1alpha1.Chunk {
187183 ObjectMeta : metav1.ObjectMeta {
188- Name : chunkName ,
189- Labels : map [string ]string {
190- BearerUIDLabelKey : string (bearer .UID ),
191- },
184+ Name : chunkName ,
185+ Labels : map [string ]string {},
192186 Annotations : map [string ]string {
193187 BearerNameAnnotationKey : bearer .Name ,
194188 },
195- OwnerReferences : []metav1.OwnerReference {
196- {
197- APIVersion : v1alpha1 .GroupVersion .String (),
198- Kind : v1alpha1 .BearerKind ,
199- Name : bearer .Name ,
200- UID : bearer .UID ,
201- },
202- },
203189 },
204190 Spec : v1alpha1.ChunkSpec {
205191 Priority : bearer .Spec .Priority + 1 ,
0 commit comments