Skip to content

Commit 8a63e04

Browse files
authored
Merge pull request #608 from Jougan-0/missingNameSpace
add missing namespace w/singoff
2 parents 140d9a5 + 4c91ba6 commit 8a63e04

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

converter/k8s.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func NewK8sManifestsFromPatternfile(patternFile *pattern.PatternFile) (string, e
3939
func CreateK8sResourceStructure(comp *component.ComponentDefinition) map[string]interface{} {
4040
annotations := map[string]interface{}{}
4141
labels := map[string]interface{}{}
42+
namespace := "default"
4243

4344
_confMetadata, ok := comp.Configuration["metadata"]
4445
if ok {
@@ -51,10 +52,14 @@ func CreateK8sResourceStructure(comp *component.ComponentDefinition) map[string]
5152
}
5253

5354
_label, ok := confMetadata["labels"]
54-
5555
if ok {
5656
labels, _ = utils.Cast[map[string]interface{}](_label)
5757
}
58+
59+
_ns, ok := confMetadata["namespace"]
60+
if ok {
61+
namespace, _ = utils.Cast[string](_ns)
62+
}
5863
}
5964
}
6065

@@ -65,11 +70,12 @@ func CreateK8sResourceStructure(comp *component.ComponentDefinition) map[string]
6570
"name": comp.DisplayName,
6671
"annotations": annotations,
6772
"labels": labels,
73+
"namespace": namespace,
6874
},
6975
}
7076

7177
for k, v := range comp.Configuration {
72-
if k == "apiVersion" || k == "kind" || k == "metadata" {
78+
if k == "apiVersion" || k == "kind" || k == "metadata" || k == "namespace" {
7379
continue
7480
}
7581

0 commit comments

Comments
 (0)