Skip to content

Commit 535a0e7

Browse files
authored
remove contour xDS server implementation (#6568)
Closes #2134. Signed-off-by: Steve Kriss <stephen.kriss@gmail.com>
1 parent 8c988b5 commit 535a0e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+24
-1951
lines changed

.github/workflows/build_daily.yaml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,6 @@ env:
1515
GO_VERSION: 1.23.4
1616

1717
jobs:
18-
e2e-contour-xds:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22-
with:
23-
persist-credentials: false
24-
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
25-
with:
26-
# * Module download cache
27-
# * Build cache (Linux)
28-
path: |
29-
~/go/pkg/mod
30-
~/.cache/go-build
31-
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }}
32-
restore-keys: |
33-
${{ runner.os }}-${{ github.job }}-go-
34-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
35-
with:
36-
go-version: ${{ env.GO_VERSION }}
37-
cache: false
38-
- name: add deps to path
39-
run: |
40-
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin
41-
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
42-
- name: e2e tests
43-
env:
44-
CONTOUR_E2E_IMAGE: ghcr.io/projectcontour/contour:main
45-
CONTOUR_E2E_XDS_SERVER_TYPE: contour
46-
run: |
47-
make setup-kind-cluster run-e2e cleanup-kind
4818
e2e-envoy-deployment:
4919
runs-on: ubuntu-latest
5020
steps:

