v1

package
v0.0.0-...-395ddcd Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Overview

Package v1 contains version 1 of the custom resource definitions

+k8s:deepcopy-gen=package +groupName=backup.nect.com

Index

Constants

View Source
const (
	// GroupName defines the group name of this API package
	GroupName = "backup.nect.com"
	// GroupVersion defines the current group version of this package
	GroupVersion = "v1"
)

Variables

View Source
var (
	// SchemeBuilder contains a runtime.SchemeBuilder with types
	// available in this api package
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme contains the AddToScheme function of the SchemeBuilder
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}

SchemeGroupVersion contains a schema GroupVersion of the exported GroupName and GroupVersion in this api package

Functions

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type CockroachConfig

type CockroachConfig struct {
	// Database specifies the database to be backed up
	Database string `json:"database"`
	// Host specifies the IP or DNS name to connect to
	Host string `json:"host"`
	// Port specifies the port the database is listening on (usually 3306)
	Port int64 `json:"port"`
	// User specifies the user to use for connection
	User string `json:"user"`

	// Cert is the client certificate used to authenticate against CRDB
	Cert Secret `json:"cert"`
	// TLSCertCA specifies the CA certificate and should be specified
	// as reference to a key in a secret if CA is managed as a secret
	//
	// +kubebuilder:validation:Optional
	CertCA Secret `json:"certCA"`
	// CertCAFromCluster specifies the cluster certificate should be
	// used instead of the certCA provided certificate. If this is set
	// to true the certCA key will be ignored.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:default=false
	CertCAFromCluster bool `json:"certCAFromCluster"`
	// CertKey is the private key for the given client certificate
	CertKey Secret `json:"certKey"`
}

CockroachConfig contains the values required for the backup-engine to backup a single database on a Cockroach server

+kubebuilder:object:generate=true

func (*CockroachConfig) DeepCopy

func (in *CockroachConfig) DeepCopy() *CockroachConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CockroachConfig.

func (*CockroachConfig) DeepCopyInto

func (in *CockroachConfig) DeepCopyInto(out *CockroachConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DatabaseBackup

type DatabaseBackup struct {
	metav1.TypeMeta   `json:",inline"` //revive:disable-line:struct-tag // "inline" is valid
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DatabaseBackupSpec   `json:"spec"`
	Status DatabaseBackupStatus `json:"status,omitempty"`
}

DatabaseBackup contains the Kubernetes document for the DatabaseBackupSpec

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status

func (*DatabaseBackup) DeepCopy

func (in *DatabaseBackup) DeepCopy() *DatabaseBackup

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackup.

func (*DatabaseBackup) DeepCopyInto

func (in *DatabaseBackup) DeepCopyInto(out *DatabaseBackup)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseBackup) DeepCopyObject

func (in *DatabaseBackup) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatabaseBackupList

type DatabaseBackupList struct {
	metav1.TypeMeta `json:",inline"` //revive:disable-line:struct-tag // "inline" is valid
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []DatabaseBackup `json:"items"`
}

DatabaseBackupList contains a list of DatabaseBackup

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*DatabaseBackupList) DeepCopy

func (in *DatabaseBackupList) DeepCopy() *DatabaseBackupList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackupList.

func (*DatabaseBackupList) DeepCopyInto

func (in *DatabaseBackupList) DeepCopyInto(out *DatabaseBackupList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseBackupList) DeepCopyObject

