Skip to content

Commit

Permalink
[feat] enable setting object namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
min-charles committed Jan 29, 2024
1 parent becee2a commit 8f446ad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions controllers/templateinstance/templateinstance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"encoding/json"
"fmt"
"reflect"

jsonpatch "github.com/evanphx/json-patch"
"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -28,7 +30,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"reflect"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"
Expand Down Expand Up @@ -253,9 +254,9 @@ func (r *TemplateInstanceReconciler) createObject(obj *runtime.RawExtension, own
}

// set namespace if not exist
//if len(unstr.GetNamespace()) == 0 {
unstr.SetNamespace(owner.Namespace)
//}
if len(unstr.GetNamespace()) == 0 {
unstr.SetNamespace(owner.Namespace)
}

// set owner reference
isController := false
Expand Down

0 comments on commit 8f446ad

Please sign in to comment.