api

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelKeyCloud label key used for cloud information
	LabelKeyCloud = "pipeline-cloud"
	// LabelKeyDistribution label key used for distribution information
	LabelKeyDistribution = "pipeline-distribution"
	// LabelKeyNodeCount label key is used for node count
	LabelKeyNodeCount = "pipeline-nodecount"
)
View Source
const (
	BaseScheduleName = "cluster-backup"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureBucketProperties

type AzureBucketProperties struct {
	StorageAccount string `json:"storageAccount,omitempty"`
	ResourceGroup  string `json:"resourceGroup,omitempty"`
}

AzureObjectStoreBucketProperties describes bucket properties for an Azure ObjectStore Container

type AzureCluster

type AzureCluster interface {
	Cluster
	GetResourceGroupName() string
}

type Backup

type Backup struct {
	ID           uint            `json:"id"`
	UID          string          `json:"uid"`
	Name         string          `json:"name"`
	TTL          metav1.Duration `json:"ttl"`
	Labels       labels.Set      `json:"labels"`
	Cloud        string          `json:"cloud"`
	Distribution string          `json:"distribution"`
	Options      BackupOptions   `json:"options,omitempty"`
	Status       string          `json:"status"`
	StartAt      time.Time       `json:"startAt"`
	ExpireAt     time.Time       `json:"expireAt"`
	// not available anymore in status
	// VolumeBackups    map[string]*arkAPI.VolumeBackupInfo `json:"volumeBackups,omitempty"`
	ValidationErrors []string `json:"validationErrors,omitempty"`

	ClusterID       uint    `json:"clusterId,omitempty"`
	ActiveClusterID uint    `json:"activeClusterId,omitempty"`
	Bucket          *Bucket `json:"-"`
}

Backup describes an ARK backup

type BackupOptions

type BackupOptions struct {
	// IncludedNamespaces is a slice of namespace names to include objects
	// from. If empty, all namespaces are included.
	IncludedNamespaces []string `json:"includedNamespaces,omitempty"`

	// ExcludedNamespaces contains a list of namespaces that are not
	// included in the backup.
	ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`

	// IncludedResources is a slice of resource names to include
	// in the backup. If empty, all resources are included.
	IncludedResources []string `json:"includedResources,omitempty"`

	// ExcludedResources is a slice of resource names that are not
	// included in the backup.
	ExcludedResources []string `json:"excludedResources,omitempty"`

	// LabelSelector is a metav1.LabelSelector to filter with
	// when adding individual objects to the backup. If empty
	// or nil, all objects are included. Optional.
	LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`

	// SnapshotVolumes specifies whether to take cloud snapshots
	// of any PV's referenced in the set of objects included
	// in the Backup.
	SnapshotVolumes *bool `json:"snapshotVolumes,omitempty"`

	// IncludeClusterResources specifies whether cluster-scoped resources
	// should be included for consideration in the backup.
	IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
}

BackupOptions defines options specification for an Ark backup

func (*BackupOptions) UnmarshalJSON

func (bo *BackupOptions) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom JSON unmarshal function for labelSelector parsing

type Bucket

type Bucket struct {
	ID       uint   `json:"id"`
	Name     string `json:"name"`
	Prefix   string `json:"prefix"`
	Cloud    string `json:"cloud"`
	SecretID string `json:"secretId"`
	Location string `json:"location,omitempty"`
	AzureBucketProperties
	Status              string `json:"status"`
	InUse               bool   `json:"inUse"`
	DeploymentID        uint   `json:"deploymentId,omitempty"`
	ClusterID           uint   `json:"clusterId,omitempty"`
	ClusterCloud        string `json:"clusterCloud,omitempty"`
	ClusterDistribution string `json:"clusterDistribution,omitempty"`
}

Bucket describes a Bucket used for ARK backups

type Cluster

type Cluster interface {
	GetID() uint
	GetName() string
	GetOrganizationId() uint
	GetCloud() string
	GetDistribution() string
	GetK8sConfig() ([]byte, error)
	GetSecretWithValidation() (*secret.SecretItemResponse, error)
	GetLocation() string
	RbacEnabled() bool
	GetStatus() (*pkgCluster.GetClusterStatusResponse, error)
}

Cluster interface for cluster implementations

type ClusterManager

type ClusterManager interface {
	GetClusters(context.Context, uint) ([]Cluster, error)
}

ClusterManager interface for getting clusters

type CreateBackupRequest

type CreateBackupRequest struct {
	Name    string          `json:"name" binding:"required"`
	TTL     metav1.Duration `json:"ttl" binding:"required"`
	Labels  labels.Set      `json:"labels"`
	Options BackupOptions   `json:"options"`
}

CreateBackupRequest descibes a create backup request

type CreateBackupResponse

type CreateBackupResponse struct {
	Name   string `json:"name"`
	Status int    `json:"status"`
}

CreateBackupResponse describes a create backup response

type CreateBucketRequest

type CreateBucketRequest struct {
	Cloud      string `json:"cloud" binding:"required"`
	BucketName string `json:"bucketName" binding:"required"`
	Prefix     string `json:"prefix"`
	SecretID   string `json:"secretId" binding:"required"`
	Location   string `json:"location"`

	AzureBucketProperties `json:"azure"`
}

CreateBucketRequest describes create bucket request

type CreateRestoreRequest

type CreateRestoreRequest struct {
	BackupName string         `json:"backupName" binding:"required"`
	Labels     labels.Set     `json:"labels"`
	Options    RestoreOptions `json:"options"`
}

CreateRestoreRequest describes a create restore request

type CreateRestoreResponse

type CreateRestoreResponse struct {
	Restore *Restore `json:"restore"`
	Status  int      `json:"status"`
}

CreateRestoreResponse describes a create restore response

type CreateScheduleRequest

type CreateScheduleRequest struct {
	Name     string          `json:"name" binding:"required"`
	TTL      metav1.Duration `json:"ttl" binding:"required"`
	Schedule string          `json:"schedule" binding:"required"`
	Labels   labels.Set      `json:"labels"`
	Options  BackupOptions   `json:"options"`
}

CreateScheduleRequest describes a create schedule request

type CreateScheduleResponse

type CreateScheduleResponse struct {
	Name   string `json:"name"`
	Status int    `json:"status"`
}

CreateScheduleResponse describes a create schedule response

type DeleteBackupResponse

type DeleteBackupResponse struct {
	ID     uint `json:"id"`
	Status int  `json:"status"`
}

DeleteBackupResponse describes a delete backup response

type DeleteBucketResponse

type DeleteBucketResponse struct {
	ID     uint `json:"id"`
	Status int  `json:"status"`
}

DeleteBucketResponse describes a delete bucket response

type DeleteRestoreResponse

type DeleteRestoreResponse struct {
	ID     uint `json:"id"`
	Status int  `json:"status"`
}

DeleteRestoreResponse describes a delete restore response

type DeleteScheduleResponse

type DeleteScheduleResponse struct {
	Name   string `json:"name"`
	Status int    `json:"status"`
}

DeleteScheduleResponse describes a delete schedule response

type DisableBackupServiceResponse

type DisableBackupServiceResponse struct {
	Status int `json:"status"`
}

DisableBackupServiceResponse describes Pipeline's DisableBackupServiceRequest API response

type EnableBackupServiceRequest

type EnableBackupServiceRequest struct {
	CreateBucketRequest

	Schedule              string            `json:"schedule" binding:"required"`
	TTL                   string            `json:"ttl" binding:"required"`
	Labels                map[string]string `json:"labels,omitempty"`
	Options               BackupOptions     `json:"options,omitempty"`
	UseClusterSecret      bool              `json:"useClusterSecret,omitempty"`
	ServiceAccountRoleARN string            `json:"serviceAccountRoleARN,omitempty"`
	UseProviderSecret     bool              `json:"useProviderSecret,omitempty"`
}

EnableBackupServiceRequest describes an ARK service deployment request

type EnableBackupServiceResponse

type EnableBackupServiceResponse struct {
	Status int `json:"status"`
}

EnableBackupServiceResponse describes Pipeline's EnableBackupServiceRequest API response

type FindBucketRequest

type FindBucketRequest struct {
	Cloud      string
	BucketName string
	Location   string
}

FindBucketRequest describes a find bucket request

type PersistBackupRequest

type PersistBackupRequest struct {
	BucketID uint

	Cloud          string
	Distribution   string
	NodeCount      uint
	ContentChecked bool

	ClusterID    uint
	DeploymentID uint

	Nodes  *core.NodeList
	Backup *arkAPI.Backup
}

PersistBackupRequest describes a backup persisting request

func (*PersistBackupRequest) ExtendFromLabels

func (req *PersistBackupRequest) ExtendFromLabels()

ExtendFromLabels used for set information to the request from the labels of the Backup

type PersistDeploymentRequest

type PersistDeploymentRequest struct {
	BucketID    uint
	RestoreMode bool
	Name        string
	Namespace   string
}

PersistDeploymentRequest describes an ARK deployment persisting request

type PersistRestoreRequest

type PersistRestoreRequest struct {
	BucketID  uint
	ClusterID uint

	Results *RestoreResults
	Restore *arkAPI.Restore
}

PersistRestoreRequest describes a persist restore request

type Restore

type Restore struct {
	ID               uint           `json:"id"`
	UID              string         `json:"uid"`
	Name             string         `json:"name"`
	BackupName       string         `json:"backupName"`
	Status           string         `json:"status"`
	Warnings         uint           `json:"warnings"`
	Errors           uint           `json:"errors"`
	ValidationErrors []string       `json:"validationErrors,omitempty"`
	Options          RestoreOptions `json:"options,omitempty"`

	Results *RestoreResults `json:"-"`
	Bucket  *Bucket         `json:"-"`
}

Restore describes an ARK restore

type RestoreOptions

type RestoreOptions struct {
	// IncludedNamespaces is a slice of namespace names to include objects
	// from. If empty, all namespaces are included.
	IncludedNamespaces []string `json:"includedNamespaces,omitempty"`

	// ExcludedNamespaces contains a list of namespaces that are not
	// included in the restore.
	ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`

	// IncludedResources is a slice of resource names to include
	// in the restore. If empty, all resources in the backup are included.
	IncludedResources []string `json:"includedResources,omitempty"`

	// ExcludedResources is a slice of resource names that are not
	// included in the restore.
	ExcludedResources []string `json:"excludedResources,omitempty"`

	// NamespaceMapping is a map of source namespace names
	// to target namespace names to restore into. Any source
	// namespaces not included in the map will be restored into
	// namespaces of the same name.
	NamespaceMapping map[string]string `json:"namespaceMapping,omitempty"`

	// LabelSelector is a metav1.LabelSelector to filter with
	// when restoring individual objects from the backup. If empty
	// or nil, all objects are included. Optional.
	LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`

	// RestorePVs specifies whether to restore all included
	// PVs from snapshot (via the cloudprovider).
	RestorePVs *bool `json:"restorePVs,omitempty"`

	// IncludeClusterResources specifies whether cluster-scoped resources
	// should be included for consideration in the restore. If null, defaults
	// to true.
	IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
}

RestoreOptions defines options specification for an Ark restore

type RestoreResults

type RestoreResults map[string]pkgrestore.Result

RestoreResults describes a restore results

type Schedule

type Schedule struct {
	UID              string          `json:"uid"`
	Name             string          `json:"name"`
	Schedule         string          `json:"schedule"`
	TTL              metav1.Duration `json:"ttl"`
	Labels           labels.Set      `json:"labels"`
	Options          BackupOptions   `json:"options,omitempty"`
	Status           string          `json:"status"`
	LastBackup       time.Time       `json:"lastBackup"`
	ValidationErrors []string        `json:"validationErrors,omitempty"`
}

Schedule describes an ARK schedule

type Service

type Service interface {
	// Activate activates a integrated service.
	Activate(ctx context.Context, clusterID uint, serviceName string, spec map[string]interface{}) error

	// Deactivate deactivates a integrated service.
	Deactivate(ctx context.Context, clusterID uint, serviceName string) error
}

Service manages integrated services on Kubernetes clusters.

Jump to

Keyboard shortcuts

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