util

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2016 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLocalkubeDirectory = "/var/lib/localkube"
	DefaultCertPath           = DefaultLocalkubeDirectory + "/certs/"
	DefaultServiceClusterIP   = "10.0.0.1"
	DefaultDNSDomain          = "cluster.local"
	DefaultDNSIP              = "10.0.0.10"
)

These constants are used by both minikube and localkube

Variables

This section is empty.

Functions

func CanReadFile

func CanReadFile(path string) bool

If the file represented by path exists and readable, return true otherwise return false.

func FormatError added in v0.10.0

func FormatError(err error) (string, error)

func GenerateCACert added in v0.6.0

func GenerateCACert(certPath, keyPath string) error

func GenerateSignedCert added in v0.6.0

func GenerateSignedCert(certPath, keyPath string, ips []net.IP, alternateDNS []string, signerCertPath, signerKeyPath string) error

You may also specify additional subject alt names (either ip or dns names) for the certificate The certificate will be created with file mode 0644. The key will be created with file mode 0600. If the certificate or key files already exist, they will be overwritten. Any parent directories of the certPath or keyPath will be created as needed with file mode 0755.

func GetAlternateDNS

func GetAlternateDNS(domain string) []string

func GetLocalkubeDownloadURL added in v0.8.0

func GetLocalkubeDownloadURL(versionOrURL string, filename string) (string, error)

func IsDirectory added in v0.9.0

func IsDirectory(path string) (bool, error)

func MarshallError added in v0.10.0

func MarshallError(errMsg, service, version string) ([]byte, error)

func MaybeReportErrorAndExit added in v0.10.0

func MaybeReportErrorAndExit(err error)

func Pad

func Pad(str string) string

func ReportError added in v0.10.0

func ReportError(err error, url string) error

func Retry added in v0.2.0

func Retry(attempts int, callback func() error) (err error)

func RetryAfter added in v0.2.0

func RetryAfter(attempts int, callback func() error, d time.Duration) (err error)

func Until

func Until(fn func() error, w io.Writer, name string, sleep time.Duration, done <-chan struct{})

Until endlessly loops the provided function until a message is received on the done channel. The function will wait the duration provided in sleep between function calls. Errors will be sent on provider Writer.

func UploadError added in v0.10.0

func UploadError(b []byte, url string) error

Types

type Message added in v0.10.0

type Message struct {
	Message        string `json:"message"`
	ServiceContext `json:"serviceContext"`
}

type MultiError added in v0.8.0

type MultiError struct {
	Errors []error
}

func (*MultiError) Collect added in v0.8.0

func (m *MultiError) Collect(err error)

func (MultiError) ToError added in v0.8.0

func (m MultiError) ToError() error

type ServiceContext added in v0.10.0

type ServiceContext struct {
	Service string `json:"service"`
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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