Skip to content

Commit

Permalink
add required func
Browse files Browse the repository at this point in the history
Signed-off-by: MUzairS15 <[email protected]>
  • Loading branch information
MUzairS15 committed Nov 10, 2023
1 parent f2919bb commit 2797dad
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 2797dad

Please sign in to comment.