Skip to content

Commit e84e1f2

Browse files
suvaanshkumararttor
authored andcommitted
Add namespace to metadata
1 parent 1a32d20 commit e84e1f2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/processor/meta.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const metaTemplate = `apiVersion: %[1]s
1616
kind: %[2]s
1717
metadata:
1818
name: %[3]s
19+
namespace: %[7]s # Include the namespace here
1920
labels:
2021
%[5]s
2122
{{- include "%[4]s.labels" . | nindent 4 }}
@@ -80,6 +81,7 @@ func ProcessObjMeta(appMeta helmify.AppMetadata, obj *unstructured.Unstructured,
8081
return "", err
8182
}
8283
}
84+
ns := obj.GetNamespace()
8385

8486
templatedName := appMeta.TemplatedName(obj.GetName())
8587
apiVersion, kind := obj.GetObjectKind().GroupVersionKind().ToAPIVersionAndKind()
@@ -100,7 +102,7 @@ func ProcessObjMeta(appMeta helmify.AppMetadata, obj *unstructured.Unstructured,
100102
annotations = fmt.Sprintf(annotationsTemplate, name, kind)
101103
}
102104

103-
metaStr = fmt.Sprintf(metaTemplate, apiVersion, kind, templatedName, appMeta.ChartName(), labels, annotations)
105+
metaStr = fmt.Sprintf(metaTemplate, apiVersion, kind, templatedName, appMeta.ChartName(), labels, annotations, ns)
104106
metaStr = strings.Trim(metaStr, " \n")
105107
metaStr = strings.ReplaceAll(metaStr, "\n\n", "\n")
106108
return metaStr, nil

0 commit comments

Comments
 (0)