fix issue with multiline configmap data with extra space

This commit is contained in:
natasha41575
2021-12-03 15:16:35 -08:00
parent c4a8a99834
commit a3d547ccd3
3 changed files with 17 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ package generators
import (
"fmt"
"strings"
"github.com/go-errors/errors"
"sigs.k8s.io/kustomize/api/ifc"
@@ -50,7 +51,11 @@ func makeValidatedDataMap(
return nil, errors.Errorf(
"configmap %s illegally repeats the key `%s`", name, p.Key)
}
knownKeys[p.Key] = p.Value
lines := strings.Split(p.Value, "\n")
for i := range lines {
lines[i] = strings.TrimSuffix(lines[i], " ")
}
knownKeys[p.Key] = strings.Join(lines, "\n")
}
return knownKeys, nil
}