mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +00:00
Replace patchesJson6902 field with patches.
This commit is contained in:
@@ -9,14 +9,15 @@ import (
|
|||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FixKustomizationPreUnmarshalling modies the raw data
|
// FixKustomizationPreUnmarshalling modifies the raw data
|
||||||
// before marshalling - e.g. changes old field names to
|
// before marshalling - e.g. changes old field names to
|
||||||
// new field names.
|
// new field names.
|
||||||
func FixKustomizationPreUnmarshalling(data []byte) ([]byte, error) {
|
func FixKustomizationPreUnmarshalling(data []byte) ([]byte, error) {
|
||||||
deprecateFieldsMap := map[string]string{
|
deprecatedFieldsMap := map[string]string{
|
||||||
"imageTags:": "images:",
|
"imageTags:": "images:",
|
||||||
|
"patchesJson6902": "patches",
|
||||||
}
|
}
|
||||||
for oldname, newname := range deprecateFieldsMap {
|
for oldname, newname := range deprecatedFieldsMap {
|
||||||
pattern := regexp.MustCompile(oldname)
|
pattern := regexp.MustCompile(oldname)
|
||||||
data = pattern.ReplaceAll(data, []byte(newname))
|
data = pattern.ReplaceAll(data, []byte(newname))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user