util

package
v1.4.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 31 Imported by: 375

Documentation

Overview

based on: https://github.com/hashicorp/go-getter/blob/master/cmd/go-getter/progress_tracking.go

Index

Constants

View Source
const (
	APIServerPort      = 8443
	DefaultDNSDomain   = "cluster.local"
	DefaultServiceCIDR = "10.96.0.0/12"
)

These constants are used by both minikube

View Source
const ErrPrefix = "! "

ErrPrefix notes an error

View Source
const OutPrefix = "> "

OutPrefix notes output

Variables

View Source
var DefaultLegacyAdmissionControllers = append([]string{"Initializers"}, DefaultV114AdmissionControllers...)

DefaultLegacyAdmissionControllers are admission controllers we include with Kubernetes <1.14.0

View Source
var DefaultV114AdmissionControllers = []string{
	"NamespaceLifecycle",
	"LimitRanger",
	"ServiceAccount",
	"DefaultStorageClass",
	"DefaultTolerationSeconds",
	"NodeRestriction",
	"MutatingAdmissionWebhook",
	"ValidatingAdmissionWebhook",
	"ResourceQuota",
}

DefaultV114AdmissionControllers are admission controllers we default to in v1.14.x

Functions

func CalculateSizeInMB added in v1.3.0

func CalculateSizeInMB(humanReadableSize string) int

CalculateSizeInMB returns the number of MB in the human readable string

func CanReadFile

func CanReadFile(path string) bool

CanReadFile returns true if the file represented by path exists and is readable, otherwise false.

func ChownR added in v0.21.0

func ChownR(path string, uid, gid int) error

ChownR does a recursive os.Chown

func ConcatStrings added in v1.0.1

func ConcatStrings(src []string, prefix string, postfix string) []string

ConcatStrings concatenates each string in the src slice with prefix and postfix and returns a new slice

func FindAndSet added in v0.11.0

func FindAndSet(path string, c interface{}, value string) error

FindAndSet sets the nested value.

func GenerateCACert added in v0.6.0

func GenerateCACert(certPath, keyPath string, name string) error

GenerateCACert generates a CA certificate and RSA key for a common name

func GenerateSignedCert added in v0.6.0

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

GenerateSignedCert generates a signed certificate and key

func GetAlternateDNS

func GetAlternateDNS(domain string) []string

GetAlternateDNS returns a list of alternate names for a domain

func GetBinaryDownloadURL added in v0.26.0

func GetBinaryDownloadURL(version, platform string) string

GetBinaryDownloadURL returns a suitable URL for the platform

func GetDNSIP added in v0.24.0

func GetDNSIP(serviceCIDR string) (net.IP, error)

GetDNSIP returns x.x.x.10 of the service CIDR

func GetServiceClusterIP added in v0.24.0

func GetServiceClusterIP(serviceCIDR string) (net.IP, error)

GetServiceClusterIP returns the first IP of the ServiceCIDR

func IsDirectory added in v0.9.0

func IsDirectory(path string) (bool, error)

IsDirectory checks if path is a directory

func MaybeChownDirRecursiveToMinikubeUser added in v0.21.0

func MaybeChownDirRecursiveToMinikubeUser(dir string) error

MaybeChownDirRecursiveToMinikubeUser changes ownership of a dir, if requested

func Pad

func Pad(str string) string

Pad pads the string with newlines

func ReplaceChars added in v1.0.1

func ReplaceChars(src []string, replacer *strings.Replacer) []string

ReplaceChars returns a copy of the src slice with each string modified by the replacer

func TeePrefix added in v0.32.0

func TeePrefix(prefix string, r io.Reader, w io.Writer, logger func(format string, args ...interface{})) error

TeePrefix copies bytes from a reader to writer, logging each new line.

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.

Types

type DefaultDownloader added in v0.16.0

type DefaultDownloader struct{}

DefaultDownloader is the default ISODownloader

func (DefaultDownloader) CacheMinikubeISOFromURL added in v0.16.0

func (f DefaultDownloader) CacheMinikubeISOFromURL(url string) error

CacheMinikubeISOFromURL downloads the ISO, if it doesn't exist in cache

func (DefaultDownloader) GetISOCacheFilepath added in v0.17.0

func (f DefaultDownloader) GetISOCacheFilepath(isoURL string) string

GetISOCacheFilepath returns the path of an ISO in the local cache

func (DefaultDownloader) GetISOFileURI added in v0.16.0

func (f DefaultDownloader) GetISOFileURI(isoURL string) string

GetISOFileURI gets the local destination for a remote source

func (DefaultDownloader) IsMinikubeISOCached added in v0.17.0

func (f DefaultDownloader) IsMinikubeISOCached(isoURL string) bool

IsMinikubeISOCached returns if an ISO exists in the local cache

func (DefaultDownloader) ShouldCacheMinikubeISO added in v0.17.0

func (f DefaultDownloader) ShouldCacheMinikubeISO(isoURL string) bool

ShouldCacheMinikubeISO returns if we need to download the ISO

type ISODownloader added in v0.16.0

type ISODownloader interface {
	GetISOFileURI(isoURL string) string
	CacheMinikubeISOFromURL(isoURL string) error
}

ISODownloader downloads an ISO

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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