Skip to content

build(deps): bump the k8s-dependencies group with 4 updates #7014

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 0 additions & 4 deletions apis/projectcontour/v1alpha1/contourconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ type ContourConfigurationSpec struct {
Tracing *TracingConfig `json:"tracing,omitempty"`

// FeatureFlags defines toggle to enable new contour features.
// Available toggles are:
// useEndpointSlices - Configures contour to fetch endpoint data
// from k8s endpoint slices. defaults to true,
// If false then reads endpoint data from the k8s endpoints.
FeatureFlags FeatureFlags `json:"featureFlags,omitempty"`
}

Expand Down
22 changes: 2 additions & 20 deletions apis/projectcontour/v1alpha1/contourconfig_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
)

const featureFlagUseEndpointSlices string = "useEndpointSlices"

var featureFlagsMap = map[string]struct{}{
featureFlagUseEndpointSlices: {},
}
var featureFlagsMap = map[string]struct{}{}

// Validate configuration that is not already covered by CRD validation.
func (c *ContourConfigurationSpec) Validate() error {
Expand Down Expand Up @@ -235,26 +231,12 @@ func (f FeatureFlags) Validate() error {
for _, featureFlag := range f {
fields := strings.Split(featureFlag, "=")
if _, found := featureFlagsMap[fields[0]]; !found {
return fmt.Errorf("invalid contour configuration, unknown feature flag:%s", featureFlag)
return fmt.Errorf("invalid contour configuration, unknown feature flag: %s", featureFlag)
}
}
return nil
}

func (f FeatureFlags) IsEndpointSliceEnabled() bool {
// only when the flag: 'useEndpointSlices=false' is exists, return false
for _, flag := range f {
if !strings.HasPrefix(flag, featureFlagUseEndpointSlices) {
continue
}
fields := strings.Split(flag, "=")
if len(fields) == 2 && strings.ToLower(fields[1]) == "false" {
return false
}
}
return true
}

// Validate ensures that GatewayRef namespace/name is specified.
func (g *GatewayConfig) Validate() error {
if g != nil && (g.GatewayRef.Namespace == "" || g.GatewayRef.Name == "") {
Expand Down
93 changes: 1 addition & 92 deletions apis/projectcontour/v1alpha1/contourconfig_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,36 +303,10 @@ func TestFeatureFlagsValidate(t *testing.T) {
flags contour_v1alpha1.FeatureFlags
expected error
}{
{
name: "valid flag: no value",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices"},
expected: nil,
},
{
name: "valid flag2: empty",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices="},
expected: nil,
},
{
name: "valid flag: true",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices=true"},
expected: nil,
},
{
name: "valid flag: false",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices=false"},
expected: nil,
},

{
name: "invalid flag",
flags: contour_v1alpha1.FeatureFlags{"invalidFlag"},
expected: fmt.Errorf("invalid contour configuration, unknown feature flag:invalidFlag"),
},
{
name: "mix of valid and invalid flags",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices", "invalidFlag"},
expected: fmt.Errorf("invalid contour configuration, unknown feature flag:invalidFlag"),
expected: fmt.Errorf("invalid contour configuration, unknown feature flag: invalidFlag"),
},
{
name: "empty flags",
Expand All @@ -348,68 +322,3 @@ func TestFeatureFlagsValidate(t *testing.T) {
})
}
}

func TestFeatureFlagsIsEndpointSliceEnabled(t *testing.T) {
tests := []struct {
name string
flags contour_v1alpha1.FeatureFlags
expected bool
}{
{
name: "valid flag: no value",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices"},
expected: true,
},
{
name: "valid flag2: empty",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices="},
expected: true,
},
{
name: "valid flag: true",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices=true"},
expected: true,
},
{
name: "valid flag: ANY",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices=ANY"},
expected: true,
},

{
name: "empty flags",
flags: contour_v1alpha1.FeatureFlags{},
expected: true,
},
{
name: "empty string",
flags: contour_v1alpha1.FeatureFlags{""},
expected: true,
},

{
name: "multi-flags",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices", "otherFlag"},
expected: true,
},

{
name: "valid flag: false",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices=false"},
expected: false,
},

{
name: "valid flag: FALSE",
flags: contour_v1alpha1.FeatureFlags{"useEndpointSlices=FALSE"},
expected: false,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.flags.IsEndpointSliceEnabled()
assert.Equal(t, tt.expected, err)
})
}
}
5 changes: 5 additions & 0 deletions changelogs/unreleased/7008-sunjayBhatia-deprecation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## useEndpointSlices feature flag removed

As of v1.29.0, Contour has used the Kubernetes EndpointSlices API by default to determine the endpoints to configure Envoy with, instead of the Endpoints API.
EndpointSlice support is now stable and the remaining Endpoint handling code, along with the associated `useEndpointSlices` feature flag, has been removed.
This should be a no-op change for most users, only affecting those that opted into continuing to use the Endpoints API and possibly also disabled EndpointSlice mirroring of Endpoints.
36 changes: 8 additions & 28 deletions cmd/contour/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@
handlerCacheSyncs []cache.InformerSynced
}

