util

package
v0.3.22-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package util contains various helper functions for ReShifter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CACertFromEnv

func CACertFromEnv() (string, error)

CACertFromEnv loads the CA cert filepath from the respective environment variable RS_ETCD_CA_CERT.

func Certsdir

func Certsdir() string

Certsdir returns the absolute path to the directory where the pre-generated certs and keys are.

func ClientCertAndKeyFromEnv

func ClientCertAndKeyFromEnv() (string, string, error)

ClientCertAndKeyFromEnv loads the client cert and key filepaths from the respective environment variables RS_ETCD_CLIENT_CERT and RS_ETCD_CLIENT_KEY.

func EtcdDown

func EtcdDown() error

EtcdDown tears down an etcd server.

func ExternalIP

func ExternalIP() (string, error)

ExternalIP retrieves the public IP of the host ReShifter is running on, adapted from: https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go

func IsBackupID

func IsBackupID(id string) bool

IsBackupID tests if a string is a valid backup ID. A valid backup ID is a 10 digit integer, representing a Unix timestamp, for example, 1499588813.

func LaunchEtcd2

func LaunchEtcd2(tetcd, port string) (bool, error)

LaunchEtcd2 launches etcd in v2 on port, either in secure or in insecure mode, depending on the scheme used in tetcd.

func LaunchEtcd3

func LaunchEtcd3(tetcd, port string) (bool, error)

LaunchEtcd3 launches etcd in v3 on port, either in secure or in insecure mode, depending on the scheme used in tetcd.

func LookupDistro

func LookupDistro(distrotype types.KubernetesDistro) string

LookupDistro returns a textual description for a Kube distro by type.

func NewClient2

func NewClient2(endpoint string, secure bool) (client.Client, error)

NewClient2 creates an etcd2 client, optionally using SSL/TLS if secure is true. The endpoint is an URL such as http://localhost:2379.

func NewClient3

func NewClient3(endpoint string, secure bool) (*clientv3.Client, error)

NewClient3 creates an etcd3 client, optionally using SSL/TLS if secure is true. The endpoint is an URL such as http://localhost:2379.

func S3CredFromEnv

func S3CredFromEnv() (string, string, error)

S3CredFromEnv loads S3 access key and secret from the respective environment variable ACCESS_KEY_ID and SECRET_ACCESS_KEY.

func SetKV2

func SetKV2(kapi client.KeysAPI, key, val string) error

SetKV2 sets the key with val in an etcd2 cluster and iff val is empty, creates a directory key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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