Skip to content

Commit

Permalink
Add parent and owner reference into the namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ubombar committed Mar 21, 2024
1 parent 32a30cc commit 870f6d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/multitenancy/v1/multitenancy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package multitenancy

import (
"context"
"fmt"

antreav1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1"
multitenancyv1 "github.com/edgenet-project/edgenet/api/multitenancy/v1"
Expand Down Expand Up @@ -395,8 +394,6 @@ func (m *multiTenancyManager) SubNamespaceCleanup(ctx context.Context, s *multit
return err
}

fmt.Println("Deleted successfully")

return nil
}

Expand All @@ -411,6 +408,11 @@ func (m *multiTenancyManager) SetupSubNamespace(ctx context.Context, s *multiten
Labels: map[string]string{
"edge-net.io/generated": "true",
"edge-net.io/kind": "sub",
"edge-net.io/parent": s.GetNamespace(),
},
// The owner reference is required to ensure the namespace cannot be deleted before the subnamespace object.
OwnerReferences: []metav1.OwnerReference{
*metav1.NewControllerRef(s, s.GroupVersionKind()),
},
},
}
Expand Down

0 comments on commit 870f6d2

Please sign in to comment.