mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-11 15:30:51 +00:00
⚡ Add a default NodeSelectorTerm
that's matching Linux OS
This commit is contained in:
@@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
@@ -11,14 +12,27 @@ const (
|
||||
tab = "\t"
|
||||
)
|
||||
|
||||
func PrettyYaml(data interface{}) (string, error) {
|
||||
func PrettyYaml(data interface{}) (result string, err error) {
|
||||
var marshalled []byte
|
||||
marshalled, err = json.Marshal(data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var unmarshalled interface{}
|
||||
err = json.Unmarshal(marshalled, &unmarshalled)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
encoder := yaml.NewEncoder(buffer)
|
||||
encoder.SetIndent(2)
|
||||
|
||||
err := encoder.Encode(data)
|
||||
err = encoder.Encode(unmarshalled)
|
||||
if err != nil {
|
||||
return empty, err
|
||||
return
|
||||
}
|
||||
return buffer.String(), nil
|
||||
result = buffer.String()
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user