Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate xDS server type field #6561

Merged
merged 3 commits into from
Jul 17, 2024
Merged
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
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 @@ -509,6 +509,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 @@ -923,13 +924,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 @@ -944,6 +947,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 @@ -1143,6 +1143,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 @@ -4919,6 +4921,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 @@ -1363,6 +1363,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 @@ -5139,6 +5141,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 @@ -1154,6 +1154,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 @@ -4930,6 +4932,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 @@ -1179,6 +1179,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 @@ -4955,6 +4957,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 @@ -1363,6 +1363,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 @@ -5139,6 +5141,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 @@ -9031,6 +9031,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