Skip to content

Commit

Permalink
Only decorate namespace for namespaced resources (#462)
Browse files Browse the repository at this point in the history
Signed-off-by: zhujian <jiazhu@redhat.com>
  • Loading branch information
zhujian7 committed May 15, 2024
1 parent 5313ff7 commit fd65f37
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/addon/templateagent/decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ func (d *namespaceDecorator) decorate(obj *unstructured.Unstructured) (*unstruct
return obj, nil
}

// set namespace for all manifests, if the manifest is cluster scoped, namespace will be ignored when
// being applied.
obj.SetNamespace(d.installNamespace)
// If obj has no namespace set, we do not mutate namespace assuming it is cluster scoped.
if len(obj.GetNamespace()) > 0 {
obj.SetNamespace(d.installNamespace)
}

paths, ok := d.paths[obj.GetKind()]
if !ok {
Expand Down

0 comments on commit fd65f37

Please sign in to comment.