Skip to content

Commit

Permalink
remove contour xDS server implementation
Browse files Browse the repository at this point in the history
Closes #2134.

Signed-off-by: Steve Kriss <[email protected]>
  • Loading branch information
skriss committed Jan 8, 2025
1 parent 3cac9fc commit 1ffde8b
Show file tree
Hide file tree
Showing 43 changed files with 17 additions and 1,933 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/build_daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,6 @@ env:
GO_VERSION: 1.23.2

jobs:
e2e-contour-xds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
# * Module download cache
# * Build cache (Linux)
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-go-
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: add deps to path
run: |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: e2e tests
env:
CONTOUR_E2E_IMAGE: ghcr.io/projectcontour/contour:main
CONTOUR_E2E_XDS_SERVER_TYPE: contour
run: |
make setup-kind-cluster run-e2e cleanup-kind
e2e-envoy-deployment:
runs-on: ubuntu-latest
steps:
Expand Down
21 changes: 0 additions & 21 deletions apis/projectcontour/v1alpha1/contourconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,6 @@ type ContourConfigurationSpec struct {
// to toggle new contour features.
type FeatureFlags []string

// XDSServerType is the type of xDS server implementation.
type XDSServerType string

const (
// Use Contour's xDS server (deprecated).
ContourServerType XDSServerType = "contour"
// Use the upstream `go-control-plane`-based xDS server.
EnvoyServerType XDSServerType = "envoy"
)

type CircuitBreakers struct {
// The maximum number of connections that a single Envoy instance allows to the Kubernetes Service; defaults to 1024.
// +optional
Expand All @@ -128,17 +118,6 @@ type CircuitBreakers struct {

// XDSServerConfig holds the config for the Contour xDS server.
type XDSServerConfig struct {
// Defines the XDSServer to use for `contour serve`.
//
// Values: `envoy` (default), `contour (deprecated)`.
//
// Other values will produce an error.
//
// Deprecated: this field will be removed in a future release when
// the `contour` xDS server implementation is removed.
// +optional
Type XDSServerType `json:"type,omitempty"`

// Defines the xDS gRPC API address which Contour will serve.
//
// Contour's default is "0.0.0.0".
Expand Down
12 changes: 0 additions & 12 deletions apis/projectcontour/v1alpha1/contourconfig_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ func (c *ContourConfigurationSpec) Validate() error {
// Validation of nested configuration structs.
var validateFuncs []func() error

if c.XDSServer != nil {
validateFuncs = append(validateFuncs, c.XDSServer.Type.Validate)
}
if c.Envoy != nil {
validateFuncs = append(validateFuncs, c.Envoy.Validate)
}
Expand Down Expand Up @@ -100,15 +97,6 @@ func (t *TracingConfig) Validate() error {
return nil
}

func (x XDSServerType) Validate() error {
switch x {
case ContourServerType, EnvoyServerType:
return nil
default:
return fmt.Errorf("invalid xDS server type %q", x)
}
}

func (d ClusterDNSFamilyType) Validate() error {
switch d {
case AutoClusterDNSFamily, IPv4ClusterDNSFamily, IPv6ClusterDNSFamily, AllClusterDNSFamily:
Expand Down
15 changes: 0 additions & 15 deletions apis/projectcontour/v1alpha1/contourconfig_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ import (
)

func TestContourConfigurationSpecValidate(t *testing.T) {
t.Run("xds server type validation", func(t *testing.T) {
c := contour_v1alpha1.ContourConfigurationSpec{
XDSServer: &contour_v1alpha1.XDSServerConfig{},
}

c.XDSServer.Type = contour_v1alpha1.ContourServerType
require.NoError(t, c.Validate())

c.XDSServer.Type = contour_v1alpha1.EnvoyServerType
require.NoError(t, c.Validate())

c.XDSServer.Type = "foo"
require.Error(t, c.Validate())
})

t.Run("envoy validation", func(t *testing.T) {
c := contour_v1alpha1.ContourConfigurationSpec{
Envoy: &contour_v1alpha1.EnvoyConfig{
Expand Down
27 changes: 5 additions & 22 deletions cmd/contour/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,15 +507,10 @@ func (s *Server) doServe() error {

// snapshotHandler triggers go-control-plane Snapshots based on
// the contents of the Contour xDS caches after the DAG is built.
var snapshotHandler *xdscache_v3.SnapshotHandler
snapshotHandler := xdscache_v3.NewSnapshotHandler(resources, s.log.WithField("context", "snapshotHandler"))

// nolint:staticcheck
if contourConfiguration.XDSServer.Type == contour_v1alpha1.EnvoyServerType {
snapshotHandler = xdscache_v3.NewSnapshotHandler(resources, s.log.WithField("context", "snapshotHandler"))

// register observer for endpoints updates.
endpointHandler.SetObserver(contour.ComposeObservers(snapshotHandler))
}
// register observer for endpoints updates.
endpointHandler.SetObserver(contour.ComposeObservers(snapshotHandler))

// Log that we're using the fallback certificate if configured.
if contourConfiguration.HTTPProxy.FallbackCertificate != nil {
Expand Down Expand Up @@ -923,18 +918,7 @@ func (x *xdsServer) Start(ctx context.Context) error {
log.Info("the initial dag is built")

grpcServer := xds.NewServer(x.registry, grpcOptions(log, x.config.TLS)...)

// nolint:staticcheck
switch x.config.Type {
case contour_v1alpha1.EnvoyServerType:
contour_xds_v3.RegisterServer(envoy_server_v3.NewServer(ctx, x.snapshotHandler.GetCache(), contour_xds_v3.NewRequestLoggingCallbacks(log)), grpcServer)
case contour_v1alpha1.ContourServerType:
contour_xds_v3.RegisterServer(contour_xds_v3.NewContourServer(log, xdscache.ResourcesOf(x.resources)...), grpcServer)
default:
// This can't happen due to config validation.
// nolint:staticcheck
log.Fatalf("invalid xDS server type %q", x.config.Type)
}
contour_xds_v3.RegisterServer(envoy_server_v3.NewServer(ctx, x.snapshotHandler.GetCache(), contour_xds_v3.NewRequestLoggingCallbacks(log)), grpcServer)

addr := net.JoinHostPort(x.config.Address, strconv.Itoa(x.config.Port))
l, err := net.Listen("tcp", addr)
Expand All @@ -947,8 +931,7 @@ func (x *xdsServer) Start(ctx context.Context) error {
log = log.WithField("insecure", true)
}

// nolint:staticcheck
log.Infof("started xDS server type: %q", x.config.Type)
log.Info("started xDS server")
defer log.Info("stopped xDS server")

go func() {
Expand Down
6 changes: 0 additions & 6 deletions cmd/contour/servecontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,7 @@ func (ctx *serveContext) convertToContourConfigurationSpec() contour_v1alpha1.Co
FeatureFlags: ctx.Config.FeatureFlags,
}

xdsServerType := contour_v1alpha1.ContourServerType
if ctx.Config.Server.XDSServerType == config.EnvoyServerType {
xdsServerType = contour_v1alpha1.EnvoyServerType
}

contourConfiguration.XDSServer = &contour_v1alpha1.XDSServerConfig{
Type: xdsServerType,
Address: ctx.xdsAddr,
Port: ctx.xdsPort,
TLS: &contour_v1alpha1.TLS{
Expand Down
1 change: 0 additions & 1 deletion cmd/contour/servecontext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ func TestConvertServeContext(t *testing.T) {
defaultContourConfiguration := func() contour_v1alpha1.ContourConfigurationSpec {
return contour_v1alpha1.ContourConfigurationSpec{
XDSServer: &contour_v1alpha1.XDSServerConfig{
Type: contour_v1alpha1.EnvoyServerType,
Address: "127.0.0.1",
Port: 8001,
TLS: &contour_v1alpha1.TLS{
Expand Down
5 changes: 0 additions & 5 deletions examples/contour/01-contour-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ metadata:
namespace: projectcontour
data:
contour.yaml: |
#
# server:
# determine which XDS Server implementation to utilize in Contour.
# xds-server-type: envoy
#
# Specify the Gateway API configuration.
# gateway:
# namespace: projectcontour
Expand Down
16 changes: 0 additions & 16 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1153,14 +1153,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
status:
Expand Down Expand Up @@ -4979,14 +4971,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
type: object
Expand Down
21 changes: 0 additions & 21 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ metadata:
namespace: projectcontour
data:
contour.yaml: |
#
# server:
# determine which XDS Server implementation to utilize in Contour.
# xds-server-type: envoy
#
# Specify the Gateway API configuration.
# gateway:
# namespace: projectcontour
Expand Down Expand Up @@ -1373,14 +1368,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
status:
Expand Down Expand Up @@ -5199,14 +5186,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
type: object
Expand Down
16 changes: 0 additions & 16 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1164,14 +1164,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
status:
Expand Down Expand Up @@ -4990,14 +4982,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
type: object
Expand Down
16 changes: 0 additions & 16 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1189,14 +1189,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
status:
Expand Down Expand Up @@ -5015,14 +5007,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
type: object
Expand Down
21 changes: 0 additions & 21 deletions examples/render/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ metadata:
namespace: projectcontour
data:
contour.yaml: |
#
# server:
# determine which XDS Server implementation to utilize in Contour.
# xds-server-type: envoy
#
# Specify the Gateway API configuration.
# gateway:
# namespace: projectcontour
Expand Down Expand Up @@ -1373,14 +1368,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
status:
Expand Down Expand Up @@ -5199,14 +5186,6 @@ spec:
description: Client key filename.
type: string
type: object
type:
description: |-
Defines the XDSServer to use for `contour serve`.
Values: `envoy` (default), `contour (deprecated)`.
Other values will produce an error.
Deprecated: this field will be removed in a future release when
the `contour` xDS server implementation is removed.
type: string
type: object
type: object
type: object
Expand Down
Loading

0 comments on commit 1ffde8b

Please sign in to comment.