From 66ee76b4e6bc00a50ef976f1ee379942f2ee00d5 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Mon, 23 Sep 2024 22:34:18 +0530 Subject: [PATCH] remove annotations before converting to manifests Signed-off-by: MUzairS15 --- converter/k8s.go | 2 ++ models/patterns/pattern.go | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/converter/k8s.go b/converter/k8s.go index 7d87c3fb..10c776ca 100644 --- a/converter/k8s.go +++ b/converter/k8s.go @@ -17,6 +17,8 @@ func (k *K8sConverter) Convert(patternFile string) (string, error) { if err != nil { return "", err } + + patterns.ProcessAnnotations(pattern) return NewK8sManifestsFromPatternfile(pattern) } diff --git a/models/patterns/pattern.go b/models/patterns/pattern.go index 5b933132..e206a5c7 100644 --- a/models/patterns/pattern.go +++ b/models/patterns/pattern.go @@ -4,6 +4,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/layer5io/meshkit/encoding" "github.com/layer5io/meshkit/utils" + "github.com/meshery/schemas/models/v1beta1/component" "github.com/meshery/schemas/models/v1beta1/pattern" ) @@ -36,3 +37,13 @@ func GetPatternFormat(patternFile string) (*pattern.PatternFile, error) { } return &pattern, nil } + +func ProcessAnnotations(pattern *pattern.PatternFile) { + components := []*component.ComponentDefinition{} + for _, component := range pattern.Components { + if !component.Metadata.IsAnnotation { + components = append(components, component) + } + } + pattern.Components = components +}