Skip to content

Commit

Permalink
use namespace kong for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Aug 1, 2023
1 parent e686d34 commit 020b873
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/consts/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ const (
IngressClass = "kongtests"

// ControllerNamespace is the Kubernetes namespace where the controller is deployed.
ControllerNamespace = "kong-system"
ControllerNamespace = "kong"
)
7 changes: 5 additions & 2 deletions test/helpers/certificate/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"fmt"
"math/big"
"time"

"github.com/kong/kubernetes-ingress-controller/v2/test/consts"
)

type SelfSignedCeritificateOptions struct {
Expand Down Expand Up @@ -104,11 +106,12 @@ func MustGenerateSelfSignedCertPEMFormat(decorators ...SelfSignedCeritificateOpt
}

var kongSystemServiceCert, kongSystemServiceKey = MustGenerateSelfSignedCertPEMFormat(
WithCommonName("*.kong-system.svc"), WithDNSNames("*.kong-system.svc"),
WithCommonName(fmt.Sprintf("*.%s.svc", consts.ControllerNamespace)),
WithDNSNames(fmt.Sprintf("*.%s.svc", consts.ControllerNamespace)),
)

// GetKongSystemSelfSignedCerts returns the self-signed certificate and key
// with CN=*.kong-system.svc and subjectAltName=DNS:*.kong-system.svc.
// with CN=*.<controllerNamespace>.svc and subjectAltName=DNS:*.<controllerNamespace>.svc.
func GetKongSystemSelfSignedCerts() (cert []byte, key []byte) {
return kongSystemServiceCert, kongSystemServiceKey
}
10 changes: 9 additions & 1 deletion test/integration/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ package integration

import (
"context"
"fmt"
"net/http"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -64,7 +66,13 @@ func TestUnmanagedGatewayBasics(t *testing.T) {
require.Eventually(t, func() bool {
gw, err = gatewayClient.GatewayV1beta1().Gateways(ns.Name).Get(ctx, defaultGatewayName, metav1.GetOptions{})
require.NoError(t, err)
return gw.Annotations[annotations.GatewayClassUnmanagedAnnotation] == "kong-system/ingress-controller-kong-proxy,kong-system/ingress-controller-kong-udp-proxy"
return gw.Annotations[annotations.GatewayClassUnmanagedAnnotation] == strings.Join(
[]string{
fmt.Sprintf("%s/%s", pubsvc.Namespace, pubsvc.Name),
fmt.Sprintf("%s/%s", pubsvcUDP.Namespace, pubsvcUDP.Name),
},
",",
)
}, gatewayUpdateWaitTime, time.Second)

t.Log("verifying that the gateway address is populated from the publish service")
Expand Down
2 changes: 1 addition & 1 deletion test/internal/helpers/ktf.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// GenerateKongBuilder returns a Kong KTF addon builder, a string slice
// of controller arguments needed to interact with the addon and an error.
func GenerateKongBuilder(_ context.Context) (*kong.Builder, []string, error) {
kongbuilder := kong.NewBuilder()
kongbuilder := kong.NewBuilder().WithNamespace(consts.ControllerNamespace)
extraControllerArgs := []string{}
if testenv.KongEnterpriseEnabled() {
licenseJSON, err := kong.GetLicenseJSONFromEnv()
Expand Down

0 comments on commit 020b873

Please sign in to comment.