func (in *DatabaseBackupList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatabaseBackupSpec

type DatabaseBackupSpec struct {
	// DatabaseType specifies the type of the database to be backed up.
	// This changes the behaviour of the backup engine used in the
	// background and needs to match the provisioned database.
	//
	// +kubebuilder:validation:Enum={cockroach, mysql, postgres}
	DatabaseType string `json:"databaseType"`

	// DatabaseVersion is an arbitrary string the database driver uses
	// to determine how to handle the exact version of the database.
	// This for example is used to handle the different approaches used
	// by Cockroach v21 and v23.
	//
	// +kubebuilder:validation:Optional
	DatabaseVersion string `json:"databaseVersion"`

	// BackupStorageClass defines where to store the backups (must
	// exist before)
	BackupStorageClass string `json:"backupStorageClass"`

	// BackupCron specifies a cron entry (5 fields) when to execute
	// the backup runs. If set to other than empty string will
	// override the BackupInterval
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Pattern=`((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5})`
	BackupCron string `json:"backupCron"`
	// BackupIntervalHours is a simpler method of specifying the
	// backup schedule: The process will wait for the current time
	// to be divisible by the given interval. (i.e. if you specify
	// 2h the backup will run 00:00, 02:00, 04:00, ...)
	//
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Optional
	BackupIntervalHours int64 `json:"backupInterval"`
	// RetentionConfig defines the retention rules applied to store
	// old copies of the backup in case generation-principle backups
	// are enabled. If left to nil the default retention config is
	// used
	//
	// +kubebuilder:validation:Optional
	RetentionConfig labelmanager.RetentionConfig `json:"retentionConfig"`
	// UseSingleBackupTarget defines whether to upload in the same
	// place all the time (S3 server then needs to take care of
	// rotating / revisioning backup file and backup can only restore
	// this single instance, not to a point in time) or whether to
	// use generation principle backups and treat the storage target
	// as a prefix.
	//
	// +kubebuilder:default=false
	// +kubebuilder:validation:Optional
	UseSingleBackupTarget bool `json:"useSingleBackupTarget"`

	// Cockroach defines the required values for a Cockroach backup
	//
	// +kubebuilder:validation:Optional
	Cockroach *CockroachConfig `json:"cockroach,omitempty"`
	// MySQL defines the required values for a MySQL backup
	//
	// +kubebuilder:validation:Optional
	MySQL *MySQLConfig `json:"mysql,omitempty"`
	// Postgres defines the required values for a PostgreSQL backup
	//
	// +kubebuilder:validation:Optional
	Postgres *PostgresConfig `json:"postgres,omitempty"`
}

DatabaseBackupSpec describes how the backup of the database should look and how to connect to the database

+kubebuilder:object:generate=true

func (*DatabaseBackupSpec) DeepCopy

func (in *DatabaseBackupSpec) DeepCopy() *DatabaseBackupSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackupSpec.

func (*DatabaseBackupSpec) DeepCopyInto

func (in *DatabaseBackupSpec) DeepCopyInto(out *DatabaseBackupSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseBackupSpec) FetchSecrets

func (d *DatabaseBackupSpec) FetchSecrets(ctx context.Context, client kubernetes.Interface, namespace string) error

FetchSecrets iterates through all Secret resources inside the spec and pulls their values from the original locations into the local instance

type DatabaseBackupStatus

type DatabaseBackupStatus struct {
	// Collection of conditions
	Conditions []metav1.Condition `json:"conditions"`
	// Last applied hash of the created resources for comparison of a
	// generated update
	//
	// +kubebuilder:validation:Optional
	Hash string `json:"hash,omitempty"`
}

DatabaseBackupStatus represents a status of a DatabaseBackup resource

func (*DatabaseBackupStatus) CalculateReady

func (d *DatabaseBackupStatus) CalculateReady(generation int64)

CalculateReady takes all known conditions into account and checks whether they are fine. From all those conditions the overall "Ready" condition is set

func (*DatabaseBackupStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackupStatus.

func (*DatabaseBackupStatus) DeepCopyInto

func (in *DatabaseBackupStatus) DeepCopyInto(out *DatabaseBackupStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseBackupStatus) Init

func (d *DatabaseBackupStatus) Init(generation int64)

Init initializes a new "not ready" status object

func (*DatabaseBackupStatus) Set

func (d *DatabaseBackupStatus) Set(condType DatabaseBackupStatusCondition, generation int64, status metav1.ConditionStatus, reason, message string)

Set replaces the status condition if the status changed and re-calculates the overall Ready status

type DatabaseBackupStatusCondition

type DatabaseBackupStatusCondition string

DatabaseBackupStatusCondition is an enum of available status conditions for the DatabaseBackupStatus

const (
	// ConditionSecretExists represents the status condition whether the secret was created successfully
	ConditionSecretExists DatabaseBackupStatusCondition = "db-backup.nect.com/secretExists" //#nosec:G101 -- That's not a credential
	// ConditionServiceExists represents the status condition whether the service was created successfully
	ConditionServiceExists DatabaseBackupStatusCondition = "db-backup.nect.com/serviceExists"
	// ConditionSTSExists represents the status condition whether the sts was created successfully
	ConditionSTSExists DatabaseBackupStatusCondition = "db-backup.nect.com/stsExists"
)

type DatabaseBackupStorageClass

type DatabaseBackupStorageClass struct {
	metav1.TypeMeta   `json:",inline"` //revive:disable-line:struct-tag // "inline" is valid
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec DatabaseBackupStorageClassSpec `json:"spec"`
}

DatabaseBackupStorageClass contains the Kubernetes document for the DatabaseBackupStorageClassSpec

+genclient +genclient:nonNamespaced +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:resource:scope=Cluster

func (*DatabaseBackupStorageClass) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackupStorageClass.

func (*DatabaseBackupStorageClass) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseBackupStorageClass) DeepCopyObject

func (in *DatabaseBackupStorageClass) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatabaseBackupStorageClassList

type DatabaseBackupStorageClassList struct {
	metav1.TypeMeta `json:",inline"` //revive:disable-line:struct-tag // "inline" is valid
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []DatabaseBackupStorageClass `json:"items"`
}

DatabaseBackupStorageClassList contains a list of DatabaseBackupStorageClass

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:resource:scope=Cluster

func (*DatabaseBackupStorageClassList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackupStorageClassList.

func (*DatabaseBackupStorageClassList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseBackupStorageClassList) DeepCopyObject

func (in *DatabaseBackupStorageClassList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatabaseBackupStorageClassSpec

type DatabaseBackupStorageClassSpec struct {
	// BackupLocations defines a number of locations the backups
	// written to this DatabaseBackupStorageClass should be uploaded
	// to.
	//
	// +kubebuilder:validation:MinItems=1
	BackupLocations []DatabaseBackupStorageLocation `json:"backupLocations"`
}

DatabaseBackupStorageClassSpec contains a list of locations to write the backups to when using this DatabaseBackupStorageClass

+kubebuilder:object:generate=true

func (*DatabaseBackupStorageClassSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackupStorageClassSpec.

func (*DatabaseBackupStorageClassSpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseBackupStorageClassSpec) FetchSecrets

func (d *DatabaseBackupStorageClassSpec) FetchSecrets(ctx context.Context, client kubernetes.Interface, namespace string) error

FetchSecrets iterates through all Secret resources inside the spec and pulls their values from the original locations into the local instance

type DatabaseBackupStorageLocation

type DatabaseBackupStorageLocation struct {
	// StorageType defines which storage engine to load for this
	// storage location
	//
	// +kubebuilder:validation:Enum={s3}
	StorageType string `json:"storageType"`

	// StorageEndpoint defines the MinIO / S3 endpoint to connect to
	StorageEndpoint string `json:"storageEndpoint"`
	// StorageAccessKeyID and StorageSecretAccessKey define the
	// credentials to access the StorageBucket
	StorageAccessKeyID     Secret `json:"storageAccessKeyID"`
	StorageSecretAccessKey Secret `json:"storageSecretAccessKey"`
	// StorageBucket defines to which bucket to upload the files
	StorageBucket string `json:"storageBucket"`
	// StorageLocation defines the location the bucket exists in
	// (i.e. "minio", "eu-west-1", ...)
	StorageLocation string `json:"storageLocation"`
	// StorageUseSSL defines whether to use TLS encrypted connection
	// to storage
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:default=false
	StorageUseSSL bool `json:"storageUseSSL"`
	// StorageInsecureSkipVerify defines whether to skip TLS cert
	// verify as of unknown CA / ...
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:default=false
	StorageInsecureSkipVerify bool `json:"storageInsecureSkipVerify"`

	// EncryptionPass defines the passphrase to be used to encrypt the
	// backup before writing it to the storage server specified in this
	// location. Leaving this empty will DISABLE encryption!
	//
	// +kubebuilder:validation:Optional
	EncryptionPass Secret `json:"encryptionPass"`
}

DatabaseBackupStorageLocation describes how to connect to the storage location for uploading the backup

+kubebuilder:object:generate=true

func (*DatabaseBackupStorageLocation) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseBackupStorageLocation.

func (*DatabaseBackupStorageLocation) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MySQLConfig

type MySQLConfig struct {
	// Database specifies the database to be backed up
	Database string `json:"database"`
	// Host specifies the IP or DNS name to connect to
	Host string `json:"host"`
	// Pass specifies a reference to or the value of the users password
	Pass Secret `json:"pass"`
	// Port specifies the port the database is listening on (usually 3306)
	Port int64 `json:"port"`
	// User specifies the user or a reference to it to use for connection
	User Secret `json:"user"`
}

MySQLConfig contains the values required for the backup-engine to backup a single database on a MySQL server

+kubebuilder:object:generate=true

func (*MySQLConfig) DeepCopy

func (in *MySQLConfig) DeepCopy() *MySQLConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MySQLConfig.

func (*MySQLConfig) DeepCopyInto

func (in *MySQLConfig) DeepCopyInto(out *MySQLConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PostgresConfig

type PostgresConfig struct {
	// Database specifies the database to be backed up
	Database string `json:"database"`
	// Host specifies the IP or DNS name to connect to
	Host string `json:"host"`
	// Port specifies the port the database is listening on (usually 3306)
	Port int64 `json:"port"`
	// User specifies the user or a reference to it to use for connection
	User string `json:"user"`
	// Pass specifies a reference to or the value of the users password
	Pass Secret `json:"pass"`
}

PostgresConfig contains the values required for the backup-engine to backup a single database on a Postgres server

+kubebuilder:object:generate=true

func (*PostgresConfig) DeepCopy

func (in *PostgresConfig) DeepCopy() *PostgresConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresConfig.

func (*PostgresConfig) DeepCopyInto

func (in *PostgresConfig) DeepCopyInto(out *PostgresConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Secret

type Secret struct {
	// Value specifies a plain text value for the secret. When filled
	// this will prevent the lookup of the FromSecret reference.
	//
	// +kubebuilder:validation:Optional
	Value string `json:"value"`
	// FromSecret references a secret to fetch the value from
	//
	// +kubebuilder:validation:Optional
	FromSecret SecretKeyRef `json:"fromSecret"`
}

Secret contains an optional Value or reference to fetch the value FromSecret

func (*Secret) CopyFromSecret

func (s *Secret) CopyFromSecret(ctx context.Context, client kubernetes.Interface, namespace string) error

CopyFromSecret fetches the secret given in the reference and copies the content of the key into the Value

func (*Secret) DeepCopy

func (in *Secret) DeepCopy() *Secret

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret.

func (*Secret) DeepCopyInto

func (in *Secret) DeepCopyInto(out *Secret)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SecretKeyRef

type SecretKeyRef struct {
	// Name specifies the name of the secret to fetch the value from.
	// Must exist in the same namespace as the resource
	Name string `json:"name"`
	// Key specifies the key within the refereced secret to fetch the
	// value from
	Key string `json:"key"`
}

SecretKeyRef contains information where to find the Secret information when fetching from cluster

func (*SecretKeyRef) DeepCopy

func (in *SecretKeyRef) DeepCopy() *SecretKeyRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeyRef.

func (*SecretKeyRef) DeepCopyInto

func (in *SecretKeyRef) DeepCopyInto(out *SecretKeyRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