Use GenerateName for Channel's Service and VirtualService#674
Conversation
…updates the K8s Service appropriately.
…n now guarantees they are owned). Fix unit tests.
|
|
||
| func k8sServiceLabels(c *eventingv1alpha1.Channel) map[string]string { | ||
| return map[string]string{ | ||
| "channel": c.Name, |
There was a problem hiding this comment.
in the serving stack, labels like these would be:
serving.knative.dev/route: my-route-name
serving.knative.dev/service: my-service-name
So, maybe while you're here change these to conform?
eventing.knative.dev/channel: c.Name
eventing.knative.dev/provisioner: c.Spec.Provisioner.Name
I'm fine with a follow on issue to track this work, but figured while you're doing this... :)
There was a problem hiding this comment.
The downside of this change is that all the existing Services and VirtualServices would immediately be ignored. New generated name versions would be created immediately (although the existing ones would continue to exist until the Channel was deleted).
Hmm, maybe that isn't so bad. Calling the old Service should still work. Calling the new one would work.
One thing I would need to verify is what happens if there are multiple VirtualServices that attempt to rewrite the same host, as both the old and new VirtualService would attempt to rewrite channel-name.channel-namespace.channels.cluster.local. They would both try to rewrite it in the same way, but I don't know if multiple definitions would be problematic.
I'll test out what happens with the multiple VirtualServices. Assuming that works, I'll make the change. Are these the labels you want?
eventing.knative.dev/channel: c.Name
eventing.knative.dev/provisioner: c.Spec.Provisioner.Name
There was a problem hiding this comment.
Yes. One additional option would be to keep them both for one release?
There was a problem hiding this comment.
It looks like it is unsupported to have multiple VirtualServices use the same host with a 'catch-all' rule. Also, the sidecar doesn't seem to support multiple VirtualServices with the same host. From the docs:
A VirtualService can only be fragmented this way if it is bound to a gateway. Host merging is not supported in sidecars.
In fact, I can see the following logs in a sidecar when I tried to make the change:
[2018-12-10 21:26:47.448][21][warning][config] bazel-out/k8-opt/bin/external/envoy/source/common/config/_virtual_includes/grpc_mux_subscription_lib/common/config/grpc_mux_subscription_impl.h:70] gRPC config for type.googleapis.com/envoy.api.v2.RouteConfiguration rejected: Only unique values for domains are permitted. Duplicate entry of domain gcp.default.channels.cluster.local
So, if we change the labels, things may happen to work, but Istio could choose to break that compatibility at any time. How they choose to break compatibility is undefined, and may result in non-working Channels (e.g. they reject the entire VirtualService rather than just the problematic portion). If we still choose to change the labels, then I would suggest we tell users to either manually bounce all Channels or to manually delete old VirtualServices.
We can make this backwards compatible. In this release, search based on the old labels and have the controller add the both the new and old labels to all Services and VirtualServices. Next release, only recognize the new labels (and stop writing them to existing Services and VirtualServices). This means that anyone upgrading 0.2 -> 0.3 -> 0.4 works. 0.2 -> 0.4 would have the same possible problems discussed above.
Do you still want to change them? If so, breaking or backwards compatible?
|
Ok, thanks for the investigation. I've opened this to track the work for unifying the labels so we catch them all: |
|
/test pull-knative-eventing-go-coverage |
|
The following is the coverage report on pkg/.
|
|
/lgtm Please make sure to update the Release Notes with the appropriate comments (for update related concerns.) |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Harwayne, vaikas-google 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 |
Fixes #648
Proposed Changes
Channel's K8sServiceandVirtualService.Services andVirtualServices are retained. If they are deleted, then they will be replaced with a generated name.Release Note