namespace: add namespace label
in order to select namespace when convert nsnp to k8snp Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
This commit is contained in:
@@ -34,6 +34,7 @@ const (
|
||||
IngressControllerPrefix = "kubesphere-router-"
|
||||
|
||||
WorkspaceLabelKey = "kubesphere.io/workspace"
|
||||
NamespaceLabelKey = "kubesphere.io/namespace"
|
||||
DisplayNameAnnotationKey = "kubesphere.io/alias-name"
|
||||
DescriptionAnnotationKey = "kubesphere.io/description"
|
||||
CreatorAnnotationKey = "kubesphere.io/creator"
|
||||
|
||||
@@ -117,6 +117,10 @@ func (r *ReconcileNamespace) Reconcile(request reconcile.Request) (reconcile.Res
|
||||
// then lets add the finalizer and update the object.
|
||||
if !sliceutil.HasString(instance.ObjectMeta.Finalizers, finalizer) {
|
||||
instance.ObjectMeta.Finalizers = append(instance.ObjectMeta.Finalizers, finalizer)
|
||||
if instance.Labels == nil {
|
||||
instance.Labels = make(map[string]string)
|
||||
}
|
||||
instance.Labels[constants.NamespaceLabelKey] = instance.Name
|
||||
if err := r.Update(context.Background(), instance); err != nil {
|
||||
return reconcile.Result{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user