Skip to content

Commit

Permalink
add annotations to configuration.metadata
Browse files Browse the repository at this point in the history
Signed-off-by: aabidsofi19 <[email protected]>
  • Loading branch information
aabidsofi19 committed Dec 23, 2024
1 parent f422782 commit e5a2829
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/handlers/meshsync_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,24 @@ func ConvertToPatternFile(resources []model.KubernetesResource, stripSchema bool
}

labels := map[string]string{}
annotations := map[string]string{}

if resource.KubernetesResourceMeta.Labels != nil {
for _, label := range resource.KubernetesResourceMeta.Labels {
labels[label.Key] = label.Value
}
}

if resource.KubernetesResourceMeta.Annotations != nil {
for _, annotation := range resource.KubernetesResourceMeta.Annotations {
annotations[annotation.Key] = annotation.Value
}
}

metadata := map[string]interface{}{
"labels": labels,
"name": resource.KubernetesResourceMeta.Name,
"labels": labels,
"annotations": annotations,
"name": resource.KubernetesResourceMeta.Name,
}

// only set namespace if it is not empty otherwise evaluator creates empty namespace
Expand Down

0 comments on commit e5a2829

Please sign in to comment.