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

chore(K8s): migrate from CoreV1 Endpoints to DiscoveryV1 EndpointSlice #3997

Merged
merged 1 commit into from
May 16, 2023

Conversation

programmer04
Copy link
Member

@programmer04 programmer04 commented May 12, 2023

What this PR does / why we need it:

EndpointSlice API is available as V1 since K8s 1.21. KIC 2.9's minimum supported K8s version is 1.22.

Which issue this PR fixes:

#3916

Leftovers to address separately

Special notes for your reviewer:

  1. K8s permissions - get rid of Endpoints, EndpointSlices are already allowed - get (from annotation), watch, list. Subresource status is redundant for both Endpoints or EndpointSlices because they don't implement it. Affected files

    • config/rbac/role.yaml
    • deploy/single/*.yaml

    I've spotted secrets/status too, it seems redundant (it's addressed separately in chore(rbac): get rid of rbac permissions for secrets/status #4017).

  2. One K8s Service can have multiple EndpointSlices thus now we have to work with a slice instead of a single resource.

  3. In terms of readiness for an endpoint the way that ensures the same semantic as in CoreV1 is used.

  4. EndpointSlice by default handles 100 endpoints, Service can have multiple EndpointSlices. In integration/e2e tests having a Service that has more than one EndpointSlice is rather not sensible. But in controller manager with --max-endpoints-per-slice flag number of allowed endpoints per EndpointSlice can be adjusted. Maybe it's worth to add a test case that would use a cluster that will have configured --max-endpoints-per-slice 1 so multiple EndpointSlices per Service will be easily achievable.

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@programmer04 programmer04 added this to the KIC v2.10.0 milestone May 12, 2023
@programmer04 programmer04 self-assigned this May 12, 2023
@programmer04 programmer04 linked an issue May 12, 2023 that may be closed by this pull request
3 tasks
@programmer04 programmer04 changed the title WIP Get rod of CoreV1 Endpoints WIP Get rid of CoreV1 Endpoints May 12, 2023
@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

Patch coverage: 88.6% and project coverage change: -0.1 ⚠️

Comparison is base (4fa7cf0) 59.7% compared to head (0a2fec4) 59.6%.

❗ Current head 0a2fec4 differs from pull request most recent head 2829cbf. Consider uploading reports for the commit 2829cbf to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3997     +/-   ##
=======================================
- Coverage   59.7%   59.6%   -0.1%     
=======================================
  Files        149     149             
  Lines      16399   16406      +7     
=======================================
- Hits        9793    9782     -11     
- Misses      5970    5987     +17     
- Partials     636     637      +1     
Impacted Files Coverage Δ
internal/store/store.go 56.6% <73.0%> (+0.2%) ⬆️
...trollers/configuration/zz_generated_controllers.go 27.3% <85.7%> (ø)
internal/dataplane/parser/parser.go 74.3% <97.5%> (-1.2%) ⬇️
internal/manager/controllerdef.go 98.8% <100.0%> (ø)
internal/store/fake_store.go 58.7% <100.0%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@programmer04 programmer04 force-pushed the 3916-migrate-from-endpoints-to-endpointslice branch from 0064eab to bcd2b3e Compare May 12, 2023 14:45
@programmer04 programmer04 changed the title WIP Get rid of CoreV1 Endpoints chore(K8s): Migrate from CoreV1 Endpoints to DiscoveryV1 EndpointSlice May 12, 2023
@programmer04 programmer04 force-pushed the 3916-migrate-from-endpoints-to-endpointslice branch 3 times, most recently from d59d2dc to c89e77e Compare May 15, 2023 08:12
@programmer04 programmer04 force-pushed the 3916-migrate-from-endpoints-to-endpointslice branch 2 times, most recently from 6e54349 to e40ef40 Compare May 15, 2023 09:57
@programmer04 programmer04 changed the title chore(K8s): Migrate from CoreV1 Endpoints to DiscoveryV1 EndpointSlice chore(K8s): migrate from CoreV1 Endpoints to DiscoveryV1 EndpointSlice May 15, 2023
@programmer04 programmer04 force-pushed the 3916-migrate-from-endpoints-to-endpointslice branch from e40ef40 to ce86d95 Compare May 15, 2023 16:10
@programmer04 programmer04 marked this pull request as ready for review May 15, 2023 16:10
@programmer04 programmer04 requested a review from a team as a code owner May 15, 2023 16:10
@programmer04 programmer04 removed the work in progress Work In Progress label May 15, 2023
Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

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

2 things that I'd like to raise:

  • the left over issues that you mention: ideally we'd have :octocat: issues for those so that we don't loose track of those
  • I believe we should add a changelog entry for this because
    • we'll have a trace in history (apart from git log) stating where we've changed from one to another
    • some users might be genuinely interested in this change, so let's now hide it from them

internal/store/fake_store_test.go Outdated Show resolved Hide resolved
internal/store/fake_store_test.go Outdated Show resolved Hide resolved
@pmalek
Copy link
Member

pmalek commented May 15, 2023

When you're ready with this you might want to add ci/run-e2e label to your PR to trigger e2e tests to verify everything is as it should be.

Copy link
Contributor

@randmonkey randmonkey left a comment

Choose a reason for hiding this comment

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

Generally LGTM, only some minor points remaining. Also, Since the user-facing manifests are changed, I think this needs an update on CHANGELOG.

internal/store/fake_store_test.go Outdated Show resolved Hide resolved
internal/store/store.go Outdated Show resolved Hide resolved
@pmalek
Copy link
Member

pmalek commented May 16, 2023

@programmer04 There seem to be some failures in GKE e2e tests 🤔
https://github.com/Kong/kubernetes-ingress-controller/actions/runs/4991359055/jobs/8937809045#step:5:129

I'll be happy to help you out in debugging them.

@programmer04 programmer04 force-pushed the 3916-migrate-from-endpoints-to-endpointslice branch from 1751081 to 0a2fec4 Compare May 16, 2023 15:10
@programmer04
Copy link
Member Author

GKE e2e tests failed, because we don't have mechanism of building&loading images from PR to GKE clusters, there is issue KTF #587 to implement this. Curently it uses an image from nightlies that does not include changes from this PR

@programmer04 programmer04 enabled auto-merge (squash) May 16, 2023 15:46
@pmalek
Copy link
Member

pmalek commented May 16, 2023

GKE e2e tests failed, because we don't have mechanism of building&loading images from PR to GKE clusters, there is issue KTF #587 to implement this. Curently it uses an image from nightlies that does not include changes from this PR

As discussed on zoom: I'm OK merging this and seeing the results of tests the next day but I'd suggest we invest in the GKE image loading so that we don't need to do this in the future.

The fact that this works on kind and all integration tests given a certain level of confidence that this will work on GKE as well.

CHANGELOG.md Show resolved Hide resolved
@programmer04 programmer04 force-pushed the 3916-migrate-from-endpoints-to-endpointslice branch from 0a2fec4 to 2829cbf Compare May 16, 2023 16:04
@programmer04 programmer04 requested a review from pmalek May 16, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate from Endpoints to EndpointSlice
4 participants