Repository navigation
Use PATCH when updating a Configuration's Route label - #1704
Conversation
|
/hold |
Addresses: knative#1127 Use json merge patching given that vanilla json patch will fail if a configuration doesn't have any prior labels
|
/hold cancel |
mattmoor
left a comment
There was a problem hiding this comment.
/lgtm
/approve
/hold
This is awesome, thanks so much for doing this. One nit inline, and a (likely infeasible) idea for generalizing this.
| mergePatch := map[string]interface{}{ | ||
| "metadata": map[string]interface{}{ | ||
| "labels": map[string]interface{}{ | ||
| serving.RouteLabelKey: routeName, |
There was a problem hiding this comment.
seems weird to make this *string instead of just passing the string and taking the &routeName here.
There was a problem hiding this comment.
You need to be able to have null in the json so that it deletes the keyed entry from the object
There was a problem hiding this comment.
I'll add a comment because it's not very clear
for context: https://tools.ietf.org/html/rfc7386#section-1
| return nil | ||
| } | ||
|
|
||
| func setRouteLabelForConfiguration(configClient servingv1alpha1.ConfigurationInterface, configName string, routeName *string) error { |
There was a problem hiding this comment.
In principle, we should be able to generalize this into a helper in pkg/controller as something that takes:
type Patcher interface {
Patch(name string, pt types.PatchType(?), patch map[string]interface{})
}You might also want this function to take the map[string]interface{} of "labels"...
REVISIT: As I realized I omitted the return type, I realized that the signature variance would likely be our downfall. :(
There was a problem hiding this comment.
I realized that the signature variance would likely be our downfall. :(
der untergang
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, mattmoor The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold cancel |
|
The following is the coverage report on pkg/.
|
|
/test pull-knative-serving-unit-tests |
* Use PATCH when updating a Configuration's Route label Addresses: knative#1127 Use json merge patching given that vanilla json patch will fail if a configuration doesn't have any prior labels * Provide a comment to point out how a route label can be removed
* Use PATCH when updating a Configuration's Route label Addresses: knative#1127 Use json merge patching given that vanilla json patch will fail if a configuration doesn't have any prior labels * Provide a comment to point out how a route label can be removed
Addresses: #1127