-
Notifications
You must be signed in to change notification settings - Fork 45
Update to latest manifestival to apply strategic merge patches to its resources. #243
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import ( | |
"go.uber.org/zap" | ||
appsv1 "k8s.io/api/apps/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
"k8s.io/client-go/kubernetes/scheme" | ||
caching "knative.dev/caching/pkg/apis/caching/v1alpha1" | ||
|
@@ -75,6 +76,9 @@ func updateDeployment(instance *servingv1alpha1.KnativeServing, u *unstructured. | |
if err != nil { | ||
return err | ||
} | ||
// The zero-value timestamp defaulted by the conversion causes | ||
// superfluous updates | ||
u.SetCreationTimestamp(metav1.Time{}) | ||
|
||
log.Debugw("Finished conversion", "name", u.GetName(), "unstructured", u.Object) | ||
return nil | ||
|
@@ -109,6 +113,10 @@ func updateCachingImage(instance *servingv1alpha1.KnativeServing, u *unstructure | |
if err != nil { | ||
return err | ||
} | ||
// Cleanup zero-value default to prevent superfluous updates | ||
u.SetCreationTimestamp(metav1.Time{}) | ||
delete(u.Object, "status") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The need to delete status here again seems like something that would be hard for someone to know to do. Would it make sense to have manifestival ingore status when comparing for equality? Or is this not a generic/universal enough need? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was curious about this, too, because the core types don't exhibit this behavior. Note that converting to |
||
|
||
log.Debugw("Finished conversion", "name", u.GetName(), "unstructured", u.Object) | ||
return nil | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious if these would now also be fixed due to the three-way-merge semantics? I.e., do we need to manually set them still?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're relying on this logic to actually remove the field. Without it, we attempt to apply the
Time
's zero-value set by the typed object.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The need for this seems like it could be non-obvious for those implementing new transforms. Would it make sense to move logic which ignores creation timestamp (or something similar) to a location that allows it to be re-used (manifestival, or somewhere else in this package)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I view it as a tradeoff for being able to treat any type in the manifest as
Unstructured
. I would prefer not to special-case any fields at this time, if we can avoid it.And though I share your concern about the non-obviousness, keep these in mind:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Thanks.