fix edit of non-registered custom API types
Kubernetes-commit: e07a6c9e523c11509f3264ad1ef2ea381709a29c
This commit is contained in:
parent
dd304ca4d8
commit
7da3d10e34
|
@ -19,6 +19,7 @@ package editor
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -667,8 +668,14 @@ func (o *EditOptions) visitToPatch(originalInfos []*resource.Info, patchVisitor
|
||||||
klog.V(4).Infof("Unable to calculate diff, no merge is possible: %v", err)
|
klog.V(4).Infof("Unable to calculate diff, no merge is possible: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
var patchMap map[string]interface{}
|
||||||
|
err = json.Unmarshal(patch, &patchMap)
|
||||||
|
if err != nil {
|
||||||
|
klog.V(4).Infof("Unable to calculate diff, no merge is possible: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
for _, precondition := range preconditions {
|
for _, precondition := range preconditions {
|
||||||
if !precondition(patch) {
|
if !precondition(patchMap) {
|
||||||
klog.V(4).Infof("Unable to calculate diff, no merge is possible: %v", err)
|
klog.V(4).Infof("Unable to calculate diff, no merge is possible: %v", err)
|
||||||
return fmt.Errorf("%s", "At least one of apiVersion, kind and name was changed")
|
return fmt.Errorf("%s", "At least one of apiVersion, kind and name was changed")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue