backup

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: 17 Imported by: 0

Documentation

Overview

Package backup contains backup operations against etcd.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup

func Backup(endpoint, target, remote, bucket string) (string, error)

Backup iterates over well-known Kubernetes (distro) keys in an etcd server and creates a ZIP archive of the content in the target directory. On success, it returns the backup ID, which is the Unix time encoded point in time the backup operation was started, for example 1498050161. If remote and bucket is provided, the backup will be additional stored in this S3-compatible object store.

Example

Shows how to back up a Kubernetes cluster by specifying the underlying etcd. It assumes that the etcd process is servering on 127.0.0.1:2379.

// define the URL etcd is available at:
etcdurl := "http://127.0.0.1:2379"

// using Minio play, a public S3-compatible sandbox
// for the remote storage available at https://play.minio.io:9000
// and the following credentials which need to be exposed
// as environment variables to the ReShifter process:
_ = os.Setenv("ACCESS_KEY_ID", "Q3AM3UQ867SPQQA43P2F")
_ = os.Setenv("SECRET_ACCESS_KEY", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG")

// carry out the backup of etcd underlying the Kubernetes cluster
// and handle errors as they occur:
backupid, err := Backup(etcdurl, "/tmp", "play.minio.io:9000", "2017-07-some-bucket")
if err != nil {
	log.Fatal(err)
	return
}
fmt.Printf("The backup completed successfully with ID %s\n", backupid)
Output:

The backup completed successfully with ID 1498847078

func List

func List(remote, bucket string) ([]string, error)

List generates a list of available backup IDs. If remote and bucket is provided, the S3-compatible object store will be queried rather than the local work directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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