Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/reconciler/v1alpha1/route/resources/names/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ var K8sGatewayFullname = reconciler.GetK8sServiceFullname(
"knative-shared-gateway",
system.Namespace)

var K8sGatewayServiceFullname = reconciler.GetK8sServiceFullname(
"knative-ingressgateway",
"istio-system")

func K8sService(route *v1alpha1.Route) string {
return route.Name
}
Expand Down
6 changes: 2 additions & 4 deletions pkg/reconciler/v1alpha1/route/resources/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ func MakeK8sService(route *v1alpha1.Route) *corev1.Service {
},
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{{
Name: PortName,
Port: PortNumber,
}},
Type: corev1.ServiceTypeExternalName,
ExternalName: names.K8sGatewayServiceFullname,
},
}
}
7 changes: 3 additions & 4 deletions pkg/reconciler/v1alpha1/route/resources/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/knative/serving/pkg/apis/serving/v1alpha1"
"github.com/knative/serving/pkg/reconciler"
"github.com/knative/serving/pkg/reconciler/v1alpha1/route/resources/names"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -37,10 +38,8 @@ func TestMakeK8SService_ValidSpec(t *testing.T) {
},
}
expectedSpec := corev1.ServiceSpec{
Ports: []corev1.ServicePort{{
Name: "http",
Port: 80,
}},
Type: corev1.ServiceTypeExternalName,
ExternalName: names.K8sGatewayServiceFullname,
}
spec := MakeK8sService(r).Spec
if diff := cmp.Diff(expectedSpec, spec); diff != "" {
Expand Down