Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
8fb909a6
Unverified
Commit
8fb909a6
authored
Feb 06, 2018
by
Matt Farina
Committed by
GitHub
Feb 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3459 from mattfarina/fix/3382
fix(api-machinery): Fixes patching for unstructured objects
parents
f61a3cff
e6137ff0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
client.go
pkg/kube/client.go
+12
-1
No files found.
pkg/kube/client.go
View file @
8fb909a6
...
...
@@ -399,14 +399,25 @@ func createPatch(mapping *meta.RESTMapping, target, current runtime.Object) ([]b
return
nil
,
types
.
StrategicMergePatchType
,
fmt
.
Errorf
(
"serializing target configuration: %s"
,
err
)
}
// While different objects need different merge types, the parent function
// that calls this does not try to create a patch when the data (first
// returned object) is nil. We can skip calculating the the merge type as
// the returned merge type is ignored.
if
apiequality
.
Semantic
.
DeepEqual
(
oldData
,
newData
)
{
return
nil
,
types
.
StrategicMergePatchType
,
nil
}
// Get a versioned object
versionedObject
,
err
:=
mapping
.
ConvertToVersion
(
target
,
mapping
.
GroupVersionKind
.
GroupVersion
())
// Unstructured objects, such as CRDs, may not have an not registered error
// returned from ConvertToVersion. Anything that's unstructured should
// use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported
// on objects like CRDs.
_
,
isUnstructured
:=
versionedObject
.
(
runtime
.
Unstructured
)
switch
{
case
runtime
.
IsNotRegisteredError
(
err
)
:
case
runtime
.
IsNotRegisteredError
(
err
)
,
isUnstructured
:
// fall back to generic JSON merge patch
patch
,
err
:=
jsonpatch
.
CreateMergePatch
(
oldData
,
newData
)
return
patch
,
types
.
MergePatchType
,
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment