Documentation ¶
Overview ¶
Package v1 contains API Schema definitions for the database v1 API group +kubebuilder:object:generate=true +groupName=database.fits.cloud
Index ¶
- Constants
- Variables
- type AccessList
- type BackupConfig
- type Postgres
- func (p *Postgres) AddFinalizer(finalizerName string)
- func (in *Postgres) DeepCopy() *Postgres
- func (in *Postgres) DeepCopyInto(out *Postgres)
- func (in *Postgres) DeepCopyObject() runtime.Object
- func (p *Postgres) HasFinalizer(finalizerName string) bool
- func (p *Postgres) HasSourceRanges() bool
- func (p *Postgres) IsBeingDeleted() bool
- func (p *Postgres) IsReplicationPrimary() bool
- func (p *Postgres) RemoveFinalizer(finalizerName string)
- func (p *Postgres) ToBackupSecretName() string
- func (p *Postgres) ToCWNP(port int) (*firewall.ClusterwideNetworkPolicy, error)
- func (p *Postgres) ToKey() *types.NamespacedName
- func (p *Postgres) ToPeripheralResourceLookupKey() types.NamespacedName
- func (p *Postgres) ToPeripheralResourceName() string
- func (p *Postgres) ToPeripheralResourceNamespace() string
- func (p *Postgres) ToStandbyClusterEgresCWNPName() string
- func (p *Postgres) ToStandbyClusterEgressCWNP() (*firewall.ClusterwideNetworkPolicy, error)
- func (p *Postgres) ToStandbyClusterIngresCWNPName() string
- func (p *Postgres) ToStandbyClusterIngressCWNP(sourceCIDRs []string) (*firewall.ClusterwideNetworkPolicy, error)
- func (p *Postgres) ToSvcLB(lbIP string, lbPort int32) *corev1.Service
- func (p *Postgres) ToSvcLBName() string
- func (p *Postgres) ToSvcLBNamespacedName() *types.NamespacedName
- func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *corev1.ConfigMap, sc string, ...) (*unstructured.Unstructured, error)
- func (p *Postgres) ToUserPasswordSecretMatchingLabels() map[string]string
- func (p *Postgres) ToUserPasswordsSecret(src *corev1.SecretList, scheme *runtime.Scheme) (*corev1.Secret, error)
- func (p *Postgres) ToUserPasswordsSecretListOption() []client.ListOption
- func (p *Postgres) ToUserPasswordsSecretName() string
- func (p *Postgres) ToZalandoPostgresqlMatchingLabels() client.MatchingLabels
- type PostgresConnection
- type PostgresList
- type PostgresRestore
- type PostgresSpec
- type PostgresStatus
- type Size
- type Socket
Constants ¶
const ( // UIDLabelName Name of the label referencing the owning Postgres resource uid in the control cluster UIDLabelName string = "postgres.database.fits.cloud/uid" // NameLabelName Name of the label referencing the owning Postgres resource name in the control cluster (which might not be unique) NameLabelName string = "postgres.database.fits.cloud/name" // TenantLabelName Name of the tenant label TenantLabelName string = "postgres.database.fits.cloud/tenant" // ProjectIDLabelName Name of the ProjectID label ProjectIDLabelName string = "postgres.database.fits.cloud/project-id" // ManagedByLabelName Name of the managed-by label ManagedByLabelName string = "postgres.database.fits.cloud/managed-by" // ManagedByLabelValue Value of the managed-by label ManagedByLabelValue string = "postgreslet" // PostgresFinalizerName Name of the finalizer to use PostgresFinalizerName string = "postgres.finalizers.database.fits.cloud" // CreatedByAnnotationKey is used to store who in person created this database CreatedByAnnotationKey string = "postgres.database.fits.cloud/created-by" // BackupConfigLabelName if set to true, this secret stores the backupConfig BackupConfigLabelName string = "postgres.database.fits.cloud/is-backup" // BackupConfigKey defines the key under which the BackupConfig is stored in the data map. BackupConfigKey = "config" SharedBufferParameterKey = "shared_buffers" // StandbyKey defines the key under which the standby configuration is stored in the CR. Defined by the postgres-operator/patroni StandbyKey = "standby" StandbyMethod = "streaming_host" DefaultPatroniParamValueLoopWait uint32 = 10 DefaultPatroniParamValueRetryTimeout uint32 = 60 )
Variables ¶
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "database.fits.cloud", Version: "v1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
var SvcLoadBalancerLabel = map[string]string{ ManagedByLabelName: ManagedByLabelValue, }
var (
ZalandoPostgresqlTypeMeta = metav1.TypeMeta{
APIVersion: "acid.zalan.do/v1",
Kind: "postgresql",
}
)
Functions ¶
This section is empty.
Types ¶
type AccessList ¶
type AccessList struct { // SourceRanges defines a list of prefixes in CIDR Notation e.g. 1.2.3.0/24 or fdaa::/104 SourceRanges []string `json:"sourceRanges,omitempty"` }
AccessList defines the type of restrictions to access the database
func (*AccessList) DeepCopy ¶
func (in *AccessList) DeepCopy() *AccessList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessList.
func (*AccessList) DeepCopyInto ¶
func (in *AccessList) DeepCopyInto(out *AccessList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type BackupConfig ¶
type BackupConfig struct { // ID of this backupConfig ID string `json:"id"` // Name is a user defined description Name string `json:"name"` // ProjectID the project this backup is mapped to ProjectID string `json:"project"` // Tenant the tenant of the backup Tenant string `json:"tenant"` // CreatedBy is the name of the person or technical account which created this backupConfig CreatedBy string `json:"createdBy"` // Retention defines how many versions should be held in s3 Retention string `json:"retention"` // Schedule in cron syntax when to run the backup periodically Schedule string `json:"schedule"` // S3Endpoint the url of the s3 endpoint S3Endpoint string `json:"s3endpoint"` // S3BucketName is the name of the bucket where the backup should be stored. S3BucketName string `json:"s3bucketname"` // S3Region the region of the aws s3 S3Region string `json:"s3region"` // S3AccessKey is the accesskey which must have write access S3AccessKey string `json:"s3accesskey"` // S3SecretKey is the secretkey which must match to the accesskey S3SecretKey string `json:"s3secretkey"` // S3EncryptionKey if set, server side s3 encryption is used. S3EncryptionKey *string `json:"s3encryptionkey,omitempty"` }
BackupConfig defines all properties to configure backup of a database. This config is stored in the data section under the key BackupConfigKey as json payload.
func (*BackupConfig) DeepCopy ¶
func (in *BackupConfig) DeepCopy() *BackupConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupConfig.
func (*BackupConfig) DeepCopyInto ¶
func (in *BackupConfig) DeepCopyInto(out *BackupConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Postgres ¶
type Postgres struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec PostgresSpec `json:"spec,omitempty"` Status PostgresStatus `json:"status,omitempty"` }
Postgres is the Schema for the postgres API
func (*Postgres) AddFinalizer ¶
func (*Postgres) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Postgres.
func (*Postgres) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Postgres) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Postgres) HasFinalizer ¶
func (*Postgres) HasSourceRanges ¶
HasSourceRanges returns true if SourceRanges are set
func (*Postgres) IsBeingDeleted ¶
IsBeingDeleted returns true if the deletion-timestamp is set
func (*Postgres) IsReplicationPrimary ¶ added in v0.4.0
func (*Postgres) RemoveFinalizer ¶
func (*Postgres) ToBackupSecretName ¶
ToBackupSecretName returns the name of the secret containing backup credentials
func (*Postgres) ToCWNP ¶
func (p *Postgres) ToCWNP(port int) (*firewall.ClusterwideNetworkPolicy, error)
ToCWNP returns CRD ClusterwideNetworkPolicy derived from CRD Postgres
func (*Postgres) ToKey ¶
func (p *Postgres) ToKey() *types.NamespacedName
func (*Postgres) ToPeripheralResourceLookupKey ¶
func (p *Postgres) ToPeripheralResourceLookupKey() types.NamespacedName
func (*Postgres) ToPeripheralResourceName ¶
func (*Postgres) ToPeripheralResourceNamespace ¶
func (*Postgres) ToStandbyClusterEgresCWNPName ¶ added in v0.4.0
func (*Postgres) ToStandbyClusterEgressCWNP ¶ added in v0.4.0
func (p *Postgres) ToStandbyClusterEgressCWNP() (*firewall.ClusterwideNetworkPolicy, error)
func (*Postgres) ToStandbyClusterIngresCWNPName ¶ added in v0.4.0
func (*Postgres) ToStandbyClusterIngressCWNP ¶ added in v0.4.0
func (p *Postgres) ToStandbyClusterIngressCWNP(sourceCIDRs []string) (*firewall.ClusterwideNetworkPolicy, error)
func (*Postgres) ToSvcLBName ¶
ToSvcLBName returns the name of the peripheral resource Service LoadBalancer. It's different from all other peripheral resources because the operator already generates one service with that name.
func (*Postgres) ToSvcLBNamespacedName ¶
func (p *Postgres) ToSvcLBNamespacedName() *types.NamespacedName
func (*Postgres) ToUnstructuredZalandoPostgresql ¶
func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *corev1.ConfigMap, sc string, pgParamBlockList map[string]bool, rbs *BackupConfig, srcDB *Postgres, patroniTTL, patroniLoopWait, patroniRetryTimeout uint32) (*unstructured.Unstructured, error)
func (*Postgres) ToUserPasswordSecretMatchingLabels ¶
func (*Postgres) ToUserPasswordsSecret ¶
func (p *Postgres) ToUserPasswordsSecret(src *corev1.SecretList, scheme *runtime.Scheme) (*corev1.Secret, error)
ToUserPasswordsSecret returns the secret containing user password pairs
func (*Postgres) ToUserPasswordsSecretListOption ¶
func (p *Postgres) ToUserPasswordsSecretListOption() []client.ListOption
ToUserPasswordsSecretListOption returns the argument for listing secrets
func (*Postgres) ToUserPasswordsSecretName ¶
ToUserPasswordsSecretName returns the name of the secret containing user password pairs
func (*Postgres) ToZalandoPostgresqlMatchingLabels ¶
func (p *Postgres) ToZalandoPostgresqlMatchingLabels() client.MatchingLabels
type PostgresConnection ¶ added in v0.4.0
type PostgresConnection struct { // ConnectedPostgresID internal ID of the connected Postgres instance ConnectedPostgresID string `json:"postgresID,omitempty"` // ConnectionSecretName name of the internal secret used to connect to the remote postgres ConnectionSecretName string `json:"secretName,omitempty"` // ConnectionIP IP of the remote postgres ConnectionIP string `json:"ip,omitempty"` // ConnectionPort port of the remote postgres ConnectionPort uint16 `json:"port,omitempty"` // SynchronousReplication determines if async or sync replication is used for the standby postgres SynchronousReplication bool `json:"synchronous,omitempty"` // ReplicationPrimary determines if THIS side of the connection is the primary or the standby side ReplicationPrimary bool `json:"localSideIsPrimary,omitempty"` }
PostgresConnection A remote postgres instance this one is linked to, e.g. for standby purpouses.
func (*PostgresConnection) DeepCopy ¶ added in v0.4.0
func (in *PostgresConnection) DeepCopy() *PostgresConnection
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresConnection.
func (*PostgresConnection) DeepCopyInto ¶ added in v0.4.0
func (in *PostgresConnection) DeepCopyInto(out *PostgresConnection)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PostgresList ¶
type PostgresList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []Postgres `json:"items"` }
PostgresList contains a list of Postgres
func (*PostgresList) DeepCopy ¶
func (in *PostgresList) DeepCopy() *PostgresList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresList.
func (*PostgresList) DeepCopyInto ¶
func (in *PostgresList) DeepCopyInto(out *PostgresList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*PostgresList) DeepCopyObject ¶
func (in *PostgresList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type PostgresRestore ¶ added in v0.5.0
type PostgresRestore struct { // SourcePostgresID internal ID of the Postgres instance to whose backup to restore SourcePostgresID string `json:"postgresID,omitempty"` // Timestamp The point in time to recover. Must be set, or the clone with switch from WALs from the S3 to a basebackup via direct sql connection (which won't work when the source db is managed by another posgres-operator) Timestamp string `json:"timestamp,omitempty"` }
Restore defines what to restore from where
func (*PostgresRestore) DeepCopy ¶ added in v0.5.0
func (in *PostgresRestore) DeepCopy() *PostgresRestore
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresRestore.
func (*PostgresRestore) DeepCopyInto ¶ added in v0.5.0
func (in *PostgresRestore) DeepCopyInto(out *PostgresRestore)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PostgresSpec ¶
type PostgresSpec struct { // Description Description string `json:"description,omitempty"` // ProjectID metal project ID ProjectID string `json:"projectID,omitempty"` // Tenant metal tenant Tenant string `json:"tenant,omitempty"` // PartitionID the partition where the database is created PartitionID string `json:"partitionID,omitempty"` // NumberOfInstances number of replicas // +kubebuilder:validation:Minimum=1 // +kubebuilder:default=1 NumberOfInstances int32 `json:"numberOfInstances,omitempty"` // Version is the version of Postgre-as-a-Service Version string `json:"version,omitempty"` // Size of the database Size *Size `json:"size,omitempty"` // todo: add default // Maintenance defines automatic maintenance of the database Maintenance []string `json:"maintenance,omitempty"` // AccessList defines access restrictions AccessList *AccessList `json:"accessList,omitempty"` // BackupSecretRef reference to the secret where the backup credentials are stored BackupSecretRef string `json:"backupSecretRef,omitempty"` // PostgresRestore PostgresRestore *PostgresRestore `json:"restore,omitempty"` // PostgresConnection Connection info of a streaming host, independant of the current role (leader or standby) PostgresConnection *PostgresConnection `json:"connection,omitempty"` // AuditLogs enable or disable default audit logs AuditLogs *bool `json:"auditLogs,omitempty"` // PostgresParams additional parameters that are passed along to the postgres config PostgresParams map[string]string `json:"postgresParams,omitempty"` }
PostgresSpec defines the desired state of Postgres
func (*PostgresSpec) DeepCopy ¶
func (in *PostgresSpec) DeepCopy() *PostgresSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresSpec.
func (*PostgresSpec) DeepCopyInto ¶
func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PostgresStatus ¶
type PostgresStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file Description string `json:"description,omitempty"` Socket Socket `json:"socket,omitempty"` ChildName string `json:"childName,omitempty"` }
PostgresStatus defines the observed state of Postgres
func (*PostgresStatus) DeepCopy ¶
func (in *PostgresStatus) DeepCopy() *PostgresStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresStatus.
func (*PostgresStatus) DeepCopyInto ¶
func (in *PostgresStatus) DeepCopyInto(out *PostgresStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Size ¶
type Size struct { // CPU is in the format as pod.spec.resource.request.cpu CPU string `json:"cpu,omitempty"` // Memory is in the format as pod.spec.resource.request.memory Memory string `json:"memory,omitempty"` SharedBuffer string `json:"sharedBuffer,omitempty"` // StorageSize the amount of Storage this database will get // +kubebuilder:default="1Gi" // +kubebuilder:validation:Pattern=^[1-9][0-9]*Gi StorageSize string `json:"storageSize,omitempty"` }
Todo: Add defaults Size defines the size aspects of the database
func (*Size) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Size.
func (*Size) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Socket ¶
Socket represents load-balancer socket of Postgres
func (*Socket) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Socket.
func (*Socket) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.