mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
fix the missing fields in all edit commands
This commit is contained in:
@@ -153,6 +153,10 @@ func (mf *kustomizationFile) Read() (*types.Kustomization, error) {
|
||||
return nil, err
|
||||
}
|
||||
k.DealWithDeprecatedFields()
|
||||
msgs := k.DealWithMissingFields()
|
||||
if len(msgs) > 0 {
|
||||
log.Printf(strings.Join(msgs, "\n"))
|
||||
}
|
||||
err = mf.parseCommentedFields(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -78,6 +78,7 @@ func TestWriteAndRead(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Couldn't read kustomization file: %v\n", err)
|
||||
}
|
||||
kustomization.DealWithMissingFields()
|
||||
if !reflect.DeepEqual(kustomization, content) {
|
||||
t.Fatal("Read kustomization is different from written kustomization")
|
||||
}
|
||||
@@ -172,6 +173,8 @@ func TestPreserveComments(t *testing.T) {
|
||||
`# shem qing some comments
|
||||
# This is some comment we should preserve
|
||||
# don't delete it
|
||||
apiVersion: v1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- pod.yaml
|
||||
- service.yaml
|
||||
|
||||
Reference in New Issue
Block a user