Documentation
¶
Overview ¶
Package metadata contains the container metadata server.
Index ¶
Constants ¶
const SignerHeader = "cni"
SignerHeader is the header specifying which node signed the token.
Variables ¶
var DefaultServerAddress = netip.MustParseAddrPort("169.254.169.254:80")
DefaultServerAddress is the default address for the metadata server.
var Now = time.Now
Now is a function that returns the current time. It is used to override the time used for token validation.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.0.23
type Config struct { // Address is the address to bind the metadata server to. // Defaults to DefaultMetadataAddress. Address netip.AddrPort // Host is the host node to use for the metadata server. Host host.Node // Storage is the storage provider to use for the metadata server. Storage *provider.Provider // KeyResolver is the key resolver to use for the metadata server. KeyResolver NodeKeyResolver // EnableIDTokens is true if ID tokens should be enabled. EnableIDTokens bool }
Config are the options for the container metadata server.
type IDTokenServer ¶ added in v0.0.23
type IDTokenServer struct{ *Server }
IDTokenServer is the server for ID tokens. It can create identification tokens for clients to use to access other services in the cluster.
func (*IDTokenServer) ServeHTTP ¶ added in v0.0.23
func (i *IDTokenServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler and will handle token issuance and validation.
type NodeKeyResolver ¶
type NodeKeyResolver interface {
LookupPrivateKey(nodeID types.NodeID) (crypto.PrivateKey, bool)
}
NodeKeyResolver is an interface that can retrieve the private key of a node hosted on this server.
type PeerRequestInfo ¶ added in v0.0.23
type PeerRequestInfo struct { // Peer is the peer that is requesting the metadata. Peer types.MeshNode // Local is true if the request is from the local host node. Local bool }
PeerRequestInfo is the information about the peer that is requesting the metadata.
type Server ¶
type Server struct { Config // contains filtered or unexported fields }
Server is the container metadata server.
func (*Server) ListenAndServe ¶
ListenAndServe starts the container metadata server. It blocks until the server is shutdown. If addr is empty, the default address of 169.254.169.254:80 is used.