Documentation ¶
Index ¶
- func BoolPtr(v bool) *bool
- func DropInDir(unit string) string
- func ExitStatusFromError(err error) *int
- func GetRegion() (string, error)
- func Int32Ptr(v int32) *int32
- func NewUnlimitedExponentialBackOff() backoff.BackOff
- func OnGCEVM() bool
- func Retry(ctx context.Context, times int, period time.Duration, fn func() error) error
- func RetryWithInterval(ctx context.Context, interval backoff.BackOff, fn func() error) error
- func SafeWriteFile(filename string, data []byte, perm os.FileMode) error
- func ToJSON(data []byte) ([]byte, error)
- func WriteDropIn(dropInDir, dropInFile string, contents []byte) error
- func WriteHosts(writer io.Writer, entries []HostEntry) error
- type Continue
- type DNSConfig
- type HostEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitStatusFromError ¶
ExitStatusFromError returns the exit status from the specified error. If the error is not exit status error, return nil
func NewUnlimitedExponentialBackOff ¶
NewUnlimitedExponentialBackOff returns a backoff interval without time restriction
func OnGCEVM ¶
func OnGCEVM() bool
OnGCEVM returns true if it finds a local GCE VM. Looks at a product file that is an undocumented API. Based on https://github.com/kubernetes/kubernetes/blob/09f4baed35865d410febb3220811ca5c2fe1cf42/pkg/credentialprovider/gcp/metadata.go#L117-L142 Copyright the Kubernetes Authors: https://github.com/kubernetes/kubernetes/blob/09f4baed35865d410febb3220811ca5c2fe1cf42/pkg/credentialprovider/gcp/metadata.go#L1-L15
func Retry ¶
Retry retries 'times' attempts with retry period 'period' calling function fn until it returns nil, or until the context gets cancelled or the retries get exceeded the times number of attempts
func RetryWithInterval ¶
RetryWithInterval retries the specified operation fn using the specified backoff interval. fn should return backoff.PermanentError if the error should not be retried and returned directly. Returns nil on success or the last received error upon exhausting the interval.
func SafeWriteFile ¶
SafeWriteFile is similar to ioutil.WriteFile, but operates by writing to a temporary file first and then relinking the file into the filename which should be an atomic operation. This should be safer, that if the destination file is being replaced, it won't be left in a partial written state.
func ToJSON ¶
ToJSON converts a single YAML document into a JSON document or returns an error. If the document appears to be JSON the YAML decoding path is not used (so that error messages are JSON specific). Creds to: k8s.io for the code
func WriteDropIn ¶
WriteDropIn creates the file specified with dropInPath in directory specified with dropInDir with given contents
Types ¶
type Continue ¶
type Continue string
Continue is an artificial error value that indicates that a retry loop should be re-executed with the specified message
type DNSConfig ¶
type DNSConfig struct { Servers []string // servers to use Domain string // Domain parameter Search []string // suffixes to append to local name Ndots int // number of dots in name to trigger absolute lookup Timeout int // seconds before giving up on packet Attempts int // lost packets before giving up on server Rotate bool // round robin among servers UnknownOpt bool // anything unknown was encountered Lookup []string // OpenBSD top-level database "lookup" order }
func DNSReadConfig ¶
See resolv.conf(5) on a Linux machine. TODO(rsc): Supposed to call uname() and chop the beginning of the host name to get the default search domain. noDefaultNameservers indicates we should not emulate libc behaviour and include a localhost resolver.