bootstrap

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package bootstrap provides bootstrap config loading capabilities to xds client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// XDSServer is the management server to connect to.
	XDSServer *ServerConfig `json:"xds_server"`
}

Config provides the xDS client with several key bits of information that it requires in its interaction with the management server. The Config is initialized from the bootstrap file.

func NewConfig

func NewConfig() (*Config, error)

NewConfig returns a bootstrap config after reading the BootstrapConfig from the file specified by COURIER_XDS_BOOTSTRAP env var or the base64 encoded string in COURIER_XDS_BOOTSTRAP_CONFIG_BASE64 var.

func NewConfigFromContents

func NewConfigFromContents(data []byte) (*Config, error)

NewConfigFromContents returns a bootstrap config after reading the BootstrapConfig from data.

type ServerConfig

type ServerConfig struct {
	// ServerURI is the management server to connect to.
	//
	// The bootstrap file contains an ordered list of xDS servers to contact for
	// this authority. The first one is picked.
	ServerURI string `json:"server_uri"`
	// NodeProto contains the Node proto to be used in xDS requests. The actual
	// type depends on the transport protocol version used.
	//
	// Note that it's specified in the bootstrap globally for all the servers,
	// but we keep it in each server config so that its type (e.g. *v3pb.Node)
	// is consistent with the transport API version.
	NodeProto proto.Message
}

ServerConfig contains the configuration to connect to a server, including URI, creds, and transport API version (e.g. v2 or v3).

func (ServerConfig) MarshalJSON

func (sc ServerConfig) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ServerConfig to json.

func (*ServerConfig) String

func (sc *ServerConfig) String() string

String returns the string representation of the ServerConfig.

This string representation will be used as map keys in federation (`map[ServerConfig]authority`), so that the xDS ClientConn and stream will be shared by authorities with different names but the same server config.

It covers (almost) all the fields so the string can represent the config content. It doesn't cover NodeProto because NodeProto isn't used by federation.

func (*ServerConfig) UnmarshalJSON

func (sc *ServerConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON takes the json data (a server) and unmarshals it to the struct.

Jump to

Keyboard shortcuts

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