Indent values.yaml using 2 instead of 4 spaces (#9656)

* Generate values.yaml with indentation of 2

Signed-off-by: Alan Clucas <alan@clucas.org>

* Fix review comments

---------

Signed-off-by: Alan Clucas <alan@clucas.org>
This commit is contained in:
Alan Clucas 2023-03-09 15:26:04 +00:00 committed by GitHub
parent ec2fe2b6d1
commit 4f74e03aad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,7 @@ limitations under the License.
package main
import (
"bytes"
"fmt"
"os"
"strings"
@ -146,9 +147,12 @@ func updateChartValue(key, value string) {
}
//// write to file
newValueFile, err := yaml.Marshal(&n)
var b bytes.Buffer
yamlEncoder := yaml.NewEncoder(&b)
yamlEncoder.SetIndent(2)
err = yamlEncoder.Encode(&n)
CheckIfError(err, "HELM Could not Marshal new Values file")
err = os.WriteFile(HelmChartValues, newValueFile, 0644)
err = os.WriteFile(HelmChartValues, b.Bytes(), 0644)
CheckIfError(err, "HELM Could not write new Values file to %s", HelmChartValues)
Info("HELM Ingress Nginx Helm Chart update %s %s", key, value)