Skip to content

Commit

Permalink
Merge pull request #664 from meshery/kustomize
Browse files Browse the repository at this point in the history
fix: add kustomize converter
  • Loading branch information
aabidsofi19 authored Feb 4, 2025
2 parents 3bac733 + 44b319d commit 45d8de5
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 45d8de5

Please sign in to comment.