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

k8s: Consolidate check for EndpointSlice support #15561

Conversation

christarazi
Copy link
Member

@christarazi christarazi commented Apr 6, 2021

When v1 support for EndpointSlice is checked, the capability for the
base EndpointSlice support is also toggled, therefore we can consolidate
the logic inside the support helpers. It's not possible for one variant
to return true and the other false, and vice versa.

Fixes: 5ee4c6f ("add support for EndpointSlice V1")

Signed-off-by: Chris Tarazi chris@isovalent.com

@christarazi christarazi requested a review from a team April 6, 2021 01:17
@christarazi christarazi added sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers. kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact. labels Apr 6, 2021
@christarazi christarazi requested a review from brb April 6, 2021 01:17
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Apr 6, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Apr 6, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.10.0 Apr 6, 2021
@christarazi christarazi requested a review from aanm April 6, 2021 01:19
@christarazi
Copy link
Member Author

test-me-please

@@ -363,7 +363,7 @@ func SupportsEndpointSlice() bool {
// SupportsEndpointSliceV1 returns true if cilium-operator or cilium-agent should
// watch and process endpoint slices V1.
func SupportsEndpointSliceV1() bool {
return version.Capabilities().EndpointSliceV1 && option.Config.K8sEnableK8sEndpointSlice
return SupportsEndpointSlice() && version.Capabilities().EndpointSliceV1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reading is that SupportsEndpointSlice() checks for < k8s 1.21 EndpointSlice support. Is it guaranteed that on >= k8s 1.21 not only Capabilities().EndpointSliceV1, but also Capabilities().EndpointSlice will be set to true too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to have the option option.Config.K8sEnableK8sEndpointSlice used to disable EndpointSlice support for both v1beta1 and v1.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @brb, and yes it still will @aanm:

func SupportsEndpointSlice() bool {
	return version.Capabilities().EndpointSlice && option.Config.K8sEnableK8sEndpointSlice
}

It checks the option and now this PR simply combines the two functions by calling the above (SupportsEndpointSlice()). As mentioned, one variant cannot return true and the other false, and vice versa.

@@ -363,7 +363,7 @@ func SupportsEndpointSlice() bool {
// SupportsEndpointSliceV1 returns true if cilium-operator or cilium-agent should
// watch and process endpoint slices V1.
func SupportsEndpointSliceV1() bool {
return version.Capabilities().EndpointSliceV1 && option.Config.K8sEnableK8sEndpointSlice
return SupportsEndpointSlice() && version.Capabilities().EndpointSliceV1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to have the option option.Config.K8sEnableK8sEndpointSlice used to disable EndpointSlice support for both v1beta1 and v1.

@christarazi christarazi requested review from aanm and brb April 6, 2021 18:56
When v1 support for EndpointSlice is checked, the capability for the
base EndpointSlice support is also toggled, therefore we can consolidate
the logic inside the support helpers. It's not possible for one variant
to return true and the other false, and vice versa.

Fixes: 5ee4c6f ("add support for EndpointSlice V1")

Signed-off-by: Chris Tarazi <chris@isovalent.com>
@joestringer
Copy link
Member

test-me-please

@joestringer
Copy link
Member

Only failures are FQDN-related (link), seems orthogonal to the endpoint slices changes being made here. Otherwise passing CI and has required codeowner review. Merging.

@joestringer joestringer merged commit 7a1039f into cilium:master Apr 7, 2021
1.10.0 automation moved this from In progress to Done Apr 7, 2021
@christarazi christarazi deleted the pr/christarazi/consolidate-epslices-check branch April 7, 2021 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact. sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants