...

Package nettest

import "k8s.io/kubernetes/test/images/agnhost/nettest"
Overview
Index

Overview ▾

Variables

CmdNettest is used by agnhost Cobra.

var CmdNettest = &cobra.Command{
    Use:   "nettest",
    Short: "Starts a tiny web server for checking networking connectivity",
    Long: `Starts a web server for checking networking connectivity on the given "--port".

Will dial out to, and expect to hear from, every pod that is a member of the service
passed in the flag "--service".

The web server will have the following endpoints:

- "/read": to see the current state, or "/quit" to shut down.

- "/status": to see "pass/running/fail" determination. (literally, it will return
one of those words.)

- "/write": is used by other network test pods to register connectivity.`,
    Args: cobra.MaximumNArgs(0),
    Run:  main,
}

type State

State tracks the internal state of our little http server. It's returned verbatim over the /read endpoint.

type State struct {
    // Hostname is set once and never changed-- it's always safe to read.
    Hostname string

    // The below fields require that lock is held before reading or writing.
    Sent                 map[string]int
    Received             map[string]int
    Errors               []string
    Log                  []string
    StillContactingPeers bool
    // contains filtered or unexported fields
}

func (*State) Logf

func (s *State) Logf(format string, args ...interface{})

Logf writes to the log message list. s must not be locked. s's Log member will drop an old message if it would otherwise become longer than 500 messages.

type WritePost

WritePost is the format that (json encoded) requests to the /write handler should take.

type WritePost struct {
    Source string
    Dest   string
}

type WriteResp

WriteResp is returned by /write

type WriteResp struct {
    Hostname string
}