From 566614ec43cf65133c64b8ccb7702529db9926a5 Mon Sep 17 00:00:00 2001 From: Theodore Messinezis Date: Tue, 21 Feb 2023 11:07:12 +0000 Subject: [PATCH 1/5] Add Kourier LoadBalancerIP Config --- .../operator.knative.dev_knativeservings.yaml | 2 + .../operator/base/ingressconfiguration.go | 3 + .../knativeserving/ingress/ingress_test.go | 4 +- .../knativeserving/ingress/kourier.go | 23 +++++ .../knativeserving/ingress/kourier_test.go | 87 ++++++++++++------- 5 files changed, 88 insertions(+), 31 deletions(-) diff --git a/config/crd/bases/operator.knative.dev_knativeservings.yaml b/config/crd/bases/operator.knative.dev_knativeservings.yaml index 484a6032e1..5384454332 100644 --- a/config/crd/bases/operator.knative.dev_knativeservings.yaml +++ b/config/crd/bases/operator.knative.dev_knativeservings.yaml @@ -2311,6 +2311,8 @@ spec: type: boolean service-type: type: string + service-loadBalancerIP: + type: string bootstrap-configmap: type: string type: object diff --git a/pkg/apis/operator/base/ingressconfiguration.go b/pkg/apis/operator/base/ingressconfiguration.go index c349b4e44b..29c25f3668 100644 --- a/pkg/apis/operator/base/ingressconfiguration.go +++ b/pkg/apis/operator/base/ingressconfiguration.go @@ -41,6 +41,9 @@ type KourierIngressConfiguration struct { // ServiceType specifies the service type for kourier gateway. ServiceType v1.ServiceType `json:"service-type,omitempty"` + // ServiceLoadBalancerIP specifies the service load balancer IP. + ServiceLoadBalancerIP string `json:"service-loadBalancerIP,omitempty"` + // BootstrapConfigmapName specifies the ConfigMap name which contains envoy bootstrap. BootstrapConfigmapName string `json:"bootstrap-configmap,omitempty"` } diff --git a/pkg/reconciler/knativeserving/ingress/ingress_test.go b/pkg/reconciler/knativeserving/ingress/ingress_test.go index fe3747c858..800601d5eb 100644 --- a/pkg/reconciler/knativeserving/ingress/ingress_test.go +++ b/pkg/reconciler/knativeserving/ingress/ingress_test.go @@ -58,7 +58,7 @@ func TestTransformers(t *testing.T) { }, }, }, - expected: 3, + expected: 4, }, { name: "Available contour ingress", instance: servingv1beta1.KnativeServing{ @@ -94,7 +94,7 @@ func TestTransformers(t *testing.T) { }, }, }, - expected: 4, + expected: 5, }} for _, tt := range tests { diff --git a/pkg/reconciler/knativeserving/ingress/kourier.go b/pkg/reconciler/knativeserving/ingress/kourier.go index ca0ece70bb..6988e88316 100644 --- a/pkg/reconciler/knativeserving/ingress/kourier.go +++ b/pkg/reconciler/knativeserving/ingress/kourier.go @@ -42,6 +42,7 @@ func kourierTransformers(ctx context.Context, instance *v1beta1.KnativeServing) return []mf.Transformer{ replaceGWNamespace(), configureGWServiceType(instance), + configureGWServiceLoadBalancerIP(instance), configureBootstrapConfigMap(instance), } } @@ -105,6 +106,28 @@ func configureGWServiceType(instance *v1beta1.KnativeServing) mf.Transformer { } } +// configureGWServiceLoadBalancerIP configures Kourier GW's service loadBalancerIP. +func configureGWServiceLoadBalancerIP(instance *v1beta1.KnativeServing) mf.Transformer { + return func(u *unstructured.Unstructured) error { + if u.GetKind() == "Service" && u.GetName() == kourierGatewayServiceName { + if instance.Spec.Ingress.Kourier.ServiceLoadBalancerIP == "" { + // Do nothing if ServiceLoadBalancerIP is not configured. + return nil + } + svc := &v1.Service{} + if err := scheme.Scheme.Convert(u, svc, nil); err != nil { + return err + } + + svc.Spec.LoadBalancerIP = instance.Spec.Ingress.Kourier.ServiceLoadBalancerIP + if err := scheme.Scheme.Convert(svc, u, nil); err != nil { + return err + } + } + return nil + } +} + // configureBootstrapConfigMap sets Kourier GW's bootstrap configmap name. func configureBootstrapConfigMap(instance *v1beta1.KnativeServing) mf.Transformer { return func(u *unstructured.Unstructured) error { diff --git a/pkg/reconciler/knativeserving/ingress/kourier_test.go b/pkg/reconciler/knativeserving/ingress/kourier_test.go index ef22eee661..3599c2746e 100644 --- a/pkg/reconciler/knativeserving/ingress/kourier_test.go +++ b/pkg/reconciler/knativeserving/ingress/kourier_test.go @@ -34,7 +34,7 @@ import ( const servingNamespace = "knative-serving" -func servingInstance(ns string, serviceType v1.ServiceType, bootstrapConfigmapName string) *servingv1beta1.KnativeServing { +func servingInstance(ns string, serviceType v1.ServiceType, bootstrapConfigmapName string, serviceLoadBalancerIP string) *servingv1beta1.KnativeServing { return &servingv1beta1.KnativeServing{ ObjectMeta: metav1.ObjectMeta{ Name: "test-instance", @@ -45,6 +45,7 @@ func servingInstance(ns string, serviceType v1.ServiceType, bootstrapConfigmapNa Kourier: base.KourierIngressConfiguration{ Enabled: true, ServiceType: serviceType, + ServiceLoadBalancerIP: serviceLoadBalancerIP, BootstrapConfigmapName: bootstrapConfigmapName, }, }, @@ -54,38 +55,50 @@ func servingInstance(ns string, serviceType v1.ServiceType, bootstrapConfigmapNa func TestTransformKourierManifest(t *testing.T) { tests := []struct { - name string - instance *servingv1beta1.KnativeServing - expNamespace string - expServiceType string - expConfigMapName string - expError error + name string + instance *servingv1beta1.KnativeServing + expNamespace string + expServiceType string + expServiceLoadBalancerIP string + expConfigMapName string + expError error }{{ - name: "Replaces Kourier Gateway Namespace, ServiceType and bootstrap cm", - instance: servingInstance(servingNamespace, "ClusterIP", "my-bootstrap"), - expNamespace: servingNamespace, - expConfigMapName: "my-bootstrap", - expServiceType: "ClusterIP", + name: "Replaces Kourier Gateway Namespace, ServiceType and bootstrap cm", + instance: servingInstance(servingNamespace, "ClusterIP", "my-bootstrap", ""), + expNamespace: servingNamespace, + expConfigMapName: "my-bootstrap", + expServiceType: "ClusterIP", + expServiceLoadBalancerIP: "", }, { - name: "Use Kourier default service type", - instance: servingInstance(servingNamespace, "" /* empty service type */, ""), - expNamespace: servingNamespace, - expConfigMapName: kourierDefaultVolumeName, - expServiceType: "LoadBalancer", // kourier GW default service type + name: "Use Kourier default service type", + instance: servingInstance(servingNamespace, "" /* empty service type */, "", ""), + expNamespace: servingNamespace, + expConfigMapName: kourierDefaultVolumeName, + expServiceType: "LoadBalancer", // kourier GW default service type + expServiceLoadBalancerIP: "", }, { - name: "Use unsupported service type", - instance: servingInstance(servingNamespace, "ExternalName", ""), - expNamespace: servingNamespace, - expServiceType: "ExternalName", - expConfigMapName: kourierDefaultVolumeName, - expError: fmt.Errorf("unsupported service type \"ExternalName\""), + name: "Sets Kourier Gateway ServiceLoadBalancerIP", + instance: servingInstance(servingNamespace, "" /* empty service type */, "", "1.2.3.4"), + expNamespace: servingNamespace, + expConfigMapName: kourierDefaultVolumeName, + expServiceType: "LoadBalancer", + expServiceLoadBalancerIP: "1.2.3.4", }, { - name: "Use unknown service type", - instance: servingInstance(servingNamespace, "Foo", ""), - expNamespace: servingNamespace, - expServiceType: "Foo", - expConfigMapName: kourierDefaultVolumeName, - expError: fmt.Errorf("unknown service type \"Foo\""), + name: "Use unsupported service type", + instance: servingInstance(servingNamespace, "ExternalName", "", ""), + expNamespace: servingNamespace, + expServiceType: "ExternalName", + expConfigMapName: kourierDefaultVolumeName, + expError: fmt.Errorf("unsupported service type \"ExternalName\""), + expServiceLoadBalancerIP: "", + }, { + name: "Use unknown service type", + instance: servingInstance(servingNamespace, "Foo", "", ""), + expNamespace: servingNamespace, + expServiceType: "Foo", + expConfigMapName: kourierDefaultVolumeName, + expError: fmt.Errorf("unknown service type \"Foo\""), + expServiceLoadBalancerIP: "", }} for _, tt := range tests { @@ -113,9 +126,15 @@ func TestTransformKourierManifest(t *testing.T) { t.Fatalf("Failed to transform manifest: %v", err) } + manifest, err = manifest.Transform(configureGWServiceLoadBalancerIP(tt.instance)) + if err != nil { + t.Fatalf("Failed to transform manifest: %v", err) + } + for _, u := range manifest.Resources() { verifyControllerNamespace(t, &u, tt.expNamespace) verifyGatewayServiceType(t, &u, tt.expServiceType) + verifyGatewayServiceLoadBalancerIP(t, &u, tt.expServiceLoadBalancerIP) verifyBootstrapVolumeName(t, &u, tt.expConfigMapName) } }) @@ -158,6 +177,16 @@ func verifyGatewayServiceType(t *testing.T, u *unstructured.Unstructured, expSer } } +func verifyGatewayServiceLoadBalancerIP(t *testing.T, u *unstructured.Unstructured, expServiceLoadBalancerIP string) { + if u.GetKind() == "Service" && u.GetName() == kourierGatewayServiceName { + svc := &v1.Service{} + err := scheme.Scheme.Convert(u, svc, nil) + util.AssertEqual(t, err, nil) + svcLoadBalancerIP := svc.Spec.LoadBalancerIP + util.AssertDeepEqual(t, string(svcLoadBalancerIP), expServiceLoadBalancerIP) + } +} + // removeProviderLabels removes labels. This util is used for tests without provider label. func removeLabels() mf.Transformer { return func(u *unstructured.Unstructured) error { From ff1d262af4f0bc0cfe77067bf11d0dd0fdbe2acb Mon Sep 17 00:00:00 2001 From: Theodore Messinezis Date: Fri, 26 May 2023 00:12:00 +0100 Subject: [PATCH 2/5] Refactor configureGWServiceType to configureGatewayService --- .../knativeserving/ingress/ingress_test.go | 4 +- .../knativeserving/ingress/kourier.go | 61 +++++++------------ .../knativeserving/ingress/kourier_test.go | 21 ++++--- 3 files changed, 36 insertions(+), 50 deletions(-) diff --git a/pkg/reconciler/knativeserving/ingress/ingress_test.go b/pkg/reconciler/knativeserving/ingress/ingress_test.go index 800601d5eb..fe3747c858 100644 --- a/pkg/reconciler/knativeserving/ingress/ingress_test.go +++ b/pkg/reconciler/knativeserving/ingress/ingress_test.go @@ -58,7 +58,7 @@ func TestTransformers(t *testing.T) { }, }, }, - expected: 4, + expected: 3, }, { name: "Available contour ingress", instance: servingv1beta1.KnativeServing{ @@ -94,7 +94,7 @@ func TestTransformers(t *testing.T) { }, }, }, - expected: 5, + expected: 4, }} for _, tt := range tests { diff --git a/pkg/reconciler/knativeserving/ingress/kourier.go b/pkg/reconciler/knativeserving/ingress/kourier.go index 6988e88316..e2e200713d 100644 --- a/pkg/reconciler/knativeserving/ingress/kourier.go +++ b/pkg/reconciler/knativeserving/ingress/kourier.go @@ -40,16 +40,15 @@ var kourierControllerDeploymentNames = sets.NewString("3scale-kourier-control", func kourierTransformers(ctx context.Context, instance *v1beta1.KnativeServing) []mf.Transformer { return []mf.Transformer{ - replaceGWNamespace(), - configureGWServiceType(instance), - configureGWServiceLoadBalancerIP(instance), + replaceGatewayNamespace(), + configureGatewayService(instance), configureBootstrapConfigMap(instance), } } -// replaceGWNamespace replace the environment variable KOURIER_GATEWAY_NAMESPACE with the +// replaceGatewayNamespace replace the environment variable KOURIER_GATEWAY_NAMESPACE with the // namespace of the deployment its set on. -func replaceGWNamespace() mf.Transformer { +func replaceGatewayNamespace() mf.Transformer { return func(u *unstructured.Unstructured) error { if u.GetKind() == "Deployment" && kourierControllerDeploymentNames.Has(u.GetName()) { deployment := &appsv1.Deployment{} @@ -75,19 +74,19 @@ func replaceGWNamespace() mf.Transformer { } } -// configureGWServiceType configures Kourier GW's service type such as ClusterIP, LoadBalancer and NodePort. -func configureGWServiceType(instance *v1beta1.KnativeServing) mf.Transformer { +func configureGatewayService(instance *v1beta1.KnativeServing) mf.Transformer { return func(u *unstructured.Unstructured) error { - if u.GetKind() == "Service" && u.GetName() == kourierGatewayServiceName { - if instance.Spec.Ingress.Kourier.ServiceType == "" { - // Do nothing if ServiceType is not configured. - return nil - } - svc := &v1.Service{} - if err := scheme.Scheme.Convert(u, svc, nil); err != nil { - return err - } + if !(u.GetKind() == "Service" && u.GetName() == kourierGatewayServiceName) { + return nil + } + svc := &v1.Service{} + if err := scheme.Scheme.Convert(u, svc, nil); err != nil { + return err + } + + // First configure the Service Type. + if instance.Spec.Ingress.Kourier.ServiceType != "" { serviceType := instance.Spec.Ingress.Kourier.ServiceType switch serviceType { case v1.ServiceTypeClusterIP, v1.ServiceTypeNodePort, v1.ServiceTypeLoadBalancer: @@ -97,34 +96,18 @@ func configureGWServiceType(instance *v1beta1.KnativeServing) mf.Transformer { default: return fmt.Errorf("unknown service type %q", serviceType) } - - if err := scheme.Scheme.Convert(svc, u, nil); err != nil { - return err - } } - return nil - } -} -// configureGWServiceLoadBalancerIP configures Kourier GW's service loadBalancerIP. -func configureGWServiceLoadBalancerIP(instance *v1beta1.KnativeServing) mf.Transformer { - return func(u *unstructured.Unstructured) error { - if u.GetKind() == "Service" && u.GetName() == kourierGatewayServiceName { - if instance.Spec.Ingress.Kourier.ServiceLoadBalancerIP == "" { - // Do nothing if ServiceLoadBalancerIP is not configured. - return nil - } - svc := &v1.Service{} - if err := scheme.Scheme.Convert(u, svc, nil); err != nil { - return err + // Then configure LoadBalancerIP if set. + if instance.Spec.Ingress.Kourier.ServiceLoadBalancerIP != "" { + if svc.Spec.Type != v1.ServiceTypeLoadBalancer { + return fmt.Errorf("cannot configure LoadBalancerIP for service type %q", svc.Spec.Type) } - svc.Spec.LoadBalancerIP = instance.Spec.Ingress.Kourier.ServiceLoadBalancerIP - if err := scheme.Scheme.Convert(svc, u, nil); err != nil { - return err - } } - return nil + + // Return any conversion error or nil + return scheme.Scheme.Convert(svc, u, nil) } } diff --git a/pkg/reconciler/knativeserving/ingress/kourier_test.go b/pkg/reconciler/knativeserving/ingress/kourier_test.go index 3599c2746e..7252e1f37c 100644 --- a/pkg/reconciler/knativeserving/ingress/kourier_test.go +++ b/pkg/reconciler/knativeserving/ingress/kourier_test.go @@ -83,22 +83,30 @@ func TestTransformKourierManifest(t *testing.T) { expConfigMapName: kourierDefaultVolumeName, expServiceType: "LoadBalancer", expServiceLoadBalancerIP: "1.2.3.4", + }, { + name: "Use ServiceLoadBalancerIP with unsupported service type", + instance: servingInstance(servingNamespace, "ClusterIP", "", "1.2.3.4"), + expNamespace: servingNamespace, + expConfigMapName: kourierDefaultVolumeName, + expServiceType: "ClusterIP", + expServiceLoadBalancerIP: "1.2.3.4", + expError: fmt.Errorf("cannot configure LoadBalancerIP for service type \"ClusterIP\""), }, { name: "Use unsupported service type", instance: servingInstance(servingNamespace, "ExternalName", "", ""), expNamespace: servingNamespace, expServiceType: "ExternalName", expConfigMapName: kourierDefaultVolumeName, - expError: fmt.Errorf("unsupported service type \"ExternalName\""), expServiceLoadBalancerIP: "", + expError: fmt.Errorf("unsupported service type \"ExternalName\""), }, { name: "Use unknown service type", instance: servingInstance(servingNamespace, "Foo", "", ""), expNamespace: servingNamespace, expServiceType: "Foo", expConfigMapName: kourierDefaultVolumeName, - expError: fmt.Errorf("unknown service type \"Foo\""), expServiceLoadBalancerIP: "", + expError: fmt.Errorf("unknown service type \"Foo\""), }} for _, tt := range tests { @@ -109,12 +117,12 @@ func TestTransformKourierManifest(t *testing.T) { t.Fatalf("Failed to read manifest: %v", err) } - manifest, err = manifest.Transform(replaceGWNamespace()) + manifest, err = manifest.Transform(replaceGatewayNamespace()) if err != nil { t.Fatalf("Failed to transform manifest: %v", err) } - manifest, err = manifest.Transform(configureGWServiceType(tt.instance)) + manifest, err = manifest.Transform(configureGatewayService(tt.instance)) if err != nil { util.AssertEqual(t, err.Error(), tt.expError.Error()) } else { @@ -126,11 +134,6 @@ func TestTransformKourierManifest(t *testing.T) { t.Fatalf("Failed to transform manifest: %v", err) } - manifest, err = manifest.Transform(configureGWServiceLoadBalancerIP(tt.instance)) - if err != nil { - t.Fatalf("Failed to transform manifest: %v", err) - } - for _, u := range manifest.Resources() { verifyControllerNamespace(t, &u, tt.expNamespace) verifyGatewayServiceType(t, &u, tt.expServiceType) From 7fe9775f3992d2ddfa4d07d9810440a7ee2bb633 Mon Sep 17 00:00:00 2001 From: Theodore Messinezis Date: Mon, 12 Jun 2023 15:46:05 +0100 Subject: [PATCH 3/5] Rename service-loadBalancerIP to service-load-balancer-ip --- config/crd/bases/operator.knative.dev_knativeservings.yaml | 2 +- pkg/apis/operator/base/ingressconfiguration.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/operator.knative.dev_knativeservings.yaml b/config/crd/bases/operator.knative.dev_knativeservings.yaml index 5384454332..94eece67c8 100644 --- a/config/crd/bases/operator.knative.dev_knativeservings.yaml +++ b/config/crd/bases/operator.knative.dev_knativeservings.yaml @@ -2311,7 +2311,7 @@ spec: type: boolean service-type: type: string - service-loadBalancerIP: + service-load-balancer-ip: type: string bootstrap-configmap: type: string diff --git a/pkg/apis/operator/base/ingressconfiguration.go b/pkg/apis/operator/base/ingressconfiguration.go index 29c25f3668..c8a55aa2a7 100644 --- a/pkg/apis/operator/base/ingressconfiguration.go +++ b/pkg/apis/operator/base/ingressconfiguration.go @@ -42,7 +42,7 @@ type KourierIngressConfiguration struct { ServiceType v1.ServiceType `json:"service-type,omitempty"` // ServiceLoadBalancerIP specifies the service load balancer IP. - ServiceLoadBalancerIP string `json:"service-loadBalancerIP,omitempty"` + ServiceLoadBalancerIP string `json:"service-load-balancer-ip,omitempty"` // BootstrapConfigmapName specifies the ConfigMap name which contains envoy bootstrap. BootstrapConfigmapName string `json:"bootstrap-configmap,omitempty"` From 38b360930e636b83e22ec9e64248db7dd8148f9b Mon Sep 17 00:00:00 2001 From: Theodore Messinezis <7229472+theomessin@users.noreply.github.com> Date: Thu, 24 Aug 2023 23:09:42 +0100 Subject: [PATCH 4/5] Update pkg/reconciler/knativeserving/ingress/kourier_test.go Co-authored-by: Kenjiro Nakayama --- pkg/reconciler/knativeserving/ingress/kourier_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/reconciler/knativeserving/ingress/kourier_test.go b/pkg/reconciler/knativeserving/ingress/kourier_test.go index 7252e1f37c..c1e651de53 100644 --- a/pkg/reconciler/knativeserving/ingress/kourier_test.go +++ b/pkg/reconciler/knativeserving/ingress/kourier_test.go @@ -186,7 +186,7 @@ func verifyGatewayServiceLoadBalancerIP(t *testing.T, u *unstructured.Unstructur err := scheme.Scheme.Convert(u, svc, nil) util.AssertEqual(t, err, nil) svcLoadBalancerIP := svc.Spec.LoadBalancerIP - util.AssertDeepEqual(t, string(svcLoadBalancerIP), expServiceLoadBalancerIP) + util.AssertDeepEqual(t, svcLoadBalancerIP, expServiceLoadBalancerIP) } } From 6b0d948cbf7111749f57bfc385a9701505f09ea4 Mon Sep 17 00:00:00 2001 From: Theodore Messinezis Date: Mon, 11 Sep 2023 14:23:26 +0100 Subject: [PATCH 5/5] Can we please get this merged? --- .../knativeserving/ingress/kourier.go | 15 ++++++---- .../knativeserving/ingress/kourier_test.go | 30 +++++++++---------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/pkg/reconciler/knativeserving/ingress/kourier.go b/pkg/reconciler/knativeserving/ingress/kourier.go index 3ee6c6a050..ad95d9e20b 100644 --- a/pkg/reconciler/knativeserving/ingress/kourier.go +++ b/pkg/reconciler/knativeserving/ingress/kourier.go @@ -93,9 +93,6 @@ func configureGatewayService(instance *v1beta1.KnativeServing) mf.Transformer { svc.Spec.Type = serviceType case v1.ServiceTypeNodePort: svc.Spec.Type = serviceType - if instance.Spec.Ingress.Kourier.HTTPPort > 0 || instance.Spec.Ingress.Kourier.HTTPSPort > 0 { - configureGWServiceTypeNodePort(instance, svc) - } case v1.ServiceTypeExternalName: return fmt.Errorf("unsupported service type %q", serviceType) default: @@ -103,7 +100,7 @@ func configureGatewayService(instance *v1beta1.KnativeServing) mf.Transformer { } } - // Then configure LoadBalancerIP if set. + // Configure LoadBalancerIP if set. if instance.Spec.Ingress.Kourier.ServiceLoadBalancerIP != "" { if svc.Spec.Type != v1.ServiceTypeLoadBalancer { return fmt.Errorf("cannot configure LoadBalancerIP for service type %q", svc.Spec.Type) @@ -111,6 +108,14 @@ func configureGatewayService(instance *v1beta1.KnativeServing) mf.Transformer { svc.Spec.LoadBalancerIP = instance.Spec.Ingress.Kourier.ServiceLoadBalancerIP } + // Configure HTTPPort/HTTPSPort if set. + if instance.Spec.Ingress.Kourier.HTTPPort > 0 || instance.Spec.Ingress.Kourier.HTTPSPort > 0 { + if svc.Spec.Type != v1.ServiceTypeNodePort { + return fmt.Errorf("cannot configure HTTP(S)Port for service type %q", svc.Spec.Type) + } + configureGatewayServiceTypeNodePort(instance, svc) + } + // Return any conversion error or nil return scheme.Scheme.Convert(svc, u, nil) } @@ -150,7 +155,7 @@ func configureBootstrapConfigMap(instance *v1beta1.KnativeServing) mf.Transforme } } -func configureGWServiceTypeNodePort(instance *v1beta1.KnativeServing, svc *v1.Service) { +func configureGatewayServiceTypeNodePort(instance *v1beta1.KnativeServing, svc *v1.Service) { for i, v := range svc.Spec.Ports { if v.Name != "https" && instance.Spec.Ingress.Kourier.HTTPPort > 0 { v.NodePort = instance.Spec.Ingress.Kourier.HTTPPort diff --git a/pkg/reconciler/knativeserving/ingress/kourier_test.go b/pkg/reconciler/knativeserving/ingress/kourier_test.go index 328f692614..5dacfd4066 100644 --- a/pkg/reconciler/knativeserving/ingress/kourier_test.go +++ b/pkg/reconciler/knativeserving/ingress/kourier_test.go @@ -75,21 +75,21 @@ func servingInstanceNodePorts(ns string, bootstrapConfigmapName string, httpPort func TestTransformKourierManifest(t *testing.T) { tests := []struct { - name string - instance *servingv1beta1.KnativeServing - expNamespace string - expServiceType string - expServiceLoadBalancerIP string - expConfigMapName string - expNodePortsHTTP int32 - expNodePortsHTTPS int32 - expError error + name string + instance *servingv1beta1.KnativeServing + expNamespace string + expServiceType string + expServiceLoadBalancerIP string + expConfigMapName string + expNodePortsHTTP int32 + expNodePortsHTTPS int32 + expError error }{{ - name: "Replaces Kourier Gateway Namespace, ServiceType and bootstrap cm", - instance: servingInstance(servingNamespace, "ClusterIP", "my-bootstrap", ""), - expNamespace: servingNamespace, - expConfigMapName: "my-bootstrap", - expServiceType: "ClusterIP", + name: "Replaces Kourier Gateway Namespace, ServiceType and bootstrap cm", + instance: servingInstance(servingNamespace, "ClusterIP", "my-bootstrap", ""), + expNamespace: servingNamespace, + expConfigMapName: "my-bootstrap", + expServiceType: "ClusterIP", }, { name: "Use Kourier default service type", instance: servingInstance(servingNamespace, "" /* empty service type */, "", ""), @@ -114,7 +114,7 @@ func TestTransformKourierManifest(t *testing.T) { expError: fmt.Errorf("cannot configure LoadBalancerIP for service type \"ClusterIP\""), }, { name: "Use unknown service type", - instance: servingInstance(servingNamespace, "Foo", ""), + instance: servingInstance(servingNamespace, "Foo", "", ""), expNamespace: servingNamespace, expServiceType: "Foo", expConfigMapName: kourierDefaultVolumeName,