Skip to content

Commit

Permalink
fix: fixed an issue where byte arrays are not correctly encoded when …
Browse files Browse the repository at this point in the history
…fetching YAMLs
  • Loading branch information
ffforest committed Dec 15, 2023
1 parent e462939 commit 74be14b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/core/manager/cluster/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
k8syaml "sigs.k8s.io/yaml"
)

type ClusterManager struct {
Expand Down Expand Up @@ -165,7 +166,7 @@ func (c *ClusterManager) GetYAMLForCluster(ctx context.Context, client *multiclu
if err != nil {
return nil, err
}
return yaml.Marshal(obj)
return k8syaml.Marshal(obj)
}

// GetYAMLForCluster returns the yaml byte array for a given cluster
Expand Down
4 changes: 2 additions & 2 deletions pkg/core/manager/resource/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
topologyutil "github.com/KusionStack/karbour/pkg/util/topology"
"github.com/dominikbraun/graph"
"github.com/dominikbraun/graph/draw"
yaml "gopkg.in/yaml.v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
k8syaml "sigs.k8s.io/yaml"
)

type ResourceManager struct {
Expand Down Expand Up @@ -56,7 +56,7 @@ func (c *ResourceManager) GetYAMLForResource(ctx context.Context, client *multic
if err != nil {
return nil, err
}
return yaml.Marshal(obj.Object)
return k8syaml.Marshal(obj.Object)
}

// GetTopologyForResource returns a map that describes topology for a given cluster
Expand Down

0 comments on commit 74be14b

Please sign in to comment.