Skip to content

Add EndpointSlice API support for Kubernetes 1.33+#1

Open
shivvinaykanswal wants to merge 1 commit intomainfrom
feat/endpointslices-api
Open

Add EndpointSlice API support for Kubernetes 1.33+#1
shivvinaykanswal wants to merge 1 commit intomainfrom
feat/endpointslices-api

Conversation

@shivvinaykanswal
Copy link
Copy Markdown

Summary

  • Adds :endpoint_slices as a new option for :kubernetes_ip_lookup_mode to use the discovery.k8s.io/v1 EndpointSlice API
  • The legacy Endpoints API (api/v1/endpoints) is deprecated in Kubernetes 1.33 — this provides a migration path
  • Default remains :endpoints for backward compatibility with older clusters

Usage

config :libcluster,
  topologies: [
    k8s: [
      strategy: Cluster.Strategy.Kubernetes,
      config: [
        kubernetes_ip_lookup_mode: :endpoint_slices,
        kubernetes_node_basename: "myapp",
        kubernetes_selector: "app=myapp",
        kubernetes_namespace: "default"
      ]
    ]
  ]

What changed

  • lib/strategy/kubernetes.ex: Added :endpoint_slices lookup mode with the discovery.k8s.io/v1 API path and a response parser for the EndpointSlice format (where IPs are in endpoints[].addresses[] instead of subsets[].addresses[].ip)
  • test/kubernetes_test.exs: Added 4 tests covering endpoint_slices with default/cached/hostname/dns modes
  • test/fixtures/vcr_cassettes/kubernetes_endpoint_slices.json: VCR cassette for EndpointSlice API responses

Addresses bitwalker#213

Test plan

  • All 14 existing + new tests pass (mix test test/kubernetes_test.exs)
  • Verify on a Kubernetes 1.33+ cluster with kubernetes_ip_lookup_mode: :endpoint_slices
  • Verify backward compatibility — existing :endpoints and :pods modes unchanged

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant