go-xds

command module
v0.0.0-...-03e2b80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 23 Imported by: 0

README

Table of Contents

xDS Management Server

Overview

Glossary

xDS

xDS is a suite of APIs for configuring data plane behavior, in this context, the data plane is a piece of software that handles network traffic, such as client, server, or proxy

ADS

Aggregated xDS uses a single REST/gRPC connection to communicate with the xDS server for the resource it intends to whether LDS, RDS, CDS, or EDS

SotW

is an approach that was the original mechanism used by xDS, in which the client must specify all resource names it is interested in with each request, and for LDS and CDS resources, the server must return all resources that the client has subscribed to in each request.

delta

refers to the difference between the current state of an object and its previous state. This could be a change in any attribute of the object, like adding or removing a label, modifying a field value, or even deleting the object entirely.

Implementation

Protocol

Aggregated Discovery Service (ADS): SotW, aggregate stream for all resource types

Transport

gRPC client that uses xDS will establish an ADS stream with non-delta which is a single TCP connection(gRPC) and separates each resource (LDS, RDS, CDS, EDS) in each channel to communicate with the xDS server. See the implementation

Understand Envoy Structure

NOTE: The APIListener is use to skip the TCP filters and goes right to the HCM config

Application Internal Workflow

Call Graph Overview

main

reflector

k8sreflector

xDS Client

You need to set xDS bootstrap config on your application. Here's the xDS bootstrap config:

{
    "xds_servers": [
        {
            "server_uri": "appname.appns:530",
            "channel_creds": [{"type": "insecure"}],
            "server_features": ["xds_v3"]
        }
    ],
    "node": {
        "id": "default",
        "locality": {
            "zone" : "k8s"
        }
    }
}

Set the server_uri to wherever your client application can access the xDS server. There are 2 available methods to supply the xDS bootstrap config:

  • Put the JSON content in a file, then point GRPC_XDS_BOOTSTRAP environment variable to the path of the file
  • Put the JSON content in GRPC_XDS_BOOTSTRAP_CONFIG environment variable

Example

Go
package main

import (
    "google.golang.org/grpc/credentials/insecure"
    "google.golang.org/grpc"
    // xdsresolver
    _ "google.golang.org/grpc/xds"

)
func main(){
    ...

    // target must matched with the LDS resource
    target := "xds:///xds.info"
    grpcClientConn, err := grpc.NewClient(target, grpc.WithTransportCredentials(insecure.NewCredentials()))

    ...

or see an example application on example-go-xdsclient

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL