Skip to content

Commit

Permalink
Don't override ports for KafkaChannel's service
Browse files Browse the repository at this point in the history
By not having the port defined on the KafkaChannel's external
name service, istio (actually Envoy) can't find a matching route
for requests to the channel's service without any port, see [1]

[1] https://www.envoyproxy.io/docs/envoy/latest/faq/debugging/why_is_my_route_not_found

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
  • Loading branch information
pierDipi committed Apr 17, 2023
1 parent ec3ad88 commit b5df7e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 2 additions & 5 deletions control-plane/pkg/reconciler/channel/resources/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ func MakeChannelServiceName(name string) string {
// pointing to the specified service in a namespace.
func ExternalService(namespace, service string) ServiceOption {
return func(svc *corev1.Service) error {
// TODO this overrides the current serviceSpec. Is this correct?
svc.Spec = corev1.ServiceSpec{
Type: corev1.ServiceTypeExternalName,
ExternalName: network.GetServiceHostname(service, namespace),
}
svc.Spec.Type = corev1.ServiceTypeExternalName
svc.Spec.ExternalName = network.GetServiceHostname(service, namespace)
return nil
}
}
Expand Down
12 changes: 10 additions & 2 deletions control-plane/pkg/reconciler/testing/objects_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
clientgotesting "k8s.io/client-go/testing"
"k8s.io/utils/pointer"
messagingv1beta1 "knative.dev/eventing-kafka-broker/control-plane/pkg/apis/messaging/v1beta1"
"knative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/channel/resources"
eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1"
v1 "knative.dev/eventing/pkg/apis/messaging/v1"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/network"

messagingv1beta1 "knative.dev/eventing-kafka-broker/control-plane/pkg/apis/messaging/v1beta1"
"knative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/channel/resources"

"knative.dev/eventing-kafka-broker/control-plane/pkg/config"
"knative.dev/eventing-kafka-broker/control-plane/pkg/contract"
"knative.dev/eventing-kafka-broker/control-plane/pkg/kafka"
Expand Down Expand Up @@ -352,6 +353,13 @@ func NewPerChannelService(env *config.Env) *corev1.Service {
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeExternalName,
ExternalName: network.GetServiceHostname(env.IngressName, env.SystemNamespace),
Ports: []corev1.ServicePort{
{
Name: "http",
Protocol: corev1.ProtocolTCP,
Port: 80,
},
},
},
}

Expand Down

0 comments on commit b5df7e9

Please sign in to comment.