snapshot

package
v1.31.3-0...-b1489ee Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessfulStatus SnapshotStatus = "successful"
	FailedStatus     SnapshotStatus = "failed"

	CompressedExtension = ".zip"
	MetadataDir         = ".metadata"
)

Variables

View Source
var (
	InvalidKeyChars = regexp.MustCompile(`[^-._a-zA-Z0-9]`)

	LabelStorageNode    = "etcd." + version.Program + ".cattle.io/snapshot-storage-node"
	AnnotationTokenHash = "etcd." + version.Program + ".cattle.io/snapshot-token-hash"

	ExtraMetadataConfigMapName = version.Program + "-etcd-snapshot-extra-metadata"
)

Functions

func IsNotExist

func IsNotExist(err error) bool

IsNotExist returns true if the error is from http.StatusNotFound or os.IsNotExist

Types

type File

type File struct {
	Name string `json:"name"`
	// Location contains the full path of the snapshot. For
	// local paths, the location will be prefixed with "file://".
	Location   string         `json:"location,omitempty"`
	Metadata   string         `json:"metadata,omitempty"`
	Message    string         `json:"message,omitempty"`
	NodeName   string         `json:"nodeName,omitempty"`
	CreatedAt  *metav1.Time   `json:"createdAt,omitempty"`
	Size       int64          `json:"size,omitempty"`
	Status     SnapshotStatus `json:"status,omitempty"`
	S3         *S3Config      `json:"s3Config,omitempty"`
	Compressed bool           `json:"compressed"`

	// these fields are used for the internal representation of the snapshot
	// to populate other fields before serialization to the legacy configmap.
	MetadataSource *v1.ConfigMap `json:"-"`
	NodeSource     string        `json:"-"`
	TokenHash      string        `json:"-"`
}

File represents a single snapshot and it's metadata.

func (*File) FromETCDSnapshotFile

func (sf *File) FromETCDSnapshotFile(esf *k8e.ETCDSnapshotFile)

FromETCDSnapshotFile translates fields to the File from the ETCDSnapshotFile

func (*File) GenerateConfigMapKey

func (sf *File) GenerateConfigMapKey() string

GenerateConfigMapKey generates a derived name for the snapshot that is safe for use as a configmap key.

func (*File) GenerateName

func (sf *File) GenerateName() string

GenerateName generates a derived name for the snapshot that is safe for use as a resource name.

func (*File) Marshal

func (sf *File) Marshal() ([]byte, error)

Marshal returns the JSON encoding of the snapshot File, with metadata inlined as base64.

func (*File) ToETCDSnapshotFile

func (sf *File) ToETCDSnapshotFile(esf *k8e.ETCDSnapshotFile)

ToETCDSnapshotFile translates fields from the File to the ETCDSnapshotFile

type S3Config

type S3Config struct {
	config.EtcdS3
	// Mask these fields in the embedded struct to avoid serializing their values in the snapshotFile record
	AccessKey    string          `json:"accessKey,omitempty"`
	ConfigSecret string          `json:"configSecret,omitempty"`
	Proxy        string          `json:"proxy,omitempty"`
	SecretKey    string          `json:"secretKey,omitempty"`
	Timeout      metav1.Duration `json:"timeout,omitempty"`
}

type SnapshotStatus

type SnapshotStatus string

Jump to

Keyboard shortcuts

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