util

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 31 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCredentials = errors.New("invalid credentials")
)

Functions

func BindParams

func BindParams(params map[string]string, object interface{}) error

bind params uses json serializing and reflect package that is underneath to avoid direct access to map for getting appropriate field values.

func BootstrapKeys

func BootstrapKeys(config *steps.Config) error

Create bootstrap key pair and save to config ssh section

func CreateLBName

func CreateLBName(clusterID string, isExternal bool) string

func FillCloudAccountCredentials

func FillCloudAccountCredentials(cloudAccount *model.CloudAccount, config *steps.Config) error

TODO(stgleb): move getting cloud account outside of this function Gets cloud account from storage and fills config object with those credentials

func GetLogger

func GetLogger(w io.Writer) (log *logrus.Logger)

func GetRandomNode

func GetRandomNode(nodeMap map[string]*model.Machine) *model.Machine

func GetWriter

func GetWriter(name string) (io.WriteCloser, error)

func LoadCloudSpecificDataFromKube

func LoadCloudSpecificDataFromKube(k *model.Kube, config *steps.Config) error

func MakeFileName

func MakeFileName(taskID string) string

func MakeKeyName

func MakeKeyName(name string, isUser bool) string

func MakeNodeName added in v1.0.0

func MakeNodeName(clusterName string, nodeId string, isMaster bool) string

func MakeRole

func MakeRole(isMaster bool) string

func RandomString

func RandomString(n int) string

RandomString generates random string with reservoir sampling algorithm https://en.wikipedia.org/wiki/Reservoir_sampling

func UpdateKubeWithCloudSpecificData

func UpdateKubeWithCloudSpecificData(k *model.Kube, config *steps.Config)

Types

type CloudAccountValidator

type CloudAccountValidator interface {
	ValidateCredentials(cloudAccount *model.CloudAccount) error
}

type CloudAccountValidatorImpl

type CloudAccountValidatorImpl struct {
	// contains filtered or unexported fields
}

func NewCloudAccountValidator

func NewCloudAccountValidator() *CloudAccountValidatorImpl

func (*CloudAccountValidatorImpl) ValidateCredentials

func (v *CloudAccountValidatorImpl) ValidateCredentials(cloudAccount *model.CloudAccount) error

type CountdownLatch

type CountdownLatch struct {
	// contains filtered or unexported fields
}

func NewCountdownLatch

func NewCountdownLatch(ctx context.Context, count int) *CountdownLatch

func (*CountdownLatch) CountDown

func (c *CountdownLatch) CountDown()

CountDown decrements the counter

func (*CountdownLatch) Wait

func (c *CountdownLatch) Wait()

Wait until count down to zero or if context is done

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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