A tool to take a deployed set of kubernetes resources and turn them into a helm release. Only works with helm3 > 3.2.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
617 B

package exporters
import (
"fmt"
"github.com/ashb/jqrepl/jq"
)
func jQOnJSONByteArray(command string, jsonByteArray []byte) []byte {
jqInForm, err := jq.JvFromJSONBytes(jsonByteArray)
if err != nil {
panic(err.Error())
}
jqObj, err := jq.New()
if err != nil {
panic(err.Error())
}
errs := jqObj.Compile(command, jq.JvArray())
if errs != nil {
for _, e := range errs {
fmt.Printf("E: %s\n", e.Error())
}
panic("Errors above!")
}
jQForm, err := jqObj.Execute(jqInForm)
if err != nil {
panic(err.Error())
}
finalJSONForm := []byte(jQForm[0].Dump(jq.JvPrintNone))
return finalJSONForm
}