Skip to content

Commit

Permalink
deprecate xDS server type field (projectcontour#6561)
Browse files Browse the repository at this point in the history
Fields are planned to be removed in the 1.31 release.

Updates projectcontour#2134.

Signed-off-by: Steve Kriss <[email protected]>
Signed-off-by: Geoff Macartney <[email protected]>
  • Loading branch information
skriss authored and Geoff Macartney committed Aug 22, 2024
1 parent 4962632 commit c9d6233
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apis/projectcontour/v1alpha1/contourconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ type XDSServerConfig struct {
// 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"`

Expand Down
4 changes: 4 additions & 0 deletions changelogs/unreleased/6561-skriss-deprecation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## xDS server type fields in config file and ContourConfiguration CRD are deprecated

These fields are officially deprecated now that the `contour` xDS server implementation is deprecated.
They are planned to be removed in the 1.31 release, along with the `contour` xDS server implementation.
4 changes: 4 additions & 0 deletions cmd/contour/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ func (s *Server) doServe() error {
// the contents of the Contour xDS caches after the DAG is built.
var snapshotHandler *xdscache_v3.SnapshotHandler

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

Expand Down Expand Up @@ -924,13 +925,15 @@ func (x *xdsServer) Start(ctx context.Context) error {

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)
}

Expand All @@ -945,6 +948,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)
defer log.Info("stopped xDS server")

Expand Down
4 changes: 4 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,8 @@ spec:
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
Expand Down Expand Up @@ -4931,6 +4933,8 @@ spec:
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
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,8 @@ spec:
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
Expand Down Expand Up @@ -5151,6 +5153,8 @@ spec:
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
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,8 @@ spec:
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
Expand Down Expand Up @@ -4942,6 +4944,8 @@ spec:
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
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,8 @@ spec:
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
Expand Down Expand Up @@ -4967,6 +4969,8 @@ spec:
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
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,8 @@ spec:
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
Expand Down Expand Up @@ -5151,6 +5153,8 @@ spec:
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
Expand Down
4 changes: 2 additions & 2 deletions internal/contourconfig/contourconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ func TestOverlayOnDefaults(t *testing.T) {
"ContourConfig with single non-default field is overlaid correctly": {
contourConfig: contour_v1alpha1.ContourConfigurationSpec{
XDSServer: &contour_v1alpha1.XDSServerConfig{
Type: contour_v1alpha1.EnvoyServerType,
Port: 7777,
},
},
want: func() contour_v1alpha1.ContourConfigurationSpec {
res := contourconfig.Defaults()
res.XDSServer.Type = contour_v1alpha1.EnvoyServerType
res.XDSServer.Port = 7777
return res
},
},
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ func (t ProtocolParameters) Validate() error {
type ServerParameters struct {
// Defines the XDSServer to use for `contour serve`.
// Defaults to "envoy"
// Deprecated: this field will be removed in a future release when
// the `contour` xDS server implementation is removed.
XDSServerType ServerType `yaml:"xds-server-type,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions site/content/docs/main/config/api-reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -9046,6 +9046,8 @@ <h3 id="projectcontour.io/v1alpha1.XDSServerConfig">XDSServerConfig
<p>Defines the XDSServer to use for <code>contour serve</code>.</p>
<p>Values: <code>envoy</code> (default), <code>contour (deprecated)</code>.</p>
<p>Other values will produce an error.</p>
<p>Deprecated: this field will be removed in a future release when
the <code>contour</code> xDS server implementation is removed.</p>
</td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/main/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ The server configuration block can be used to configure various settings for the

| Field Name | Type | Default | Description |
| --------------- | ------ | ------- | ----------------------------------------------------------------------------- |
| xds-server-type | string | envoy | This field specifies the xDS Server to use. Options are `envoy` or `contour` (deprecated). |
| xds-server-type | string | envoy | This field specifies the xDS Server to use. Options are `envoy` or `contour` (deprecated). **This field is deprecated** and will be removed in a future release when the `contour` xDS server implementation is removed. |

### Gateway Configuration

Expand Down

0 comments on commit c9d6233

Please sign in to comment.