apis/projectcontour/v1alpha1/contourconfig.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,6 @@ type ContourConfigurationSpec struct {
9797
// to toggle new contour features.
9898
type FeatureFlags []string
9999

100-
// XDSServerType is the type of xDS server implementation.
101-
type XDSServerType string
102-
103-
const (
104-
// Use Contour's xDS server (deprecated).
105-
ContourServerType XDSServerType = "contour"
106-
// Use the upstream `go-control-plane`-based xDS server.
107-
EnvoyServerType XDSServerType = "envoy"
108-
)
109-
110100
type CircuitBreakers struct {
111101
// The maximum number of connections that a single Envoy instance allows to the Kubernetes Service; defaults to 1024.
112102
// +optional
@@ -128,17 +118,6 @@ type CircuitBreakers struct {
128118

129119
// XDSServerConfig holds the config for the Contour xDS server.
130120
type XDSServerConfig struct {
131-
// Defines the XDSServer to use for `contour serve`.
132-
//
133-
// Values: `envoy` (default), `contour (deprecated)`.
134-
//
135-
// Other values will produce an error.
136-
//
137-
// Deprecated: this field will be removed in a future release when
138-
// the `contour` xDS server implementation is removed.
139-
// +optional
140-
Type XDSServerType `json:"type,omitempty"`
141-
142121
// Defines the xDS gRPC API address which Contour will serve.
143122
//
144123
// Contour's default is "0.0.0.0".

apis/projectcontour/v1alpha1/contourconfig_helpers.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ func (c *ContourConfigurationSpec) Validate() error {
3737
// Validation of nested configuration structs.
3838
var validateFuncs []func() error
3939

40-
if c.XDSServer != nil {
41-
validateFuncs = append(validateFuncs, c.XDSServer.Type.Validate)
42-
}
4340
if c.Envoy != nil {
4441
validateFuncs = append(validateFuncs, c.Envoy.Validate)
4542
}
@@ -100,15 +97,6 @@ func (t *TracingConfig) Validate() error {
10097
return nil
10198
}
10299

103-
func (x XDSServerType) Validate() error {
104-
switch x {
105-
case ContourServerType, EnvoyServerType:
106-
return nil
107-
default:
108-
return fmt.Errorf("invalid xDS server type %q", x)
109-
}
110-
}
111-
112100
func (d ClusterDNSFamilyType) Validate() error {
113101
switch d {
114102
case AutoClusterDNSFamily, IPv4ClusterDNSFamily, IPv6ClusterDNSFamily, AllClusterDNSFamily:

apis/projectcontour/v1alpha1/contourconfig_helpers_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ import (
2525
)
2626

2727
func TestContourConfigurationSpecValidate(t *testing.T) {
28-
t.Run("xds server type validation", func(t *testing.T) {
29-
c := contour_v1alpha1.ContourConfigurationSpec{
30-
XDSServer: &contour_v1alpha1.XDSServerConfig{},
31-
}
32-
33-
c.XDSServer.Type = contour_v1alpha1.ContourServerType
34-
require.NoError(t, c.Validate())
35-
36-
c.XDSServer.Type = contour_v1alpha1.EnvoyServerType
37-
require.NoError(t, c.Validate())
38-
39-
c.XDSServer.Type = "foo"
40-
require.Error(t, c.Validate())
41-
})
42-
4328
t.Run("envoy validation", func(t *testing.T) {
4429
c := contour_v1alpha1.ContourConfigurationSpec{
4530
Envoy: &contour_v1alpha1.EnvoyConfig{
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## xDS server type fields in config file and ContourConfiguration CRD and legacy `contour` xDS server are removed
2+
3+
Contour now uses a go-control-plane-based xDS server.
4+
The legacy `contour` xDS server that pre-dates `go-control-plane` has been removed.
5+
Since there is now only one supported xDS server, the config fields for selecting an xDS server implementation have been removed.

cmd/contour/serve.go

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,10 @@ func (s *Server) doServe() error {
511511

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

516-
// nolint:staticcheck
517-
if contourConfiguration.XDSServer.Type == contour_v1alpha1.EnvoyServerType {
518-
snapshotHandler = xdscache_v3.NewSnapshotHandler(resources, s.log.WithField("context", "snapshotHandler"))
519-
520-
// register observer for endpoints updates.
521-
endpointHandler.SetObserver(contour.ComposeObservers(snapshotHandler))
522-
}
516+
// register observer for endpoints updates.
517+
endpointHandler.SetObserver(contour.ComposeObservers(snapshotHandler))
523518

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

929924
grpcServer := xds.NewServer(x.registry, grpcOptions(log, x.config.TLS)...)
930-
931-
// nolint:staticcheck
932-
switch x.config.Type {
933-
case contour_v1alpha1.EnvoyServerType:
934-
contour_xds_v3.RegisterServer(envoy_server_v3.NewServer(ctx, x.snapshotHandler.GetCache(), contour_xds_v3.NewRequestLoggingCallbacks(log)), grpcServer)
935-
case contour_v1alpha1.ContourServerType:
936-
contour_xds_v3.RegisterServer(contour_xds_v3.NewContourServer(log, xdscache.ResourcesOf(x.resources)...), grpcServer)
937-
default:
938-
// This can't happen due to config validation.
939-
// nolint:staticcheck
940-
log.Fatalf("invalid xDS server type %q", x.config.Type)
941-
}
925+
contour_xds_v3.RegisterServer(envoy_server_v3.NewServer(ctx, x.snapshotHandler.GetCache(), contour_xds_v3.NewRequestLoggingCallbacks(log)), grpcServer)
942926

943927
addr := net.JoinHostPort(x.config.Address, strconv.Itoa(x.config.Port))
944928
l, err := net.Listen("tcp", addr)
@@ -951,8 +935,7 @@ func (x *xdsServer) Start(ctx context.Context) error {
951935
log = log.WithField("insecure", true)
952936
}
953937

954-
// nolint:staticcheck
955-
log.Infof("started xDS server type: %q", x.config.Type)
938+
log.Info("started xDS server")
956939
defer log.Info("stopped xDS server")
957940

958941
go func() {

cmd/contour/servecontext.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -599,13 +599,7 @@ func (ctx *serveContext) convertToContourConfigurationSpec() contour_v1alpha1.Co
599599
FeatureFlags: ctx.Config.FeatureFlags,
600600
}
601601

602-
xdsServerType := contour_v1alpha1.ContourServerType
603-
if ctx.Config.Server.XDSServerType == config.EnvoyServerType {
604-
xdsServerType = contour_v1alpha1.EnvoyServerType
605-
}
606-
607602
contourConfiguration.XDSServer = &contour_v1alpha1.XDSServerConfig{
608-
Type: xdsServerType,
609603
Address: ctx.xdsAddr,
610604
Port: ctx.xdsPort,
611605
TLS: &contour_v1alpha1.TLS{

cmd/contour/servecontext_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ func TestConvertServeContext(t *testing.T) {
380380
defaultContourConfiguration := func() contour_v1alpha1.ContourConfigurationSpec {
381381
return contour_v1alpha1.ContourConfigurationSpec{
382382
XDSServer: &contour_v1alpha1.XDSServerConfig{
383-
Type: contour_v1alpha1.EnvoyServerType,
384383
Address: "127.0.0.1",
385384
Port: 8001,
386385
TLS: &contour_v1alpha1.TLS{

examples/contour/01-contour-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ metadata:
66
namespace: projectcontour
77
data:
88
contour.yaml: |
9-
#
10-
# server:
11-
# determine which XDS Server implementation to utilize in Contour.
12-
# xds-server-type: envoy
13-
#
149
# Specify the Gateway API configuration.
1510
# gateway:
1611
# namespace: projectcontour

examples/contour/01-crds.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,14 +1153,6 @@ spec:
11531153
description: Client key filename.
11541154
type: string
11551155
type: object
1156-
type:
1157-
description: |-
1158-
Defines the XDSServer to use for `contour serve`.
1159-
Values: `envoy` (default), `contour (deprecated)`.
1160-
Other values will produce an error.
1161-
Deprecated: this field will be removed in a future release when
1162-
the `contour` xDS server implementation is removed.
1163-
type: string
11641156
type: object
11651157
type: object
11661158
status:
@@ -4979,14 +4971,6 @@ spec:
49794971
description: Client key filename.
49804972
type: string
49814973
type: object
4982-
type:
4983-
description: |-
4984-
Defines the XDSServer to use for `contour serve`.
4985-
Values: `envoy` (default), `contour (deprecated)`.
4986-
Other values will produce an error.
4987-
Deprecated: this field will be removed in a future release when
4988-
the `contour` xDS server implementation is removed.
4989-
type: string
49904974
type: object
49914975
type: object
49924976
type: object

examples/render/contour-deployment.yaml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ metadata:
3939
namespace: projectcontour
4040
data:
4141
contour.yaml: |
42-
#
43-
# server:
44-
# determine which XDS Server implementation to utilize in Contour.
45-
# xds-server-type: envoy
46-
#
4742
# Specify the Gateway API configuration.
4843
# gateway:
4944
# namespace: projectcontour
@@ -1373,14 +1368,6 @@ spec:
13731368
description: Client key filename.
13741369
type: string
13751370
type: object
1376-
type:
1377-
description: |-
1378-
Defines the XDSServer to use for `contour serve`.
1379-
Values: `envoy` (default), `contour (deprecated)`.
1380-
Other values will produce an error.
1381-
Deprecated: this field will be removed in a future release when
1382-
the `contour` xDS server implementation is removed.
1383-
type: string
13841371
type: object
13851372
type: object
13861373
status:
@@ -5199,14 +5186,6 @@ spec:
51995186
description: Client key filename.
52005187
type: string
52015188
type: object
5202-
type:
5203-
description: |-
5204-
Defines the XDSServer to use for `contour serve`.
5205-
Values: `envoy` (default), `contour (deprecated)`.
5206-
Other values will produce an error.
5207-
Deprecated: this field will be removed in a future release when
5208-
the `contour` xDS server implementation is removed.
5209-
type: string
52105189
type: object
52115190
type: object
52125191
type: object

examples/render/contour-gateway-provisioner.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,14 +1164,6 @@ spec:
11641164
description: Client key filename.
11651165
type: string
11661166
type: object
1167-
type:
1168-
description: |-
1169-
Defines the XDSServer to use for `contour serve`.
1170-
Values: `envoy` (default), `contour (deprecated)`.
1171-
Other values will produce an error.
1172-
Deprecated: this field will be removed in a future release when
1173-
the `contour` xDS server implementation is removed.
1174-
type: string
11751167
type: object
11761168
type: object
11771169
status:
@@ -4990,14 +4982,6 @@ spec:
49904982
description: Client key filename.
49914983
type: string
49924984
type: object
4993-
type:
4994-
description: |-
4995-
Defines the XDSServer to use for `contour serve`.
4996-
Values: `envoy` (default), `contour (deprecated)`.
4997-
Other values will produce an error.
4998-
Deprecated: this field will be removed in a future release when
4999-
the `contour` xDS server implementation is removed.
5000-
type: string
50014985
type: object
50024986
type: object
50034987
type: object

examples/render/contour-gateway.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,14 +1189,6 @@ spec:
11891189
description: Client key filename.
11901190
type: string
11911191
type: object
1192-
type:
1193-
description: |-
1194-
Defines the XDSServer to use for `contour serve`.
1195-
Values: `envoy` (default), `contour (deprecated)`.
1196-
Other values will produce an error.
1197-
Deprecated: this field will be removed in a future release when
1198-
the `contour` xDS server implementation is removed.
1199-
type: string
12001192
type: object
12011193
type: object
12021194
status:
@@ -5015,14 +5007,6 @@ spec:
50155007
description: Client key filename.
50165008
type: string
50175009
type: object
5018-
type:
5019-
description: |-
5020-
Defines the XDSServer to use for `contour serve`.
5021-
Values: `envoy` (default), `contour (deprecated)`.
5022-
Other values will produce an error.
5023-
Deprecated: this field will be removed in a future release when
5024-
the `contour` xDS server implementation is removed.
5025-
type: string
50265010
type: object
50275011
type: object
50285012
type: object

examples/render/contour.yaml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ metadata:
3939
namespace: projectcontour
4040
data:
4141
contour.yaml: |
42-
#
43-
# server:
44-
# determine which XDS Server implementation to utilize in Contour.
45-
# xds-server-type: envoy
46-
#
4742
# Specify the Gateway API configuration.
4843
# gateway:
4944
# namespace: projectcontour
@@ -1373,14 +1368,6 @@ spec:
13731368
description: Client key filename.
13741369
type: string
13751370
type: object
1376-
type:
1377-
description: |-
1378-
Defines the XDSServer to use for `contour serve`.
1379-
Values: `envoy` (default), `contour (deprecated)`.
1380-
Other values will produce an error.
1381-
Deprecated: this field will be removed in a future release when
1382-
the `contour` xDS server implementation is removed.
1383-
type: string
13841371
type: object
13851372
type: object
13861373
status:
@@ -5199,14 +5186,6 @@ spec:
51995186
description: Client key filename.
52005187
type: string
52015188
type: object
5202-
type:
5203-
description: |-
5204-
Defines the XDSServer to use for `contour serve`.
5205-
Values: `envoy` (default), `contour (deprecated)`.
5206-
Other values will produce an error.
5207-
Deprecated: this field will be removed in a future release when
5208-
the `contour` xDS server implementation is removed.
5209-
type: string
52105189
type: object
52115190
type: object
52125191
type: object

0 commit comments

Comments
 (0)