Skip to content

Commit

Permalink
fix: add kustomize converter
Browse files Browse the repository at this point in the history
Signed-off-by: Aabid Sofi <mailtoaabid01@gmail.com>
  • Loading branch information
aabidsofi19 committed Feb 4, 2025
1 parent 1fd60b6 commit 44b319d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions files/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package files

import (
"fmt"

"github.com/layer5io/meshkit/utils/helm"
"helm.sh/helm/v3/pkg/chart"
"sigs.k8s.io/kustomize/api/resmap"
)

func ConvertHelmChartToKubernetesManifest(file IdentifiedFile) (string, error) {
Expand All @@ -27,3 +29,15 @@ func ConvertDockerComposeToKubernetesManifest(file IdentifiedFile) (string, erro

return parsedCompose.manifest, nil
}

func ConvertKustomizeToKubernetesManifest(file IdentifiedFile) (string, error) {
parsedKustomize, ok := file.ParsedFile.(resmap.ResMap)

if !ok {
return "", fmt.Errorf("Failed to get *resmap.ResMap from identified file")
}

yamlBytes, err := parsedKustomize.AsYaml()

return string(yamlBytes), err
}

0 comments on commit 44b319d

Please # to comment.