Skip to content

Commit

Permalink
Register Ingress Gateway with Endpoints Controller
Browse files Browse the repository at this point in the history
- Use consul-dataplane instead of envoy.
  • Loading branch information
thisisnotashwin committed Sep 27, 2022
1 parent 2ea0255 commit 21ac5b9
Show file tree
Hide file tree
Showing 15 changed files with 941 additions and 1,334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ func TestIngressGatewaySingleNamespace(t *testing.T) {
secure bool
}{
{
false,
secure: false,
},
{
true,
secure: true,
},
}
for _, c := range cases {
Expand All @@ -44,13 +44,19 @@ func TestIngressGatewaySingleNamespace(t *testing.T) {

// Install the Helm chart without the ingress gateway first
// so that we can create the namespace for it.
igName := "ingress-gateway"
helmValues := map[string]string{
"connectInject.enabled": "true",
"connectInject.consulNamespaces.consulDestinationNamespace": testNamespace,

"global.enableConsulNamespaces": "true",
"global.acls.manageSystemACLs": strconv.FormatBool(c.secure),
"global.tls.enabled": strconv.FormatBool(c.secure),

"ingressGateways.enabled": "true",
"ingressGateways.gateways[0].name": igName,
"ingressGateways.gateways[0].replicas": "1",
"ingressGateways.gateways[0].consulNamespace": testNamespace,
}

releaseName := helpers.RandomName()
Expand All @@ -70,15 +76,6 @@ func TestIngressGatewaySingleNamespace(t *testing.T) {
require.NoError(t, err)
}

igName := "ingress-gateway"
logger.Log(t, "upgrading with ingress gateways enabled")
consulCluster.Upgrade(t, map[string]string{
"ingressGateways.enabled": "true",
"ingressGateways.gateways[0].name": igName,
"ingressGateways.gateways[0].replicas": "1",
"ingressGateways.gateways[0].consulNamespace": testNamespace,
})

logger.Logf(t, "creating Kubernetes namespace %s", testNamespace)
k8s.RunKubectl(t, ctx.KubectlOptions(t), "create", "ns", testNamespace)
helpers.Cleanup(t, cfg.NoCleanupOnFailure, func() {
Expand Down Expand Up @@ -158,9 +155,6 @@ func TestIngressGatewaySingleNamespace(t *testing.T) {

// Test we can connect through the ingress gateway when both
// the ingress gateway and the connect service are in different namespaces.
// These tests currently only test non-secure and secure without auto-encrypt installations
// because in the case of namespaces there isn't a significant distinction in code between auto-encrypt
// and non-auto-encrypt secure installations, so testing just one is enough.
func TestIngressGatewayNamespaceMirroring(t *testing.T) {
cfg := suite.Config()
if !cfg.EnableEnterprise {
Expand Down
12 changes: 2 additions & 10 deletions acceptance/tests/ingress-gateway/ingress_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,17 @@ const StaticClientName = "static-client"
// Test that ingress gateways work in a default installation and a secure installation.
func TestIngressGateway(t *testing.T) {
cases := []struct {
secure bool
autoEncrypt bool
secure bool
}{
{
false,
false,
},
{
true,
false,
},
{
true,
true,
},
}
for _, c := range cases {
name := fmt.Sprintf("secure: %t; auto-encrypt: %t", c.secure, c.autoEncrypt)
name := fmt.Sprintf("secure: %t", c.secure)
t.Run(name, func(t *testing.T) {
ctx := suite.Environment().DefaultContext(t)
cfg := suite.Config()
Expand All @@ -48,7 +41,6 @@ func TestIngressGateway(t *testing.T) {

"global.acls.manageSystemACLs": strconv.FormatBool(c.secure),
"global.tls.enabled": strconv.FormatBool(c.secure),
"global.tls.autoEncrypt": strconv.FormatBool(c.autoEncrypt),
}

releaseName := helpers.RandomName()
Expand Down
7 changes: 2 additions & 5 deletions acceptance/tests/ingress-gateway/main_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ingressgateway

import (
"fmt"
"os"
"testing"

Expand All @@ -11,8 +10,6 @@ import (
var suite testsuite.Suite

func TestMain(m *testing.M) {
fmt.Println("Skipping ingress gateway tests because it's not supported with agentless yet")
os.Exit(0)
//suite = testsuite.NewSuite(m)
//os.Exit(suite.Run())
suite = testsuite.NewSuite(m)
os.Exit(suite.Run())
}
3 changes: 3 additions & 0 deletions charts/consul/templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ spec:
- "-ec"
- |
consul-k8s-control-plane inject-connect \
{{- if .Values.global.federation.enabled }}
-enable-federation \
{{- end }}
-log-level={{ default .Values.global.logLevel .Values.connectInject.logLevel }} \
-log-json={{ .Values.global.logJSON }} \
-default-inject={{ .Values.connectInject.default }} \
Expand Down
Loading

0 comments on commit 21ac5b9

Please sign in to comment.