-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy path015-unset_status_manifestval.patch
28 lines (27 loc) · 1.12 KB
/
015-unset_status_manifestval.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/vendor/github.com/manifestival/manifestival/manifestival.go b/vendor/github.com/manifestival/manifestival/manifestival.go
index b8d07b8bc..892433fb6 100644
--- a/vendor/github.com/manifestival/manifestival/manifestival.go
+++ b/vendor/github.com/manifestival/manifestival/manifestival.go
@@ -133,7 +133,7 @@ func (m Manifest) apply(spec *unstructured.Unstructured, opts ...ApplyOption) er
annotate(current, v1.LastAppliedConfigAnnotation, lastApplied(current))
return m.Client.Create(current, opts...)
} else {
- diff, err := patch.New(current, spec)
+ diff, err := patch.New(unsetStatus(current), unsetStatus(spec))
if err != nil {
return err
}
@@ -156,6 +156,14 @@ func (m Manifest) apply(spec *unstructured.Unstructured, opts ...ApplyOption) er
}
}
+func unsetStatus(spec *unstructured.Unstructured) *unstructured.Unstructured {
+ spec = spec.DeepCopy()
+ if _, ok := spec.Object["status"]; ok {
+ spec.Object["status"] = nil
+ }
+ return spec
+}
+
// update a single resource
func (m Manifest) update(live, spec *unstructured.Unstructured, opts ...ApplyOption) error {
m.logResource("Updating", live)