From 35a647a8f5897e737d765973eb0ba6ce0a1d8965 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Thu, 26 Oct 2023 01:18:11 -0400 Subject: [PATCH] Instead of using channel service name, we directly use channel name for Path --- .../pkg/reconciler/channel/channel.go | 6 +-- .../pkg/reconciler/channel/channel_test.go | 41 +++++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/control-plane/pkg/reconciler/channel/channel.go b/control-plane/pkg/reconciler/channel/channel.go index 2f10d81407..a638cb1993 100644 --- a/control-plane/pkg/reconciler/channel/channel.go +++ b/control-plane/pkg/reconciler/channel/channel.go @@ -319,7 +319,7 @@ func (r *Reconciler) reconcileKind(ctx context.Context, channel *messagingv1beta } httpAddress := receiver.ChannelHTTPAddress(channelHttpHost) - httpsAddress := receiver.HTTPSAddress(channelHttpsHost, channelService, caCerts) + httpsAddress := receiver.HTTPSAddress(channelHttpsHost, channel, caCerts) // Permissive mode: // - status.address http address with path-based routing // - status.addresses: @@ -337,7 +337,7 @@ func (r *Reconciler) reconcileKind(ctx context.Context, channel *messagingv1beta return err } - httpsAddress := receiver.HTTPSAddress(channelHttpsHost, channelService, caCerts) + httpsAddress := receiver.HTTPSAddress(channelHttpsHost, channel, caCerts) addressableStatus.Addresses = []duckv1.Addressable{httpsAddress} addressableStatus.Address = &httpsAddress } else { @@ -672,7 +672,7 @@ func (r *Reconciler) getChannelContractResource(ctx context.Context, topic strin Ingress: &contract.Ingress{ Host: receiver.Host(channel.GetNamespace(), channel.GetName()), EnableAutoCreateEventTypes: feature.FromContext(ctx).IsEnabled(feature.EvenTypeAutoCreate), - Path: receiver.Path(channel.GetNamespace(), resources.MakeChannelServiceName(channel.GetName())), + Path: receiver.Path(channel.GetNamespace(), channel.GetName()), }, BootstrapServers: config.GetBootstrapServers(), Reference: &contract.Reference{ diff --git a/control-plane/pkg/reconciler/channel/channel_test.go b/control-plane/pkg/reconciler/channel/channel_test.go index 636871b559..5e710ab6d7 100644 --- a/control-plane/pkg/reconciler/channel/channel_test.go +++ b/control-plane/pkg/reconciler/channel/channel_test.go @@ -29,7 +29,6 @@ import ( "github.com/IBM/sarama" "k8s.io/utils/pointer" - "knative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/channel/resources" eventingduck "knative.dev/eventing/pkg/apis/duck/v1" "knative.dev/eventing/pkg/apis/feature" "knative.dev/eventing/pkg/eventingtls/eventingtlstesting" @@ -189,7 +188,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, }, @@ -264,7 +263,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, EgressConfig: &contract.EgressConfig{ @@ -341,7 +340,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, }, @@ -412,7 +411,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, }, @@ -487,7 +486,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{}, @@ -560,7 +559,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -638,7 +637,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -721,7 +720,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -804,7 +803,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -893,7 +892,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -1184,7 +1183,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, }, @@ -1282,7 +1281,7 @@ func TestReconcileKind(t *testing.T) { }, }, Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -1389,7 +1388,7 @@ func TestReconcileKind(t *testing.T) { }, }, Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -1493,7 +1492,7 @@ func TestReconcileKind(t *testing.T) { }, }, Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, Egresses: []*contract.Egress{{ @@ -1572,7 +1571,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, }, @@ -1642,7 +1641,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, }, @@ -1755,7 +1754,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, }, @@ -1841,7 +1840,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, EgressConfig: &contract.EgressConfig{ @@ -1944,7 +1943,7 @@ func TestReconcileKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, EgressConfig: &contract.EgressConfig{ @@ -2034,7 +2033,7 @@ func TestFinalizeKind(t *testing.T) { BootstrapServers: ChannelBootstrapServers, Reference: ChannelReference(), Ingress: &contract.Ingress{ - Path: receiver.Path(ChannelNamespace, resources.MakeChannelServiceName(ChannelName)), + Path: receiver.Path(ChannelNamespace, ChannelName), Host: receiver.Host(ChannelNamespace, ChannelName), }, },