Skip to content

Commit

Permalink
Merge pull request #608 from Jougan-0/missingNameSpace
Browse files Browse the repository at this point in the history
add missing namespace w/singoff
  • Loading branch information
Jougan-0 authored Oct 15, 2024
2 parents 140d9a5 + 4c91ba6 commit 8a63e04
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions converter/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func NewK8sManifestsFromPatternfile(patternFile *pattern.PatternFile) (string, e
func CreateK8sResourceStructure(comp *component.ComponentDefinition) map[string]interface{} {
annotations := map[string]interface{}{}
labels := map[string]interface{}{}
namespace := "default"

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

_label, ok := confMetadata["labels"]

if ok {
labels, _ = utils.Cast[map[string]interface{}](_label)
}

_ns, ok := confMetadata["namespace"]
if ok {
namespace, _ = utils.Cast[string](_ns)
}
}
}

Expand All @@ -65,11 +70,12 @@ func CreateK8sResourceStructure(comp *component.ComponentDefinition) map[string]
"name": comp.DisplayName,
"annotations": annotations,
"labels": labels,
"namespace": namespace,
},
}

for k, v := range comp.Configuration {
if k == "apiVersion" || k == "kind" || k == "metadata" {
if k == "apiVersion" || k == "kind" || k == "metadata" || k == "namespace" {
continue
}

Expand Down

0 comments on commit 8a63e04

Please sign in to comment.