Skip to content

Commit

Permalink
Merge pull request #411 from MUzairS15/add-func
Browse files Browse the repository at this point in the history
add required func
  • Loading branch information
MUzairS15 committed Nov 10, 2023
2 parents f2919bb + 2797dad commit 36e8b99
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions utils/manifests/getComponents.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
package manifests

import (
"context"
"encoding/json"
"io"
"strings"

"gopkg.in/yaml.v3"

"github.com/layer5io/meshkit/utils"
k8s "github.com/layer5io/meshkit/utils/kubernetes"
)


func GetFromManifest(ctx context.Context, url string, resource int, cfg Config) (*Component, error) {
manifest, err := utils.ReadFileSource(url)
if err != nil {
return nil, err
}
comp, err := GenerateComponents(ctx, manifest, resource, cfg)
if err != nil {
return nil, err
}
return comp, nil
}

func GetFromHelm(ctx context.Context, url string, resource int, cfg Config) (*Component, error) {
manifest, err := k8s.GetManifestsFromHelm(url)
if err != nil {
return nil, err
}
comp, err := GenerateComponents(ctx, manifest, resource, cfg)
if err != nil {
return nil, err
}
return comp, nil
}

func GetCrdsFromHelm(url string) ([]string, error) {
manifest, err := k8s.GetManifestsFromHelm(url)
if err != nil {
Expand Down

0 comments on commit 36e8b99

Please sign in to comment.