Skip to content

Commit

Permalink
Initial support for agentless (#1267)
Browse files Browse the repository at this point in the history
Add initial support for the basic service mesh running with agentless.

* Update connect-inject deployment to talk to consul servers (currently only in-cluster servers are supported; external servers support will come in a later PR)
* Update endpoints controller to register and deregister services and health checks in the catalog and stop using agent APIs
* Update connect-init command to take the -node-name flag so that it can search for services within a given node using catalog APIs
* Add k8s probes to the envoy container
* Provide -node-name flag to the consul connect envoy command so that we can generate correct configuration
* Selectively disable acceptance tests that don't yet work in this configuration
* Disable consul clients by default
  • Loading branch information
ishustava authored and Thomas Eckert committed Sep 21, 2022
1 parent be6a786 commit 7d1f348
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
7 changes: 5 additions & 2 deletions acceptance/tests/controller/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package controller

import (
"fmt"
"os"
"testing"

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

func TestMain(m *testing.M) {
suite = testSuite.NewSuite(m)
os.Exit(suite.Run())
fmt.Println("Skipping controller tests because it's not supported with agentless yet")
os.Exit(0)
//suite = testSuite.NewSuite(m)
//os.Exit(suite.Run())
}
13 changes: 13 additions & 0 deletions control-plane/connect-inject/consul_dataplane_sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,19 @@ func TestHandlerConsulDataplaneSidecar_Multiport(t *testing.T) {
require.Nil(t, container.StartupProbe)
}
})

port := EnvoyInboundListenerPort + i
expectedProbe := &corev1.Probe{
Handler: corev1.Handler{
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.FromInt(port),
},
},
InitialDelaySeconds: 1,
}
require.Equal(t, expectedProbe, container.ReadinessProbe)
require.Equal(t, expectedProbe, container.LivenessProbe)
require.Nil(t, container.StartupProbe)
}
}

Expand Down
1 change: 1 addition & 0 deletions control-plane/connect-inject/container_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (w *MeshWebhook) containerInit(namespace corev1.Namespace, pod corev1.Pod,
NamespaceMirroringEnabled: w.EnableK8SNSMirroring,
ConsulCACert: w.ConsulCACert,
ConsulNodeName: ConsulNodeName,
ConsulAddress: w.ConsulAddress,
EnableTransparentProxy: tproxyEnabled,
EnableCNI: w.EnableCNI,
TProxyExcludeInboundPorts: splitCommaSeparatedItemsFromAnnotation(annotationTProxyExcludeInboundPorts, pod),
Expand Down
Empty file.
4 changes: 4 additions & 0 deletions control-plane/subcommand/connect-init/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import (
"github.com/hashicorp/consul/sdk/testutil"
"github.com/mitchellh/cli"
"github.com/stretchr/testify/require"

connectinject "github.com/hashicorp/consul-k8s/control-plane/connect-inject"
"github.com/hashicorp/consul-k8s/control-plane/helper/test"
"github.com/hashicorp/consul-k8s/control-plane/subcommand/common"
)

func TestRun_FlagValidation(t *testing.T) {
Expand Down

0 comments on commit 7d1f348

Please sign in to comment.