Skip to content
Open
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
7 changes: 3 additions & 4 deletions cmd/atenet/internal/router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

Router has several responsibilities:

* (Optional) manages a Deployment of Envoy to function as a router for ATE requests.
* This is optional to enable testing the router component in a standalone mode without managing the Kubernetes objects.
* Envoy will be configured to send traffic to via xDS served by the Router.
* Configures the Envoy sidecar declared in
`manifests/ate-install/atenet-router.yaml` via xDS.
* ext_proc server for the Envoy. To make the deployment and debugging easier, we will run this component together
with the router, but this will be split later into its own component.
* ext_proc will call into the ATE gRPC API to get the set of relevant backends (specific the worker IP) and
Expand All @@ -27,4 +26,4 @@ Contents:
* Global flags values
* Command line args
* Last 100 queries served
* Build tag
* Build tag
2 changes: 0 additions & 2 deletions cmd/atenet/internal/router/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ func NewRouterCmd() *cobra.Command {

cmd.Flags().StringVar(&cfg.LogLevel, "log-level", "info", "Log level: debug, info, warn, error")
cmd.Flags().StringVar(&cfg.MetricsAddr, "metrics-listen-addr", ":9090", "Address and port the prometheus metrics server should listen on.")
cmd.Flags().BoolVar(&cfg.Standalone, "standalone", false, "Run in standalone mode, bypassing creation of managed deployment and services in Kubernetes cluster")
cmd.Flags().StringVar(&cfg.Namespace, "namespace", "default", "Target operations namespace")
cmd.Flags().StringVar(&cfg.Kubeconfig, "kubeconfig", "", "Absolute path to the kubeconfig configuration file")
cmd.Flags().StringVar(&cfg.AteapiAddr, "ateapi-address", "dns:///api.ate-system.svc:443", "gRPC dial target for the cluster ateapi Control instance.")
cmd.Flags().IntVar(&cfg.HttpPort, "port-http", 8080, "TCP port for workload traffic entering through the Envoy Router")
cmd.Flags().IntVar(&cfg.XdsPort, "port-xds", 18000, "TCP port listening for the xDS dynamic Envoy connections")
cmd.Flags().IntVar(&cfg.ExtprocPort, "port-extproc", 50051, "Listen port for the Envoy dynamic External Processing (ext_proc) server")
cmd.Flags().StringVar(&cfg.ExtprocAddr, "extproc-address", "127.0.0.1", "Host IP or address of the Envoy External Processing (ext_proc) server")
cmd.Flags().StringVar(&cfg.EnvoyImage, "envoy-image", "envoyproxy/envoy:v1.30-latest", "Image URI used for dynamically launched router instances")
cmd.Flags().StringVar(&cfg.TemplatesFile, "actor-templates-file", "", "Path to offline YAML configuration file listing ActorTemplates")
cmd.Flags().IntVar(&cfg.StatusPort, "status-port", 4040, "Port to serve /statusz on (set <= 0 to disable serving status)")
cmd.Flags().DurationVar(&cfg.HealthInterval, "health-interval", 1*time.Second, "Interval for checking health of dependent services")
Expand Down
2 changes: 0 additions & 2 deletions cmd/atenet/internal/router/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ type authConfig struct {

// routerConfig holds deployment setup and endpoint options for the router node instance.
type routerConfig struct {
Standalone bool
Namespace string
Kubeconfig string
AteapiAddr string
HttpPort int
XdsPort int
ExtprocPort int
ExtprocAddr string
EnvoyImage string
TemplatesFile string
StatusPort int
HealthInterval time.Duration
Expand Down
45 changes: 5 additions & 40 deletions cmd/atenet/internal/router/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,49 +18,23 @@ import (
"context"
"log/slog"
"time"

"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
)

// Controller monitors ActorTemplates and coordinates configuration updates
// for the Envoy xDS and external processing servers.
type Controller struct {
k8sClient client.Client
clientset kubernetes.Interface
cfg routerConfig
xdsSrv *XdsServer
extprocSrv *ExtProcServer
xdsSrv *XdsServer

atStore atStore
envoyRunner *envoyrunner
atStore atStore
}

func NewController(
k8sClient client.Client,
clientset kubernetes.Interface,
cfg routerConfig,
store atStore,
xdsSrv *XdsServer,
extprocSrv *ExtProcServer,
) *Controller {
xdsSrv.SetConfig(cfg.HttpPort, cfg.ExtprocPort, cfg.ExtprocAddr)

var store atStore
if cfg.TemplatesFile != "" {
store = newFileATStore(cfg.TemplatesFile)
} else {
store = newk8sATStore(k8sClient)
}

return &Controller{
k8sClient: k8sClient,
clientset: clientset,
cfg: cfg,
xdsSrv: xdsSrv,
extprocSrv: extprocSrv,

atStore: store,
envoyRunner: newEnvoyRunner(k8sClient, cfg),
xdsSrv: xdsSrv,
atStore: store,
}
}

Expand Down Expand Up @@ -97,14 +71,5 @@ func (c *Controller) reconcile(ctx context.Context) error {
return err
}

if !c.cfg.Standalone && c.cfg.TemplatesFile == "" {
// Reconcile Envoy router Deployment and Kubernetes cluster entities
err := c.envoyRunner.reconcile(ctx)
if err != nil {
slog.ErrorContext(ctx, "Error during Envoy router reconciliation", slog.String("err", err.Error()))
return err
}
}

return nil
}
258 changes: 0 additions & 258 deletions cmd/atenet/internal/router/envoyrunner.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/atenet/internal/router/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestHealthCheckDoesNotBlockReportOrStatusz(t *testing.T) {
}

statusServer := httptest.NewServer(http.HandlerFunc((&RouterServer{
cfg: routerConfig{Standalone: true},
cfg: routerConfig{},
health: rh,
}).handleStatusz))
defer statusServer.Close()
Expand Down
Loading
Loading