fix yaml parsing (#330)

This commit is contained in:
Itiel shwartz
2023-04-11 19:06:42 +03:00
committed by GitHub
parent 450804ba24
commit dd1fe05d65

View File

@@ -1,10 +1,10 @@
package objects package objects
import ( import (
"bytes"
"context" "context"
"encoding/json" "encoding/json"
"os" "os"
"strings"
"sync" "sync"
"time" "time"
@@ -14,11 +14,11 @@ import (
"github.com/komodorio/helm-dashboard/pkg/dashboard/subproc" "github.com/komodorio/helm-dashboard/pkg/dashboard/subproc"
"github.com/pkg/errors" "github.com/pkg/errors"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli" "helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
v1 "k8s.io/apimachinery/pkg/apis/testapigroup/v1" v1 "k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd"
//"sigs.k8s.io/yaml" //"sigs.k8s.io/yaml"
) )
@@ -103,8 +103,7 @@ func (d *DataLayer) GetStatus() *StatusInfo {
type SectionFn = func(*release.Release, bool) (string, error) type SectionFn = func(*release.Release, bool) (string, error)
func ParseManifests(out string) ([]*v1.Carp, error) { func ParseManifests(out string) ([]*v1.Carp, error) {
dec := yaml.NewDecoder(bytes.NewReader([]byte(out))) dec := yaml.NewYAMLOrJSONDecoder(strings.NewReader(out), 4096)
res := make([]*v1.Carp, 0) res := make([]*v1.Carp, 0)
var tmp interface{} var tmp interface{}
for { for {