Merge pull request #1584 from CharlesQQ/master
fix: bugfix response's patch and patchType is nil, controller panic
This commit is contained in:
commit
756fd12dd3
|
@ -252,6 +252,9 @@ func (e *CustomizedInterpreter) callHook(ctx context.Context, hook configmanager
|
|||
func applyPatch(object *unstructured.Unstructured, patch []byte, patchType configv1alpha1.PatchType) (*unstructured.Unstructured, error) {
|
||||
switch patchType {
|
||||
case configv1alpha1.PatchTypeJSONPatch:
|
||||
if len(patch) == 0 {
|
||||
return object, nil
|
||||
}
|
||||
patchObj, err := jsonpatch.DecodePatch(patch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -107,7 +107,9 @@ func verifyResourceInterpreterContext(operation configv1alpha1.InterpreterOperat
|
|||
return nil, err
|
||||
}
|
||||
res.Patch = response.Patch
|
||||
res.PatchType = *response.PatchType
|
||||
if response.PatchType != nil {
|
||||
res.PatchType = *response.PatchType
|
||||
}
|
||||
return res, nil
|
||||
case configv1alpha1.InterpreterOperationInterpretStatus:
|
||||
res.RawStatus = *response.RawStatus
|
||||
|
|
Loading…
Reference in New Issue