1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-25 14:48:06 +00:00

Prepend 3 dashes at the beginning of addon YAMLs if missing. Resolves #1251.

This commit is contained in:
jlamillan
2019-04-05 12:38:25 -07:00
committed by Alena Prokharchyk
parent e1d0899efe
commit d9f2a41e5a

View File

@@ -160,6 +160,13 @@ func (c *Cluster) deployAddonsInclude(ctx context.Context) error {
if err := validateUserAddonYAML(addonYAML); err != nil { if err := validateUserAddonYAML(addonYAML); err != nil {
return err return err
} }
// Put 3 dashes (---) at beginning of next YAML if it is not there already so we can append to manifests
dashes := "---\n"
if !strings.HasPrefix(string(addonYAML[:]), dashes) {
addonYAML = append([]byte(dashes), addonYAML...)
}
manifests = append(manifests, addonYAML...) manifests = append(manifests, addonYAML...)
} else if isFilePath(addon) { } else if isFilePath(addon) {
addonYAML, err := ioutil.ReadFile(addon) addonYAML, err := ioutil.ReadFile(addon)