Parse the kubelet.conf data after an update
After a kubeletconfig CR rolls out updates to the
kubelet.conf, we want to parse the contents so that
it is printed out in a pretty format.
@@ -2,6 +2,7 @@ package kubeletconfig
import (
"bytes"
+ "encoding/json"
"fmt"
ign "github.com/coreos/ignition/config/v2_2"
@@ -19,8 +20,12 @@ import (
)
func createNewKubeletIgnition(jsonConfig []byte) igntypes.Config {
+ // Want the kubelet.conf file to have the pretty JSON formatting
+ buf := new(bytes.Buffer)
+ json.Indent(buf, jsonConfig, "", " ")
+
mode := 0644
- du := dataurl.New(jsonConfig, "text/plain")
+ du := dataurl.New(buf.Bytes(), "text/plain")
du.Encoding = dataurl.EncodingASCII
tempFile := igntypes.File{
Node: igntypes.Node{
