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

feat/endpoint-discovery #179

Merged
merged 11 commits into from
May 16, 2023
Merged

feat/endpoint-discovery #179

merged 11 commits into from
May 16, 2023

Conversation

roivaz
Copy link
Member

@roivaz roivaz commented May 10, 2023

Description

With this PR, the discovery service gains the ability to discover and feed a list of Pod IPs to a subscribed consumer. The endpoints are discovered by watching the EndpointSlices resources in the namespace that match a given label selector.

An endpoint resource would have to be declared like

    - type: endpoint
      generateFromEndpointSlices:
        selector:
          matchLabels:
            kubernetes.io/service-name: test
        clusterName: test
        targetPort: http

This would make the discovery service watch the EndpointSlices generated by the k8s Service named test. Any other custom label selector can be used.

The (debug) logs in the discovery service show how the list of pod IPs is generated and feed to consumers:

2023-05-10T10:41:29Z	DEBUG	setup.xds.cache.v3	respond type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment[kuard] version "58f6d94cd" with version "57f9787477"
2023-05-10T10:41:29Z	DEBUG	setup.xds.server.v3	Discovery Response	{"TypeURL": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment", "NodeID": "kuard", "StreamID": 1, "Version": "57f9787477", "Resources": ["{\"@type\":\"type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment\",\"cluster_name\":\"kuard\",\"endpoints\":[{\"lb_endpoints\":[{\"endpoint\":{\"address\":{\"socket_address\":{\"address\":\"10.244.0.14\",\"port_value\":8080}}},\"health_status\":\"HEALTHY\"},{\"endpoint\":{\"address\":{\"socket_address\":{\"address\":\"10.244.0.20\",\"port_value\":8080}}},\"health_status\":\"DRAINING\"}]}]}"], "Pod": "marin3r-envoydeployment-kuard-7578497bb-bbpdn"}

The health status of each endpoint is provided so the consumer can make appropriate load balancing decisions.

/kind feature
/priority important-soon
/assign

This PR depends on #177 being merged first.

How to test

make kind-create
export KUBECONFIG=${PWD}/kubeconfig
kubectl apply -f examples/e2e/deployment

Check the logs of the discovery service and the endpoint pod in the default namespace to see how the list of endpoints is updated each time the number of replicas in the nginx deployment is changed.

@3scale-robot 3scale-robot added kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next sprint. needs-size Indicates a PR or issue lacks a `size/foo` label and requires one. labels May 10, 2023
@3scale-robot 3scale-robot added size/XL Requires about a week to complete the PR or the issue. and removed needs-size Indicates a PR or issue lacks a `size/foo` label and requires one. labels May 10, 2023
@roivaz
Copy link
Member Author

roivaz commented May 10, 2023

/ok-to-test

@3scale-robot 3scale-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label May 10, 2023
@3scale-robot 3scale-robot added size/L Requires few days to complete the PR or the issue. needs-size Indicates a PR or issue lacks a `size/foo` label and requires one. and removed size/XL Requires about a week to complete the PR or the issue. needs-size Indicates a PR or issue lacks a `size/foo` label and requires one. labels May 11, 2023
@roivaz roivaz added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed ok-to-test Indicates a non-member PR verified by an org member that is safe to test. labels May 11, 2023
@slopezz
Copy link
Member

slopezz commented May 11, 2023

/lgtm

@3scale-robot 3scale-robot added the lgtm Indicates that a PR is ready to be merged. label May 11, 2023
@3scale-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 81800917772288d9c3e16de13b4135d015d45522

@3scale-robot 3scale-robot removed the lgtm Indicates that a PR is ready to be merged. label May 15, 2023
@slopezz
Copy link
Member

slopezz commented May 15, 2023

/lgtm

@3scale-robot 3scale-robot added the lgtm Indicates that a PR is ready to be merged. label May 15, 2023
@3scale-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: c10f7633594ff2bf58d1b7bbe2054d47596dd632

@3scale-robot 3scale-robot removed the lgtm Indicates that a PR is ready to be merged. label May 16, 2023
@3scale-robot 3scale-robot requested a review from raelga May 16, 2023 11:04
@roivaz roivaz added lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed ok-to-test Indicates a non-member PR verified by an org member that is safe to test. labels May 16, 2023
@roivaz
Copy link
Member Author

roivaz commented May 16, 2023

/approve

@3scale-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: roivaz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@3scale-robot 3scale-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 16, 2023
@3scale-robot 3scale-robot merged commit 95e35e5 into main May 16, 2023
@3scale-robot 3scale-robot deleted the feat/endpoint-discovery branch May 16, 2023 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next sprint. size/L Requires few days to complete the PR or the issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants