Skip to content

Commit

Permalink
Replace patchesJson6902 field with patches.
Browse files Browse the repository at this point in the history
  • Loading branch information
etefera committed Aug 1, 2020
1 parent 7eac250 commit bc5859d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions api/types/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import (
"sigs.k8s.io/yaml"
)

// FixKustomizationPreUnmarshalling modies the raw data
// FixKustomizationPreUnmarshalling modifies the raw data
// before marshalling - e.g. changes old field names to
// new field names.
func FixKustomizationPreUnmarshalling(data []byte) ([]byte, error) {
deprecateFieldsMap := map[string]string{
"imageTags:": "images:",
deprecatedFieldsMap := map[string]string{
"imageTags:": "images:",
"patchesJson6902": "patches",
}
for oldname, newname := range deprecateFieldsMap {
for oldname, newname := range deprecatedFieldsMap {
pattern := regexp.MustCompile(oldname)
data = pattern.ReplaceAll(data, []byte(newname))
}
Expand Down

0 comments on commit bc5859d

Please sign in to comment.