Skip to content

Commit

Permalink
remove contour xDS server implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kriss <stephen.kriss@gmail.com>
  • Loading branch information
skriss committed Jul 17, 2024
1 parent 7d60e96 commit 89491e0
Show file tree
Hide file tree
Showing 43 changed files with 17 additions and 1,913 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/build_daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,6 @@ env:
GO_VERSION: 1.22.5

jobs:
e2e-contour-xds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
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@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#contour-ci-notifications'
if: ${{ failure() && github.ref == 'refs/heads/main' }}
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 GlobalCircuitBreakerDefaults struct {
// The maximum number of connections that a single Envoy instance allows to the Kubernetes Service; defaults to 1024.
// +optional
Expand All @@ -124,17 +114,6 @@ type GlobalCircuitBreakerDefaults 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 @@ -597,13 +597,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 @@ -379,7 +379,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 @@ -1138,14 +1138,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 @@ -4916,14 +4908,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 @@ -1358,14 +1353,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 @@ -5136,14 +5123,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 @@ -1149,14 +1149,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 @@ -4927,14 +4919,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 @@ -1174,14 +1174,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 @@ -4952,14 +4944,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 @@ -1358,14 +1353,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 @@ -5136,14 +5123,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 89491e0

Please sign in to comment.