type EndpointsTranslator interface {
cache.ResourceEventHandler
xdscache.ResourceCache
SetObserver(observer contour.Observer)
}

// NewServer returns a Server object which contains the initial configuration
// objects required to start an instance of Contour.
func NewServer(log logrus.FieldLogger, ctx *serveContext) (*Server, error) {
Expand Down Expand Up @@ -488,13 +482,8 @@

contourMetrics := metrics.NewMetrics(s.registry)

// Endpoints updates are handled directly by the EndpointsTranslator/EndpointSliceTranslator due to the high update volume.
var endpointHandler EndpointsTranslator
if contourConfiguration.FeatureFlags.IsEndpointSliceEnabled() {
endpointHandler = xdscache_v3.NewEndpointSliceTranslator(s.log.WithField("context", "endpointslicetranslator"))
} else {
endpointHandler = xdscache_v3.NewEndpointsTranslator(s.log.WithField("context", "endpointstranslator"))
}
// Endpoints updates are handled directly by the EndpointSliceTranslator due to the high update volume.
endpointHandler := xdscache_v3.NewEndpointSliceTranslator(s.log.WithField("context", "endpointslicetranslator"))

Check warning on line 486 in cmd/contour/serve.go

View check run for this annotation

Codecov / codecov/patch

cmd/contour/serve.go#L485-L486

Added lines #L485 - L486 were not covered by tests

envoyGen := envoy_v3.NewEnvoyGen(envoy_v3.EnvoyGenOpt{
XDSClusterName: envoy_v3.DefaultXDSClusterName,
Expand Down Expand Up @@ -655,21 +644,12 @@
s.log.WithError(err).WithField("resource", "secrets").Fatal("failed to create informer")
}

// Inform on endpoints/endpointSlices.
if contourConfiguration.FeatureFlags.IsEndpointSliceEnabled() {
if err := s.informOnResource(&discovery_v1.EndpointSlice{}, &contour.EventRecorder{
Next: endpointHandler,
Counter: contourMetrics.EventHandlerOperations,
}); err != nil {
s.log.WithError(err).WithField("resource", "endpointslices").Fatal("failed to create informer")
}
} else {
if err := s.informOnResource(&core_v1.Endpoints{}, &contour.EventRecorder{
Next: endpointHandler,
Counter: contourMetrics.EventHandlerOperations,
}); err != nil {
s.log.WithError(err).WithField("resource", "endpoints").Fatal("failed to create informer")
}
// Inform on endpointSlices.
if err := s.informOnResource(&discovery_v1.EndpointSlice{}, &contour.EventRecorder{
Next: endpointHandler,
Counter: contourMetrics.EventHandlerOperations,
}); err != nil {
s.log.WithError(err).WithField("resource", "endpointslices").Fatal("failed to create informer")

Check warning on line 652 in cmd/contour/serve.go

View check run for this annotation

Codecov / codecov/patch

cmd/contour/serve.go#L648-L652

Added lines #L648 - L652 were not covered by tests
}

// Register our event handler with the manager.
Expand Down
17 changes: 4 additions & 13 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,7 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour features.
items:
type: string
type: array
Expand Down Expand Up @@ -2801,7 +2796,7 @@ spec:
The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field.
The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images.
The volume will be mounted read-only (ro) and non-executable files (noexec).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33.
The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.
properties:
pullPolicy:
Expand Down Expand Up @@ -4473,12 +4468,8 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour
features.
items:
type: string
type: array
Expand Down
17 changes: 4 additions & 13 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,7 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour features.
items:
type: string
type: array
Expand Down Expand Up @@ -3016,7 +3011,7 @@ spec:
The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field.
The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images.
The volume will be mounted read-only (ro) and non-executable files (noexec).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33.
The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.
properties:
pullPolicy:
Expand Down Expand Up @@ -4688,12 +4683,8 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour
features.
items:
type: string
type: array
Expand Down
17 changes: 4 additions & 13 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,7 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour features.
items:
type: string
type: array
Expand Down Expand Up @@ -2812,7 +2807,7 @@ spec:
The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field.
The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images.
The volume will be mounted read-only (ro) and non-executable files (noexec).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33.
The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.
properties:
pullPolicy:
Expand Down Expand Up @@ -4484,12 +4479,8 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour
features.
items:
type: string
type: array
Expand Down
17 changes: 4 additions & 13 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,7 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour features.
items:
type: string
type: array
Expand Down Expand Up @@ -2837,7 +2832,7 @@ spec:
The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field.
The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images.
The volume will be mounted read-only (ro) and non-executable files (noexec).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath).
Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33.
The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.
properties:
pullPolicy:
Expand Down Expand Up @@ -4509,12 +4504,8 @@ spec:
type: object
type: object
featureFlags:
description: |-
FeatureFlags defines toggle to enable new contour features.
Available toggles are:
useEndpointSlices - Configures contour to fetch endpoint data
from k8s endpoint slices. defaults to true,
If false then reads endpoint data from the k8s endpoints.
description: FeatureFlags defines toggle to enable new contour
features.
items:
type: string
type: array
Expand Down
Loading
Loading