Skip to content

Commit

Permalink
Instead of using channel service name, we directly use channel name f…
Browse files Browse the repository at this point in the history
…or Path
  • Loading branch information
Leo6Leo committed Oct 26, 2023
1 parent 8c94e7d commit 35a647a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
6 changes: 3 additions & 3 deletions control-plane/pkg/reconciler/channel/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 {
Expand Down Expand Up @@ -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{
Expand Down
41 changes: 20 additions & 21 deletions control-plane/pkg/reconciler/channel/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
},
},
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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),
},
},
Expand Down Expand Up @@ -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),
},
},
Expand Down Expand Up @@ -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{},
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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),
},
},
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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{{
Expand Down Expand Up @@ -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),
},
},
Expand Down Expand Up @@ -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),
},
},
Expand Down Expand Up @@ -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),
},
},
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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),
},
},
Expand Down

0 comments on commit 35a647a

Please sign in to comment.