Knative ConfigMap Propagation#2333
Conversation
|
Is this something Knative Serving also needs? |
# Conflicts: # cmd/broker/ingress/main.go # pkg/reconciler/namespace/namespace.go # pkg/reconciler/namespace/namespace_test.go
|
ready for review @grantr |
yolocs
left a comment
There was a problem hiding this comment.
Good job, Grace! Next time, try to break up your PRs into smaller chunks. E.g. in this case, I would at least have two PRs - one for the new API and one for using the new API. It would be much more review-friendly :)
# Conflicts: # hack/update-codegen.sh
|
Done. Ready for review again. |
antoineco
left a comment
There was a problem hiding this comment.
Some initial comments. This is a very large PR so I'll need to find more time to review more in depth.
grantr
left a comment
There was a problem hiding this comment.
Fully reviewed now. I have a couple minor comments and some followup issues. Otherwise I think this is good to merge.
| // Tell tracker to reconcile this ConfigMapPropagation whenever an original ConfigMap changes. | ||
| // Note: Temporarily set Selector to match all objects. | ||
| // If Selector is set to match specific labels (the required labels from ConfigMapPropagation), | ||
| // the tracker can't track changes when an original ConfigMap no longer has required labels. |
| Namespace: cmp.Spec.OriginalNamespace, | ||
| Selector: metav1.SetAsLabelSelector(map[string]string{}), | ||
| } | ||
| if err := r.tracker.TrackReference(originalConfigMapObjRef, cmp); err != nil { |
There was a problem hiding this comment.
Since we know the GVK of this object, I'd prefer to use informer event handlers (set up in the constructor in controller.go) instead of the tracker here. I think that's a bit more clear about what watch events will cause the reconciler to run. I created a followup issue to track this: #2436
| // Tell tracker to reconcile this ConfigMapPropagation whenever the a copy ConfigMap changes. | ||
| // Note: Temporarily set Selector to match all objects. | ||
| // If Selector is set to match specific labels (the required labels from creation), | ||
| // the tracker can't track changes when a copy ConfigMap no longer has required labels. |
There was a problem hiding this comment.
I believe we can replace this with an informer event handler that watches for ConfigMaps owned by CMPs OR with the copy label. The "OR label" clause capture copies that previously had their labels removed for user modifications, then re-added to revert those modifications. I mentioned this in #2435 also.
| // OwnerReference will be removed when the knative.dev/config-propagation:copy label is not set in copy configmap | ||
| // so that this copy configmap will not be deleted if cmp is deleted. | ||
| expected = current.DeepCopy() | ||
| expected.OwnerReferences = nil |
There was a problem hiding this comment.
Here we should only delete the CMP's owner reference. Theoretically other owner references might exist by the time we reconcile. There might be helper methods for this (or if not, you could write one).
I think this is such a rare case that handling it is optional, so I created a followup issue: #2437
| Eventf(corev1.EventTypeNormal, configMapPropagationReadinessChanged, "ConfigMapPropagation %q became ready", configMapPropagationName), | ||
| }, | ||
| }, { | ||
| Name: "Copy ConfigMap no longer has required labels", |
There was a problem hiding this comment.
Related to the comment above and #2437: if we write code to only delete the CMP owner reference, we should add a test case for abandoning a ConfigMap with multiple owner references.
# Conflicts: # cmd/controller/main.go # config/200-addressable-resolvers-clusterrole.yaml # config/200-controller-clusterrole.yaml # config/config-logging.yaml # config/config-observability.yaml # config/config-tracing.yaml # hack/update-codegen.sh # pkg/reconciler/inmemorychannel/dispatcher/controller.go
6b710ba to
18a2832
Compare
# Conflicts: # cmd/broker/filter/main.go # cmd/broker/ingress/main.go # hack/update-codegen.sh # pkg/client/informers/externalversions/generic.go
|
Thank you for reviewing it and opening subsequent issues! @grantr. I changed api group to be |
| @@ -0,0 +1 @@ | |||
| core/resources/configmappropagation.yaml No newline at end of file | |||
There was a problem hiding this comment.
Add trailing newline:
| core/resources/configmappropagation.yaml | |
| core/resources/configmappropagation.yaml | |
There was a problem hiding this comment.
Does symbolic link also need trailing newline?
There was a problem hiding this comment.
No, don't edit this file. @mattmoor your bot should probably ignore symlinks
|
The following is the coverage report on the affected files.
|
|
/kind feature |
|
@grantr: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: grac3gao, grantr 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 |
|
/remove-area test-and-release |
Fixes #1758
Proposed Changes
ConfigMapPropagationand a corresponding controller to copy ConfigMaps from one namespace to another, 2) Updating Eventing Broker to adapt this CRDRelease Note