Add stackgres chart

This commit is contained in:
2024-05-30 20:42:52 +08:00
parent 1026f0ea9b
commit db34ed82a3
49 changed files with 21734 additions and 0 deletions
+665
View File
@@ -0,0 +1,665 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sgbackups.stackgres.io
spec:
group: stackgres.io
scope: Namespaced
names:
kind: SGBackup
listKind: SGBackupList
plural: sgbackups
singular: sgbackup
shortNames:
- sgbkp
versions:
- name: v1
served: true
storage: true
additionalPrinterColumns:
- name: cluster
type: string
jsonPath: .spec.sgCluster
- name: managed
type: string
jsonPath: .spec.managedLifecycle
- name: status
type: string
jsonPath: .status.process.status
- name: pg-version
type: string
jsonPath: .status.backupInformation.postgresVersion
priority: 1
- name: compressed-size
type: integer
format: byte
jsonPath: .status.backupInformation.size.compressed
priority: 1
- name: timeline
type: string
jsonPath: .status.backupInformation.timeline
priority: 1
schema:
openAPIV3Schema:
type: object
required: [metadata, spec]
description: |
A manual or automatically generated backup of an SGCluster configured with backups.
When a SGBackup is created a Job will perform a full backup of the database and update the status of the SGBackup
with the all the information required to restore it and some stats (or a failure message in case something unexpected
happened).
Backup generated by SGBackup are stored in the object storage configured with an SGObjectStorage together with the WAL
files or in a [VolumeSnapshot](https://kubernetes.io/docs/concepts/storage/volume-snapshots/) (separated from the WAL files that will be still stored in an object storage)
depending on the backup configuration of the targeted SGCluster.
After an SGBackup is created the same Job performs a reconciliation of the backups by applying the retention window
that has been configured in the SGCluster and removing the backups with managed lifecycle and the WAL files older
than the ones that fit in the retention window. The reconciliation also removes backups (excluding WAL files) that do
not belongs to any SGBackup (including copies). If the target storage is changed deletion of an SGBackup backups with
managed lifecycle and the WAL files older than the ones that fit in the retention window and of backups that do not
belongs to any SGBackup will not be performed anymore on the previous storage, only on the new target storage.
If the reconciliation of backups fails the backup itself do not fail and will be re-tried the next time a SGBackup
or shecduled backup Job take place.
properties:
metadata:
type: object
properties:
name:
type: string
maxLength: 56
pattern: "^[a-z]([-a-z0-9]*[a-z0-9])?$"
description: |
Name of the backup. Following [Kubernetes naming conventions](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md), it must be an rfc1035/rfc1123 subdomain, that is, up to 253 characters consisting of one or more lowercase labels separated by `.`. Where each label is an alphanumeric (a-z, and 0-9) string, with the `-` character allowed anywhere except the first or last character.
The name must be unique across all StackGres backups in the same namespace.
spec:
type: object
properties:
sgCluster:
type: string
description: |
The name of the `SGCluster` from which this backup is/will be taken.
If this is a copy of an existing completed backup in a different namespace
the value must be prefixed with the namespace of the source backup and a
dot `.` (e.g. `<cluster namespace>.<cluster name>`) or have the same value
if the source backup is also a copy.
managedLifecycle:
type: boolean
description: |
Indicate if this backup is not permanent and should be removed by the automated
retention policy. Default is `false`.
timeout:
type: integer
description: |
Allow to set a timeout for the backup creation.
If not set it will be disabled and the backup operation will continue until the backup completes or fail. If set to 0 is the same as not being set.
Make sure to set a reasonable high value in order to allow for any unexpected delays during backup creation (network low bandwidth, disk low throughput and so forth).
reconciliationTimeout:
type: integer
default: 300
description: |
Allow to set a timeout for the reconciliation process that take place after the backup.
If not set defaults to 300 (5 minutes). If set to 0 it will disable timeout.
Failure of reconciliation will not make the backup fail and will be re-tried the next time a SGBackup
or shecduled backup Job take place.
status:
type: object
properties:
internalName:
type: string
description: |
The name of the backup.
backupPath:
type: string
description: |
The path were the backup is stored.
process:
type: object
properties:
status:
type: string
description: |
Status of the backup.
failure:
type: string
description: |
If the status is `failed` this field will contain a message indicating the failure reason.
jobPod:
type: string
description: |
Name of the pod assigned to the backup. StackGres utilizes internally a locking mechanism based on the pod name of the job that creates the backup.
managedLifecycle:
type: boolean
description: |
Status (may be transient) until converging to `spec.managedLifecycle`.
timing:
type: object
properties:
start:
type: string
# format: date-time
description: |
Start time of backup.
end:
type: string
# format: date-time
description: |
End time of backup.
stored:
type: string
# format: date-time
description: |
Time at which the backup is safely stored in the object storage.
backupInformation:
type: object
properties:
hostname:
type: string
description: |
Hostname of the instance where the backup is taken from.
sourcePod:
type: string
description: |
Pod where the backup is taken from.
systemIdentifier:
type: string
description: |
Postgres *system identifier* of the cluster this backup is taken from.
postgresVersion:
type: string
description: |
Postgres version of the server where the backup is taken from.
pgData:
type: string
description: |
Data directory where the backup is taken from.
size:
type: object
properties:
uncompressed:
type: integer
format: int64
description: |
Size (in bytes) of the uncompressed backup.
compressed:
type: integer
format: int64
description: |
Size (in bytes) of the compressed backup.
lsn:
type: object
properties:
start:
type: string
description: |
LSN of when the backup started.
end:
type: string
description: |
LSN of when the backup finished.
startWalFile:
type: string
description: |
WAL segment file name when the backup was started.
timeline:
type: string
description: |
Backup timeline.
controlData:
type: object
description: |
An object containing data from the output of pg_controldata on the backup.
properties:
pg_control version number:
type: string
Catalog version number:
type: string
Database system identifier:
type: string
Database cluster state:
type: string
pg_control last modified:
type: string
Latest checkpoint location:
type: string
Latest checkpoint's REDO location:
type: string
Latest checkpoint's REDO WAL file:
type: string
Latest checkpoint's TimeLineID:
type: string
Latest checkpoint's PrevTimeLineID:
type: string
Latest checkpoint's full_page_writes:
type: string
Latest checkpoint's NextXID:
type: string
Latest checkpoint's NextOID:
type: string
Latest checkpoint's NextMultiXactId:
type: string
Latest checkpoint's NextMultiOffset:
type: string
Latest checkpoint's oldestXID:
type: string
Latest checkpoint's oldestXID's DB:
type: string
Latest checkpoint's oldestActiveXID:
type: string
Latest checkpoint's oldestMultiXid:
type: string
Latest checkpoint's oldestMulti's DB:
type: string
"Latest checkpoint's oldestCommitTsXid":
type: string
"Latest checkpoint's newestCommitTsXid":
type: string
Time of latest checkpoint:
type: string
Fake LSN counter for unlogged rels:
type: string
Minimum recovery ending location:
type: string
Min recovery ending loc's timeline:
type: string
Backup start location:
type: string
Backup end location:
type: string
End-of-backup record required:
type: string
wal_level setting:
type: string
wal_log_hints setting:
type: string
max_connections setting:
type: string
max_worker_processes setting:
type: string
max_wal_senders setting:
type: string
max_prepared_xacts setting:
type: string
max_locks_per_xact setting:
type: string
track_commit_timestamp setting:
type: string
Maximum data alignment:
type: string
Database block size:
type: string
Blocks per segment of large relation:
type: string
WAL block size:
type: string
Bytes per WAL segment:
type: string
Maximum length of identifiers:
type: string
Maximum columns in an index:
type: string
Maximum size of a TOAST chunk:
type: string
Size of a large-object chunk:
type: string
Date/time type storage:
type: string
Float4 argument passing:
type: string
Float8 argument passing:
type: string
Data page checksum version:
type: string
Mock authentication nonce:
type: string
sgBackupConfig:
type: object
description: The backup configuration used to perform this backup.
properties:
baseBackups:
type: object
description: |
Back backups configuration.
properties:
cronSchedule:
type: string
description: |
Continuous Archiving backups are composed of periodic *base backups* and all the WAL segments produced in between those base backups. This parameter specifies at what time and with what frequency to start performing a new base backup.
Use cron syntax (`m h dom mon dow`) for this parameter, i.e., 5 values separated by spaces:
* `m`: minute, 0 to 59
* `h`: hour, 0 to 23
* `dom`: day of month, 1 to 31 (recommended not to set it higher than 28)
* `mon`: month, 1 to 12
* `dow`: day of week, 0 to 7 (0 and 7 both represent Sunday)
Also ranges of values (`start-end`), the symbol `*` (meaning `first-last`) or even `*/N`, where `N` is a number, meaning every `N`, may be used. All times are UTC. It is recommended to avoid 00:00 as base backup time, to avoid overlapping with any other external operations happening at this time.
retention:
type: integer
minimum: 1
description: |
Based on this parameter, an automatic retention policy is defined to delete old base backups.
This parameter specifies the number of base backups to keep, in a sliding window.
Consequently, the time range covered by backups is `periodicity*retention`, where `periodicity` is the separation between backups as specified by the `cronSchedule` property.
Default is 5.
compression:
type: string
description: |
Select the backup compression algorithm. Possible options are: lz4, lzma, brotli. The default method is `lz4`. LZ4 is the fastest method, but compression ratio is the worst. LZMA is way slower, but it compresses backups about 6 times better than LZ4. Brotli is a good trade-off between speed and compression ratio, being about 3 times better than LZ4.
enum: [ lz4, lzma, brotli ]
performance:
type: object
properties:
maxNetworkBandwitdh:
type: integer
description: |
**Deprecated**: use instead maxNetworkBandwidth.
Maximum storage upload bandwidth to be used when storing the backup. In bytes (per second).
maxDiskBandwitdh:
type: integer
description: |
**Deprecated**: use instead maxDiskBandwidth.
Maximum disk read I/O when performing a backup. In bytes (per second).
maxNetworkBandwidth:
type: integer
description: |
Maximum storage upload bandwidth to be used when storing the backup. In bytes (per second).
maxDiskBandwidth:
type: integer
description: |
Maximum disk read I/O when performing a backup. In bytes (per second).
uploadDiskConcurrency:
type: integer
minimum: 1
description: |
Backup storage may use several concurrent streams to store the data. This parameter configures the number of parallel streams to use to reading from disk. By default, it's set to 1 (use one stream).
uploadConcurrency:
type: integer
minimum: 1
description: |
Backup storage may use several concurrent streams to store the data. This parameter configures the number of parallel streams to use. By default, it's set to 1 (use one stream).
compression:
type: string
description: |
Select the backup compression algorithm. Possible options are: lz4, lzma, brotli. The default method is `lz4`. LZ4 is the fastest method, but compression ratio is the worst. LZMA is way slower, but it compresses backups about 6 times better than LZ4. Brotli is a good trade-off between speed and compression ratio, being about 3 times better than LZ4.
enum: [lz4, lzma, brotli]
storage:
type: object
description: |
Backup storage configuration.
properties:
type:
type: string
enum: [s3, s3Compatible, gcs, azureBlob]
description: |
Specifies the type of object storage used for storing the base backups and WAL segments.
Possible values:
* `s3`: Amazon Web Services S3 (Simple Storage Service).
* `s3Compatible`: non-AWS services that implement a compatibility API with AWS S3.
* `gcs`: Google Cloud Storage.
* `azureBlob`: Microsoft Azure Blob Storage.
s3:
type: object
description: |
Amazon Web Services S3 configuration.
properties:
bucket:
type: string
pattern: ^[^/]+(/[^/]*)*$
description: |
AWS S3 bucket name.
path:
type: string
pattern: ^(/[^/]*)*$
description: |
Optional path within the S3 bucket. Note that StackGres generates in any case a folder per
StackGres cluster, using the `SGCluster.metadata.name`.
region:
type: string
description: |
AWS S3 region. The Region may be detected using s3:GetBucketLocation, but to avoid giving permissions to this API call or forbid it from the applicable IAM policy, this property must be explicitely specified.
storageClass:
type: string
description: |
[Amazon S3 Storage Class](https://aws.amazon.com/s3/storage-classes/) used for the backup object storage. By default, the `STANDARD` storage class is used. Other supported values include `STANDARD_IA` for Infrequent Access and `REDUCED_REDUNDANCY`.
awsCredentials:
type: object
description: |
Credentials to access AWS S3 for writing and reading.
properties:
secretKeySelectors:
type: object
description: |
Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core)s to reference the Secrets that contain the information about the `awsCredentials`.
properties:
accessKeyId:
type: object
description: |
[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) containing the AWS Access Key ID secret.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [key, name]
secretAccessKey:
type: object
description: |
[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) containing the AWS Secret Access Key secret.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [key, name]
required: [accessKeyId, secretAccessKey]
required: [secretKeySelectors]
required: [bucket, awsCredentials]
s3Compatible:
type: object
description: AWS S3-Compatible API configuration
properties:
bucket:
type: string
pattern: ^[^/]+(/[^/]*)*$
description: |
Bucket name.
path:
type: string
pattern: ^(/[^/]*)*$
description: |
Optional path within the S3 bucket. Note that StackGres generates in any case a folder per StackGres cluster, using the `SGCluster.metadata.name`.
enablePathStyleAddressing:
type: boolean
description: |
Enable path-style addressing (i.e. `http://s3.amazonaws.com/BUCKET/KEY`) when connecting to an S3-compatible service that lacks support for sub-domain style bucket URLs (i.e. `http://BUCKET.s3.amazonaws.com/KEY`). Defaults to false.
endpoint:
type: string
description: |
Overrides the default url to connect to an S3-compatible service.
For example: `http://s3-like-service:9000`.
region:
type: string
description: |
AWS S3 region. The Region may be detected using s3:GetBucketLocation, but to avoid giving permissions to this API call or forbid it from the applicable IAM policy, this property must be explicitely specified.
storageClass:
type: string
description: |
[Amazon S3 Storage Class](https://aws.amazon.com/s3/storage-classes/) used for the backup object storage. By default, the `STANDARD` storage class is used. Other supported values include `STANDARD_IA` for Infrequent Access and `REDUCED_REDUNDANCY`.
awsCredentials:
type: object
description: |
Credentials to access AWS S3 for writing and reading.
properties:
secretKeySelectors:
type: object
description: |
A Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) to reference the Secrets that contain the information about the `awsCredentials`.
properties:
accessKeyId:
type: object
description: |
[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) containing the AWS Access Key ID secret.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [key, name]
secretAccessKey:
type: object
description: |
[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) containing the AWS Secret Access Key secret.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [key, name]
required: [accessKeyId, secretAccessKey]
required: [secretKeySelectors]
required: [bucket, awsCredentials]
gcs:
type: object
description: |
Google Cloud Storage configuration.
properties:
bucket:
type: string
pattern: ^[^/]+(/[^/]*)*$
description: |
GCS bucket name.
path:
type: string
pattern: ^(/[^/]*)*$
description: |
Optional path within the GCS bucket. Note that StackGres generates in any case a folder per StackGres cluster, using the `SGCluster.metadata.name`.
gcpCredentials:
type: object
description: |
Credentials to access GCS for writing and reading.
properties:
fetchCredentialsFromMetadataService:
type: boolean
description: |
If true, the credentials will be fetched from the GCE/GKE metadata service and the credentials from `secretKeySelectors` field will not be used.
This is useful when running StackGres inside a GKE cluster using [Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity).
secretKeySelectors:
type: object
description: |
A Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) to reference the Secrets that contain the information about the Service Account to access GCS.
properties:
serviceAccountJSON:
type: object
description: |
A service account key from GCP. In JSON format, as downloaded from the GCP Console.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [key, name]
required: [serviceAccountJSON]
required: [bucket, gcpCredentials]
azureBlob:
type: object
description: |
Azure Blob Storage configuration.
properties:
bucket:
type: string
pattern: ^[^/]+(/[^/]*)*$
description: |
Azure Blob Storage bucket name.
path:
type: string
pattern: ^(/[^/]*)*$
description: |
Optional path within the Azure Blobk bucket. Note that StackGres generates in any case a folder per StackGres cluster, using the `SGCluster.metadata.name`.
azureCredentials:
type: object
description: |
Credentials to access Azure Blob Storage for writing and reading.
properties:
secretKeySelectors:
type: object
description: |
Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core)s to reference the Secrets that contain the information about the `azureCredentials`.
properties:
storageAccount:
type: object
description: |
[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) containing the name of the storage account.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [key, name]
accessKey:
type: object
description: |
[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) containing the primary or secondary access key for the storage account.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [key, name]
required: [storageAccount, accessKey]
required: [bucket, azureCredentials]
required: [type]
required: [storage]
volumeSnapshot:
type: object
description: The volume snapshot configuration used to restore this backup.
properties:
name:
type: string
description: |
The volume snapshot used to store this backup.
backupLabel:
type: string
description: |
The content of `backup_label` column returned by `pg_backup_stop` encoded in Base64
tablespaceMap:
type: string
description: |
The content of `tablespace_map` column returned by `pg_backup_stop` encoded in Base64
File diff suppressed because one or more lines are too long
+906
View File
@@ -0,0 +1,906 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sgconfigs.stackgres.io
spec:
group: stackgres.io
names:
kind: SGConfig
listKind: SGConfigList
plural: sgconfigs
singular: sgconfig
scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns:
- jsonPath: .metadata.annotations.stackgres\.io/lockPod
name: operator-pod
type: string
- jsonPath: .status.version
name: operator-version
type: string
schema:
openAPIV3Schema:
type: object
description: |
SGConfig stores the configuration of the StackGres Operator
> **WARNING**: Creating more than one SGConfig is forbidden in order to avoid misbehaviours. The single SGConfig should be created automatically during installation.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the desired state of SGConfig
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
containerRegistry:
type: string
default: quay.io
description: The container registry host (and port) where the images will be pulled from.
imagePullPolicy:
type: string
default: "IfNotPresent"
description: Image pull policy used for images loaded by the Operator
serviceAccount:
type: object
description: Section to configure Operator Installation ServiceAccount
properties:
create:
type: boolean
default: true
description: If `true` the Operator Installation ServiceAccount will be created
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Section to configure Installation ServiceAccount annotations
repoCredentials:
type: array
description: Repositories credentials Secret names
items:
type: string
description: Repository credentials Secret name
operator:
type: object
description: Section to configure Operator Pod
properties:
image:
type: object
description: Section to configure Operator image
properties:
name:
type: string
default: "stackgres/operator"
description: Operator image name
tag:
type: string
description: Operator image tag
pullPolicy:
type: string
default: "IfNotPresent"
description: Operator image pull policy
annotations:
type: object
description: Operator Pod annotations
x-kubernetes-preserve-unknown-fields: true
resources:
type: object
description: Operator Pod resources. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#resourcerequirements-v1-core
x-kubernetes-preserve-unknown-fields: true
nodeSelector:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Operator Pod node selector
tolerations:
type: array
description: Operator Pod tolerations. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#toleration-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
affinity:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Operator Pod affinity. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#affinity-v1-core
serviceAccount:
type: object
description: Section to configure Operator ServiceAccount
properties:
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Section to configure Operator ServiceAccount annotations
repoCredentials:
type: array
description: Repositories credentials Secret names
items:
type: string
description: Repository credentials Secret name
service:
type: object
description: Section to configure Operator Service
properties:
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Section to configure Operator Service annotations
restapi:
type: object
description: Section to configure REST API Pod
properties:
name:
type: string
default: stackgres-restapi
description: REST API container name
image:
type: object
description: Section to configure REST API image
properties:
name:
type: string
default: "stackgres/restapi"
description: REST API image name
tag:
type: string
description: REST API image tag
pullPolicy:
type: string
default: "IfNotPresent"
description: REST API image pull policy
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: REST API Pod annotations
resources:
type: object
x-kubernetes-preserve-unknown-fields: true
description: REST API Pod resources. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#resourcerequirements-v1-core
nodeSelector:
type: object
x-kubernetes-preserve-unknown-fields: true
description: REST API Pod node selector
tolerations:
type: array
description: REST API Pod tolerations. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#toleration-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
affinity:
type: object
x-kubernetes-preserve-unknown-fields: true
description: REST API Pod affinity. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#affinity-v1-core
serviceAccount:
type: object
description: Section to configure REST API ServiceAccount
properties:
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: REST API ServiceAccount annotations
repoCredentials:
type: array
description: Repositories credentials Secret names
items:
type: string
description: Repository credentials Secret name
service:
type: object
description: Section to configure REST API Service
properties:
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: REST API Service annotations
adminui:
type: object
description: Section to configure Web Console container
properties:
image:
type: object
description: Section to configure Web Console image
properties:
name:
type: string
default: "stackgres/admin-ui"
description: Web Console image name
tag:
type: string
description: Web Console image tag
pullPolicy:
type: string
default: "IfNotPresent"
description: Web Console image pull policy
resources:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Web Console resources. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#resourcerequirements-v1-core
service:
type: object
description: Section to configure Web Console service.
properties:
exposeHTTP:
type: boolean
default: false
description: When set to `true` the HTTP port will be exposed in the Web Console Service
type:
type: string
default: ClusterIP
description: |
The type used for the service of the UI:
* Set to LoadBalancer to create a load balancer (if supported by the kubernetes cluster)
to allow connect from Internet to the UI. Note that enabling this feature will probably incurr in
some fee that depend on the host of the kubernetes cluster (for example this is true for EKS, GKE
and AKS).
* Set to NodePort to expose admin UI from kubernetes nodes.
loadBalancerIP:
type: string
description: |
LoadBalancer will get created with the IP specified in
this field. This feature depends on whether the underlying cloud-provider supports specifying
the loadBalancerIP when a load balancer is created. This field will be ignored if the
cloud-provider does not support the feature.
loadBalancerSourceRanges:
type: array
description: |
If specified and supported by the platform,
this will restrict traffic through the cloud-provider load-balancer will be restricted to the
specified client IPs. This field will be ignored if the cloud-provider does not support the
feature.
More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
items:
type: string
nodePort:
type: integer
description: The HTTPS port used to expose the Service on Kubernetes nodes
nodePortHTTP:
type: integer
description: The HTTP port used to expose the Service on Kubernetes nodes
jobs:
type: object
description: Section to configure Operator Installation Jobs
properties:
image:
type: object
description: Section to configure Operator Installation Jobs image
properties:
name:
type: string
default: "stackgres/jobs"
description: Operator Installation Jobs image name
tag:
type: string
description: Operator Installation Jobs image tag
pullPolicy:
type: string
default: "IfNotPresent"
description: Operator Installation Jobs image pull policy
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Operator Installation Jobs annotations
resources:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Operator Installation Jobs resources. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#resourcerequirements-v1-core
nodeSelector:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Operator Installation Jobs node selector
tolerations:
type: array
description: Operator Installation Jobs tolerations. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#toleration-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
affinity:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Operator Installation Jobs affinity. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#affinity-v1-core
serviceAccount:
type: object
description: Section to configure Jobs ServiceAccount
properties:
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Jobs ServiceAccount annotations
repoCredentials:
type: array
description: Repositories credentials Secret names
items:
type: string
description: Repository credentials Secret name
deploy:
type: object
description: Section to configure deployment aspects.
properties:
operator:
type: boolean
default: true
description: When set to `true` the Operator will be deployed.
restapi:
type: boolean
default: true
description: When set to `true` the Web Console / REST API will be deployed.
cert:
type: object
description: Section to configure the Operator, REST API and Web Console certificates and JWT RSA key-pair.
properties:
autoapprove:
type: boolean
default: true
description: |
If set to `true` the CertificateSigningRequest used to generate the certificate used by
Webhooks will be approved by the Operator Installation Job.
createForOperator:
type: boolean
default: true
description: When set to `true` the Operator certificate will be created.
createForWebApi:
type: boolean
default: true
description: When set to `true` the Web Console / REST API certificate will be created.
secretName:
type: string
description: |
The Secret name with the Operator Webhooks certificate issued by the Kubernetes cluster CA
of type kubernetes.io/tls. See https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets
regenerateCert:
type: boolean
description: |
When set to `true` the Operator certificates will be regenerated if `createForOperator` is set to `true`, and the certificate is expired or invalid.
default: true
certDuration:
type: integer
description: |
The duration in days of the generated certificate for the Operator after which it will expire and be regenerated.
If not specified it will be set to 730 (2 years) by default.
webSecretName:
type: string
description: |
The Secret name with the Web Console / REST API certificate
of type kubernetes.io/tls. See https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets
regenerateWebCert:
type: boolean
description: |
When set to `true` the Web Console / REST API certificates will be regenerated if `createForWebApi` is set to `true`, and the certificate is expired or invalid.
default: true
regenerateWebRsa:
type: boolean
description: |
When set to `true` the Web Console / REST API RSA key pair will be regenerated if `createForWebApi` is set to `true`, and the certificate is expired or invalid.
default: true
webCertDuration:
type: integer
description: |
The duration in days of the generated certificate for the Web Console / REST API after which it will expire and be regenerated.
If not specified it will be set to 730 (2 years) by default.
webRsaDuration:
type: integer
description: |
The duration in days of the generated RSA key pair for the Web Console / REST API after which it will expire and be regenerated.
If not specified it will be set to 730 (2 years) by default.
certManager:
type: object
description: Section to configure cert-manager integration to generate Operator certificates
properties:
autoConfigure:
type: boolean
default: false
description: |
When set to `true` then Issuer and Certificate for Operator and Web Console / REST API
Pods will be generated
duration:
type: string
default: "2160h"
description: The requested duration (i.e. lifetime) of the Certificates. See https://cert-manager.io/docs/reference/api-docs/#cert-manager.io%2fv1
renewBefore:
type: string
default: "360h"
description: How long before the currently issued certificate’s expiry cert-manager should renew the certificate. See https://cert-manager.io/docs/reference/api-docs/#cert-manager.io%2fv1
encoding:
type: string
default: PKCS1
description: The private key cryptography standards (PKCS) encoding for this certificate’s private key to be encoded in. See https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificatePrivateKey
size:
type: integer
default: 2048
description: Size is the key bit size of the corresponding private key for this certificate. See https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificatePrivateKey
rbac:
type: object
description: Section to configure RBAC for Web Console admin user
properties:
create:
type: boolean
default: true
description: |
When set to `true` the admin user is assigned the `cluster-admin` ClusterRole by creating
ClusterRoleBinding.
authentication:
type: object
description: Section to configure Web Console authentication
properties:
type:
type: string
default: jwt
description: |
Specify the authentication mechanism to use. By default is `jwt`, see https://stackgres.io/doc/latest/api/rbac#local-secret-mechanism.
If set to `oidc` then see https://stackgres.io/doc/latest/api/rbac/#openid-connect-provider-mechanism.
createAdminSecret:
type: boolean
description: |
When `true` will create the secret used to store the admin user credentials to access the UI.
default: true
user:
type: string
default: admin
description: |
The admin username that will be created for the Web Console
Operator bundle installation can not change the default value of this field.
password:
type: string
description: |
The admin password that will be created for the Web Console.
If not specified a random password will be generated.
secretRef:
type: object
description: |
Allow to specify a reference to a Secret with the admin user credentials for the Web Console.
In order to assign properly permissions. Make sure the `user` field match the value of the `k8sUsername` key in the referenced Secret.
properties:
name:
description: The name of the Secret.
type: string
oidc:
type: object
description: Section to configure Web Console OIDC authentication
properties:
tlsVerification:
type: string
description: Can be one of `required`, `certificate-validation` or `none`
authServerUrl:
type: string
clientId:
type: string
credentialsSecret:
type: string
clientIdSecretRef:
type: object
properties:
name:
type: string
key:
type: string
credentialsSecretSecretRef:
type: object
properties:
name:
type: string
key:
type: string
prometheus:
type: object
description: Section to configure Prometheus integration.
properties:
allowAutobind:
type: boolean
default: true
description: |
If set to false disable automatic bind to Prometheus
created using the [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator).
If disabled the cluster will not be binded to Prometheus automatically and will require manual
intervention by the Kubernetes cluster administrator.
grafana:
type: object
description: Section to configure Grafana integration
properties:
autoEmbed:
type: boolean
default: false
description: |
When set to `true` embed automatically Grafana into the Web Console by creating the
StackGres dashboard and the read-only role used to read it from the Web Console
schema:
type: string
default: http
description: |
The schema to access Grafana. By default http. (used to embed manually and
automatically grafana)
webHost:
type: string
description: |
The service host name to access grafana (used to embed manually and
automatically Grafana).
The parameter value should point to the grafana service following the
[DNS reference](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/) `svc_name.namespace`
datasourceName:
type: string
default: Prometheus
description: The datasource name used to create the StackGres Dashboard into Grafana
user:
type: string
default: admin
description: |
The username to access Grafana. By default admin. (used to embed automatically
Grafana)
password:
type: string
default: prom-operator
description: |
The password to access Grafana. By default prom-operator (the default in for
kube-prometheus-stack helm chart). (used to embed automatically Grafana)
secretNamespace:
type: string
description: |
The namespace of secret with credentials to access Grafana. (used to
embed automatically Grafana, alternative to use `user` and `password`)
secretName:
type: string
description: |
The name of secret with credentials to access Grafana. (used to embed
automatically Grafana, alternative to use `user` and `password`)
secretUserKey:
type: string
description: |
The key of secret with username used to access Grafana. (used to embed
automatically Grafana, alternative to use `user` and `password`)
secretPasswordKey:
type: string
description: |
The key of secret with password used to access Grafana. (used to
embed automatically Grafana, alternative to use `user` and `password`)
dashboardConfigMap:
type: string
description: |
The ConfigMap name with the dashboard JSON in the key `grafana-dashboard.json`
that will be created in Grafana. If not set the default
dashboardId:
type: string
description: |
The dashboard id that will be create in Grafana
(see https://grafana.com/grafana/dashboards). By default 9628. (used to embed automatically
Grafana)
Manual Steps:
Create grafana dashboard for postgres exporter and copy/paste share URL:
- Grafana > Create > Import > Grafana.com Dashboard 9628
Copy/paste grafana dashboard URL for postgres exporter:
- Grafana > Dashboard > Manage > Select postgres exporter dashboard > Copy URL
url:
type: string
description: |
The URL of the PostgreSQL dashboard created in Grafana (used to embed manually
Grafana)
token:
type: string
description: |
The Grafana API token to access the PostgreSQL dashboard created
in Grafana (used to embed manually Grafana)
Manual Steps:
Create and copy/paste grafana API token:
- Grafana > Configuration > API Keys > Add API key (for viewer) > Copy key value
extensions:
type: object
description: Section to configure extensions
properties:
repositoryUrls:
type: array
default:
- https://extensions.stackgres.io/postgres/repository
description: |
A list of extensions repository URLs used to retrieve extensions
To set a proxy for extensions repository add parameter proxyUrl to the URL:
`https://extensions.stackgres.io/postgres/repository?proxyUrl=<proxy scheme>%3A%2F%2F<proxy host>[%3A<proxy port>]` (URL encoded)
Other URL parameters are:
* `skipHostnameVerification`: set it to `true` in order to use a server or a proxy with a self signed certificate
* `retry`: set it to `<max retriex>[:<sleep before next retry>]` in order to retry a request on failure
* `setHttpScheme`: set it to `true` in order to force using HTTP scheme
items:
type: string
cache:
type: object
description: |
Section to configure extensions cache (experimental).
This feature is in beta and may cause failures, please use with caution and report any
error to https://gitlab.com/ongresinc/stackgres/-/issues/new
properties:
enabled:
type: boolean
default: false
description: |
When set to `true` enable the extensions cache.
This feature is in beta and may cause failures, please use with caution and report any
error to https://gitlab.com/ongresinc/stackgres/-/issues/new
preloadedExtensions:
type: array
default:
- x86_64/linux/timescaledb-1\.7\.4-pg12
description: An array of extensions pattern used to pre-loaded estensions into the extensions cache
items:
type: string
description: An extension pattern used to pre-loaded estensions into the extensions cache
persistentVolume:
type: object
description: Section to configure the extensions cache PersistentVolume
properties:
size:
type: string
default: 1Gi
description: |
The PersistentVolume size for the extensions cache
Only use whole numbers (e.g. not 1e6) and K/Ki/M/Mi/G/Gi as units
storageClass:
type: string
description: |
If defined set storage class
If set to "-" (equivalent to storageClass: "" in a PV spec) disables
dynamic provisioning
If undefined (the default) or set to null, no storageClass spec is
set, choosing the default provisioner. (gp2 on AWS, standard on
GKE, AWS & OpenStack)
hostPath:
type: string
description: |
If set, will use a host path volume with the specified path for the extensions cache
instead of a PersistentVolume
shardingSphere:
type: object
description: Section to configure integration with ShardingSphere operator
properties:
serviceAccount:
type: object
description: |
Section to configure ServiceAccount used by ShardingSphere operator.
You may configure a specific value for a sharded cluster under section
`SGShardedCluster.speccoordinator.configurations.shardingSphere.serviceAccount`.
required: [namespace,name]
properties:
namespace:
type: string
description: The namespace of the ServiceAccount used by ShardingSphere operator
name:
type: string
description: The name of the ServiceAccount used by ShardingSphere operator
developer:
type: object
x-kubernetes-preserve-unknown-fields: true
description: |
Section to configure developer options.
Following options are for developers only, but can also be useful in some cases ;)
properties:
version:
type: string
description: Set the operator version (used for testing)
logLevel:
type: string
description: Set `quarkus.log.level`. See https://quarkus.io/guides/logging#root-logger-configuration
showDebug:
type: boolean
default: false
description: If set to `true` add extra debug to any script controlled by the reconciliation cycle of the operator configuration
showStackTraces:
type: boolean
default: false
description: Set `quarkus.log.console.format` to `%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{4.}] (%t) %s%e%n`. See https://quarkus.io/guides/logging#logging-format
useJvmImages:
type: boolean
default: false
description: |
The operator will use JVM version of the images
enableJvmDebug:
type: boolean
default: false
description: |
Only work with JVM version and allow connect
on port 8000 of operator Pod with jdb or similar
enableJvmDebugSuspend:
type: boolean
default: false
description: |
Only work with JVM version and if `enableJvmDebug` is `true`
suspend the JVM until a debugger session is started
externalOperatorIp:
type: string
description: Set the external Operator IP
externalOperatorPort:
type: integer
description: Set the external Operator port
externalRestApiIp:
type: string
description: Set the external REST API IP
externalRestApiPort:
type: integer
description: Set the external REST API port
allowPullExtensionsFromImageRepository:
type: boolean
default: false
description: |
If set to `true` and `extensions.cache.enabled` is also `true`
it will try to download extensions from images (experimental)
disableArbitraryUser:
type: boolean
default: false
description: |
It set to `true` disable arbitrary user that is set for OpenShift clusters
patches:
type: object
description: |
Section to define patches for some StackGres Pods
properties:
operator:
type: object
description: |
Section to define volumes to be used by the operator container
properties:
volumes:
type: array
description: Pod volumes. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volume-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
volumeMounts:
type: array
description: Pod's container volume mounts. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volumemount-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
restapi:
type: object
description: |
Section to define volumes to be used by the restapi container
properties:
volumes:
type: array
description: Pod volumes. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volume-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
volumeMounts:
type: array
description: Pod's container volume mounts. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volumemount-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
adminui:
type: object
description: |
Section to define volumes to be used by the adminui container
properties:
volumes:
type: array
description: Pod volumes. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volume-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
volumeMounts:
type: array
description: Pod's container volume mounts. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volumemount-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
jobs:
type: object
description: |
Section to define volumes to be used by the jobs container
properties:
volumes:
type: array
description: Pod volumes. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volume-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
volumeMounts:
type: array
description: Pod's container volume mounts. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volumemount-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
clusterController:
type: object
description: |
Section to define volumes to be used by the cluster controller container
properties:
volumes:
type: array
description: Pod volumes. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volume-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
volumeMounts:
type: array
description: Pod's container volume mounts. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volumemount-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
distributedlogsController:
type: object
description: |
Section to define volumes to be used by the distributedlogs controller container
properties:
volumes:
type: array
description: Pod volumes. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volume-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
volumeMounts:
type: array
description: Pod's container volume mounts. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volumemount-v1-core
items:
type: object
x-kubernetes-preserve-unknown-fields: true
status:
type: object
description: Status defines the observed state of SGConfig
x-kubernetes-preserve-unknown-fields: true
properties:
conditions:
type: array
items:
type: object
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status to another.
type: string
message:
description: A human readable message indicating details about the transition.
type: string
reason:
description: The reason for the condition's last transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of deployment condition.
type: string
version:
type: string
description: Latest version of the operator used to check for updates
removeOldOperatorBundleResources:
type: boolean
description: Indicate when the old operator bundle resources has been removed
grafana:
type: object
properties:
urls:
description: Grafana URLs to StackGres dashboards
type: array
items:
type: string
description: Grafana URL to StackGres dashboards preceded by the dashboard name and a semicolon `:`
token:
description: Grafana Token that allow to access dashboards
type: string
configHash:
description: Grafana configuration hash
type: string
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,271 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sginstanceprofiles.stackgres.io
spec:
group: stackgres.io
scope: Namespaced
names:
kind: SGInstanceProfile
listKind: SGInstanceProfileList
plural: sginstanceprofiles
singular: sginstanceprofile
shortNames:
- sginp
versions:
- name: v1
served: true
storage: true
additionalPrinterColumns:
- name: cpu
type: string
jsonPath: .spec.cpu
- name: memory
type: string
jsonPath: .spec.memory
schema:
openAPIV3Schema:
required: ["metadata", "spec"]
type: object
properties:
metadata:
type: object
properties:
name:
type: string
description: |
Name of the Instance Profile. An instance profile represents a "kind" of
server (CPU and RAM) where you may run StackGres Pods, classified by a given name.
The profile may be referenced by zero or more SGClusters, and if so it would
be referenced by its name. Following [Kubernetes naming conventions](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md), it must be an rfc1035/rfc1123 subdomain, that is, up to 253 characters consisting of one or more lowercase labels separated by `.`. Where each label is an alphanumeric (a-z, and 0-9) string, with the `-` character allowed anywhere except the first or last character.
The name must be unique across all instance profiles in the same namespace.
spec:
type: object
properties:
cpu:
type: string
pattern: '^[1-9][0-9]*[m]?$'
description: |
CPU(s) (cores) limits for every resource's Pod that reference this SGInstanceProfile. The suffix `m`
specifies millicpus (where 1000m is equals to 1).
The number of cpu limits is assigned to the patroni container (that runs both Patroni and PostgreSQL).
A minimum of 2 cpu is recommended.
memory:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits for every resource's Pod that reference this SGInstanceProfile. The suffix `Mi` or `Gi`
specifies Mebibytes or Gibibytes, respectively.
The amount of RAM limits is assigned to the patroni container (that runs both Patroni and PostgreSQL).
A minimum of 2Gi is recommended.
hugePages:
type: object
description: |
RAM limits allocated for huge pages of the patroni container (that runs both Patroni and PostgreSQL).
properties:
hugepages-2Mi:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits allocated for huge pages of the patroni container (that runs both Patroni and PostgreSQL) with a size of 2Mi. The suffix `Mi` or `Gi`
specifies Mebibytes or Gibibytes, respectively.
hugepages-1Gi:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits allocated for huge pages of the patroni container (that runs both Patroni and PostgreSQL) with a size of 1Gi. The suffix `Mi` or `Gi`
specifies Mebibytes or Gibibytes, respectively.
containers:
type: object
description: |
The CPU(s) (cores) and RAM limits assigned to containers other than patroni container.
additionalProperties:
type: object
description: |
The CPU(s) (cores) and RAM limits assigned to a container.
This section, if left empty, will be filled automatically by the operator with
some defaults that can be proportional to the resources limits assigned to patroni
container (except for the huge pages that are always left untouched).
properties:
cpu:
type: string
pattern: '^[1-9][0-9]*[m]?$'
description: |
CPU(s) (cores) limits for the specified container. The suffix `m`
specifies millicpus (where 1000m is equals to 1).
memory:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits for the specified container. The suffix `Mi` or `Gi`
specifies Mebibytes or Gibibytes, respectively.
hugePages:
type: object
description: |
RAM limits for huge pages for the specified container.
properties:
hugepages-2Mi:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits for huge pages of the specified container with a size of 2Mi. The suffix `Mi`
or `Gi` specifies Mebibytes or Gibibytes, respectively.
hugepages-1Gi:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits for huge pages of the specified container with a size of 1Gi. The suffix `Mi`
or `Gi` specifies Mebibytes or Gibibytes, respectively.
initContainers:
type: object
description: The CPU(s) (cores) and RAM limits assigned to the init containers.
additionalProperties:
type: object
description: |
The CPU(s) (cores) and RAM limits assigned to a init container.
This section will be filled automatically by the operator with
the same values of the resources limits assigned to patroni
container (except for the huge pages that are always left untouched).
properties:
cpu:
type: string
pattern: '^[1-9][0-9]*[m]?$'
description: |
CPU(s) (cores) limits for the specified init container. The suffix
`m` specifies millicpus (where 1000m is equals to 1).
memory:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits for the specified init container. The suffix `Mi`
or `Gi` specifies Mebibytes or Gibibytes, respectively.
hugePages:
type: object
description: |
RAM limits for huge pages of the specified init container
properties:
hugepages-2Mi:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits for huge pages of the specified init container with a size of 2Mi. The suffix `Mi`
or `Gi` specifies Mebibytes or Gibibytes, respectively.
hugepages-1Gi:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM limits for huge pages of the specified init container with a size of 1Gi. The suffix `Mi` or `Gi`
specifies Mebibytes or Gibibytes, respectively.
requests:
type: object
description: |
This section allow to configure the resources requests for each container and, if not specified, it is filled with some defaults based on the fields `.spec.cpu` and `.spec.memory` will be set.
On containerized environments, when running production workloads, enforcing container's resources requirements requests to be equals to the limits in order to achieve the highest level of performance. Doing so, reduces the chances of leaving
the workload with less resources than it requires. It also allow to set [static CPU management policy](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#static-policy) that allows to guarantee a pod the usage exclusive CPUs on the node.
There are cases where you may need to set cpu requests to the same value as cpu limits in order to achieve static CPU management policy.
By default the resources requests values in fields `.spec.requests.cpu` and `.spec.requests.memory` represent the total resources requests assigned to each resource's Pod that reference this SGInstanceProfile.
The resources requests of the patroni container (that runs both Patroni and PostgreSQL) is calculated by subtracting from the total resources requests the resources requests of other containers that are present in the Pod.
To change this behavior and having the resources requests values in fields `.spec.requests.cpu` and `.spec.requests.memory` to represent the resources requests of the patroni container and the total resources requests
calculated by adding the resources requests of all the containers (including the patroni container) you may set one or more of the following fields to `true`
(depending on the resource's Pods you need this behaviour to be changed):
* `SGCluster.spec.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.coordinator.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.shards.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.shards.ovewrites.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGDistributedLogs.spec.resources.disableResourcesRequestsSplitFromTotal`
properties:
cpu:
type: string
pattern: '^[1-9][0-9]*[m]?$'
description: |
CPU(s) (cores) requests for every resource's Pod that reference this SGInstanceProfile. The suffix `m`
specifies millicpus (where 1000m is equals to 1).
By default the cpu requests values in field `.spec.requests.cpu` represent the total cpu requests assigned to each resource's Pod that reference this SGInstanceProfile.
The cpu requests of the patroni container (that runs both Patroni and PostgreSQL) is calculated by subtracting from the total cpu requests the cpu requests of other containers that are present in the Pod.
To change this behavior and having the cpu requests values in field `.spec.requests.cpu` to represent the cpu requests of the patroni container and the total cpu requests
calculated by adding the cpu requests of all the containers (including the patroni container) you may set one or more of the following fields to `true`
(depending on the resource's Pods you need this behaviour to be changed):
* `SGCluster.spec.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.coordinator.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.shards.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.shards.ovewrites.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGDistributedLogs.spec.resources.disableResourcesRequestsSplitFromTotal`
memory:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM requests for every resource's Pod that reference this SGInstanceProfile. The suffix `Mi` or `Gi`
specifies Mebibytes or Gibibytes, respectively.
By default the memory requests values in field `.spec.requests.memory` represent the total memory requests assigned to each resource's Pod that reference this SGInstanceProfile.
The memory requests of the patroni container (that runs both Patroni and PostgreSQL) is calculated by subtracting from the total memory requests the memory requests of other containers that are present in the Pod.
To change this behavior and having the memory requests values in field `.spec.requests.memory` to represent the memory requests of the patroni container and the total memory requests
calculated by adding the memory requests of all the containers (including the patroni container) you may set one or more of the following fields to `true`
(depending on the resource's Pods you need this behaviour to be changed):
* `SGCluster.spec.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.coordinator.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.shards.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGShardedCluster.spec.shards.ovewrites.pods.resources.disableResourcesRequestsSplitFromTotal`
* `SGDistributedLogs.spec.resources.disableResourcesRequestsSplitFromTotal`
containers:
type: object
description: |
The CPU(s) (cores) and RAM requests assigned to containers other than patroni container.
additionalProperties:
type: object
description: |
The CPU(s) (cores) and RAM requests assigned to a container.
This section, if left empty, will be filled automatically by the operator with
some defaults that can be proportional to the resources assigned to patroni
container (except for the huge pages that are always left untouched).
properties:
cpu:
type: string
pattern: '^[1-9][0-9]*[m]?$'
description: |
CPU(s) (cores) requests for the specified container. The suffix `m`
specifies millicpus (where 1000m is equals to 1).
memory:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM requests for the specified container. The suffix `Mi` or `Gi`
specifies Mebibytes or Gibibytes, respectively.
initContainers:
type: object
description: The CPU(s) (cores) and RAM requests assigned to init containers.
additionalProperties:
type: object
description: |
The CPU(s) (cores) and RAM requests assigned to a init container.
This section will be filled automatically by the operator with
the same values of the resources requests assigned to patroni
container (except for the huge pages that are always left untouched).
properties:
cpu:
type: string
pattern: '^[1-9][0-9]*[m]?$'
description: |
CPU(s) (cores) requests for the specified init container. The suffix
`m` specifies millicpus (where 1000m is equals to 1).
memory:
type: string
pattern: '^[0-9]+(\.[0-9]+)?(Mi|Gi)$'
description: |
RAM requests for the specified init container. The suffix `Mi`
or `Gi` specifies Mebibytes or Gibibytes, respectively.
@@ -0,0 +1,285 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sgobjectstorages.stackgres.io
spec:
group: stackgres.io
scope: Namespaced
names:
kind: SGObjectStorage
listKind: SGObjectStorageList
plural: sgobjectstorages
singular: sgobjectstorage
shortNames:
- sgobjs
versions:
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
- name: type
type: string
jsonPath: .spec.type
schema:
openAPIV3Schema:
type: object
required: ["metadata", "spec"]
properties:
metadata:
type: object
properties:
name:
type: string
description: |
Name of the Object Storage configuration.
The name must be unique across all object storage configurations in the same namespace.
spec:
type: object
description: |
Object Storage configuration
properties:
type:
type: string
enum: ["s3", "s3Compatible", "gcs", "azureBlob"]
description: |
Determine the type of object storage used for storing the base backups and WAL segments.
Possible values:
* `s3`: Amazon Web Services S3 (Simple Storage Service).
* `s3Compatible`: non-AWS services that implement a compatibility API with AWS S3.
* `gcs`: Google Cloud Storage.
* `azureBlob`: Microsoft Azure Blob Storage.
s3:
type: object
description: |
Amazon Web Services S3 configuration.
properties:
bucket:
type: string
pattern: '^((s3|https?)://)?[^/]+(/[^/]*)*$'
description: |
AWS S3 bucket name.
region:
type: string
description: |
The AWS S3 region. The Region may be detected using s3:GetBucketLocation, but if you wish to avoid giving permissions to this API call or forbid it from the applicable IAM policy, you must then specify this property.
storageClass:
type: string
description: |
The [Amazon S3 Storage Class](https://aws.amazon.com/s3/storage-classes/) to use for the backup object storage. By default, the `STANDARD` storage class is used. Other supported values include `STANDARD_IA` for Infrequent Access and `REDUCED_REDUNDANCY`.
awsCredentials:
type: object
description: |
The credentials to access AWS S3 for writing and reading.
properties:
secretKeySelectors:
type: object
description: |
Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core)(s) to reference the Secrets that contain the information about the `awsCredentials`. Note that you may use the same or different Secrets for the `accessKeyId` and the `secretAccessKey`. In the former case, the `keys` that identify each must be, obviously, different.
properties:
accessKeyId:
type: object
description: |
AWS [access key ID](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). For example, `AKIAIOSFODNN7EXAMPLE`.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: ["key", "name"]
secretAccessKey:
type: object
description: |
AWS [secret access key](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). For example, `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: ["key", "name"]
required: ["accessKeyId", "secretAccessKey"]
required: ["secretKeySelectors"]
required: ["bucket", "awsCredentials"]
s3Compatible:
type: object
description: "AWS S3-Compatible API configuration"
properties:
bucket:
type: string
pattern: '^((s3|https?)://)?[^/]+(/[^/]*)*$'
description: |
Bucket name.
enablePathStyleAddressing:
type: boolean
description: |
Enable path-style addressing (i.e. `http://s3.amazonaws.com/BUCKET/KEY`) when connecting to an S3-compatible service that lacks support for sub-domain style bucket URLs (i.e. `http://BUCKET.s3.amazonaws.com/KEY`).
Defaults to false.
endpoint:
type: string
description: |
Overrides the default url to connect to an S3-compatible service.
For example: `http://s3-like-service:9000`.
region:
type: string
description: |
The AWS S3 region. The Region may be detected using s3:GetBucketLocation, but if you wish to avoid giving permissions to this API call or forbid it from the applicable IAM policy, you must then specify this property.
storageClass:
type: string
description: |
The [Amazon S3 Storage Class](https://aws.amazon.com/s3/storage-classes/) to use for the backup object storage. By default, the `STANDARD` storage class is used. Other supported values include `STANDARD_IA` for Infrequent Access and `REDUCED_REDUNDANCY`.
awsCredentials:
type: object
description: |
The credentials to access AWS S3 for writing and reading.
properties:
secretKeySelectors:
type: object
description: |
Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core)(s) to reference the Secret(s) that contain the information about the `awsCredentials`. Note that you may use the same or different Secrets for the `accessKeyId` and the `secretAccessKey`. In the former case, the `keys` that identify each must be, obviously, different.
properties:
accessKeyId:
type: object
description: |
AWS [access key ID](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). For example, `AKIAIOSFODNN7EXAMPLE`.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: ["key", "name"]
secretAccessKey:
type: object
description: |
AWS [secret access key](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). For example, `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: ["key", "name"]
caCertificate:
type: object
description: |
CA Certificate file to be used when connecting to the S3 Compatible Service.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: ["key", "name"]
required: ["accessKeyId", "secretAccessKey"]
required: ["secretKeySelectors"]
required: ["bucket", "awsCredentials"]
gcs:
type: object
description: |
Google Cloud Storage configuration.
properties:
bucket:
type: string
pattern: "^(gs://)?[^/]+(/[^/]*)*$"
description: |
GCS bucket name.
gcpCredentials:
type: object
description: |
The credentials to access GCS for writing and reading.
properties:
fetchCredentialsFromMetadataService:
type: boolean
description: |
If true, the credentials will be fetched from the GCE/GKE metadata service and the field `secretKeySelectors` have to be set to null or omitted.
This is useful when running StackGres inside a GKE cluster using [Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity).
secretKeySelectors:
type: object
description: |
A Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) to reference the Secrets that contain the information about the Service Account to access GCS.
properties:
serviceAccountJSON:
type: object
description: |
A service account key from GCP. In JSON format, as downloaded from the GCP Console.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [ "key", "name" ]
required: [ "serviceAccountJSON" ]
required: [ "bucket", "gcpCredentials" ]
azureBlob:
type: object
description: |
Azure Blob Storage configuration.
properties:
bucket:
type: string
pattern: "^(azure://)?[^/]+(/[^/]*)*$"
description: |
Azure Blob Storage bucket name.
azureCredentials:
type: object
description: |
The credentials to access Azure Blob Storage for writing and reading.
properties:
secretKeySelectors:
type: object
description: |
Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core)(s) to reference the Secret(s) that contain the information about the `azureCredentials`. . Note that you may use the same or different Secrets for the `storageAccount` and the `accessKey`. In the former case, the `keys` that identify each must be, obviously, different.
properties:
storageAccount:
type: object
description: |
The [Storage Account](https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview?toc=/azure/storage/blobs/toc.json) that contains the Blob bucket to be used.
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [ "key", "name" ]
accessKey:
type: object
description: |
The [storage account access key](https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal).
properties:
key:
type: string
description: |
The key of the secret to select from. Must be a valid secret key.
name:
type: string
description: |
Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
required: [ "key", "name" ]
required: [ "storageAccount", "accessKey" ]
required: [ "bucket", "azureCredentials" ]
required: [ "type" ]
@@ -0,0 +1,89 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sgpoolconfigs.stackgres.io
spec:
group: stackgres.io
scope: Namespaced
names:
kind: SGPoolingConfig
listKind: SGPoolingConfigList
plural: sgpoolconfigs
singular: sgpoolconfig
shortNames:
- sgpoc
- sgpoolingconfig
- sgpoolingconfigs
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
required: ["metadata", "spec"]
properties:
metadata:
type: object
properties:
name:
type: string
description: |
Name of the Connection Pooling Configuration. The configuration may be referenced by zero or more SGClusters, and if so it would be referenced by its name. Following [Kubernetes naming conventions](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md), it must be an rfc1035/rfc1123 subdomain, that is, up to 253 characters consisting of one or more lowercase labels separated by `.`. Where each label is an alphanumeric (a-z, and 0-9) string, with the `-` character allowed anywhere except the first or last character.
The name must be unique across all Connection Pooling configurations in the same namespace.
spec:
type: object
properties:
pgBouncer:
type: object
description: |
Connection pooling configuration based on PgBouncer.
properties:
pgbouncer.ini:
type: object
description: |
The `pgbouncer.ini` parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#generic-settings) for more information about supported parameters.
properties:
pgbouncer:
type: object
additionalProperties: true
description: |
The `pgbouncer.ini` (Section [pgbouncer]) parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#generic-settings) for more information about supported parameters
databases:
type: object
additionalProperties:
type: object
additionalProperties: true
description: |
The `pgbouncer.ini` (Section [databases]) parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#section-databases) for more information about supported parameters.
users:
type: object
additionalProperties:
type: object
additionalProperties: true
description: |
The `pgbouncer.ini` (Section [users]) parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#section-users) for more information about supported parameters.
status:
type: object
properties:
pgBouncer:
type: object
description: |
Connection pooling configuration status based on PgBouncer.
properties:
defaultParameters:
type: object
additionalProperties:
type: string
description: |
The `pgbouncer.ini` default parameters parameters which are used if not set.
required: ["defaultParameters"]
@@ -0,0 +1,66 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sgpgconfigs.stackgres.io
spec:
group: stackgres.io
scope: Namespaced
names:
kind: SGPostgresConfig
listKind: SGPostgresConfigList
plural: sgpgconfigs
singular: sgpgconfig
shortNames:
- sgpgc
- sgpostgresconfig
- sgpostgresconfigs
versions:
- name: v1
served: true
storage: true
additionalPrinterColumns:
- name: version
type: string
jsonPath: .spec.postgresVersion
schema:
openAPIV3Schema:
type: object
required: ["metadata", "spec"]
properties:
metadata:
type: object
properties:
name:
type: string
description: |
Name of the Postgres Configuration. The configuration may be referenced by zero or more SGClusters, and if so it would be referenced by its name. Following [Kubernetes naming conventions](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md), it must be an rfc1035/rfc1123 subdomain, that is, up to 253 characters consisting of one or more lowercase labels separated by `.`. Where each label is an alphanumeric (a-z, and 0-9) string, with the `-` character allowed anywhere except the first or last character.
The name must be unique across all Postgres configurations in the same namespace.
spec:
type: object
properties:
postgresVersion:
type: string
description: |
The **major** Postgres version the configuration is for. Postgres major versions contain one number starting with version 10 (`10`, `11`, `12`, etc), and two numbers separated by a dot for previous versions (`9.6`, `9.5`, etc).
Note that Postgres maintains full compatibility across minor versions, and hence a configuration for a given major version will work for any minor version of that same major version.
Check [StackGres component versions](https://stackgres.io/doc/latest/intro/versions) to see the Postgres versions supported by this version of StackGres.
postgresql.conf:
type: object
additionalProperties:
type: string
description: |
The `postgresql.conf` parameters the configuration contains, represented as an object where the keys are valid names for the `postgresql.conf` configuration file parameters of the given `postgresVersion`. You may check [postgresqlco.nf](https://postgresqlco.nf) as a reference on how to tune and find the valid parameters for a given major version.
required: ["postgresVersion", "postgresql.conf"]
status:
type: object
properties:
defaultParameters:
type: object
additionalProperties:
type: string
description: |
The `postgresql.conf` default parameters which are used if not set.
required: ["defaultParameters"]
+163
View File
@@ -0,0 +1,163 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sgscripts.stackgres.io
spec:
group: stackgres.io
scope: Namespaced
names:
kind: SGScript
listKind: SGScriptList
plural: sgscripts
singular: sgscript
shortNames:
- sgscr
versions:
- name: v1
served: true
storage: true
additionalPrinterColumns:
- name: scripts
type: string
jsonPath: .spec.scripts.length
schema:
openAPIV3Schema:
type: object
required: ["metadata", "spec"]
properties:
metadata:
type: object
properties:
name:
type: string
maxLength: 52
pattern: "^[a-z]([-a-z0-9]*[a-z0-9])?$"
description: |
Name of the StackGres script. Following [Kubernetes naming conventions](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md), it must be an rfc1035/rfc1123 subdomain, that is, up to 253 characters consisting of one or more lowercase labels separated by `.`. Where each label is an alphanumeric (a-z, and 0-9) string, with the `-` character allowed anywhere except the first or last character.
The name must be unique across all StackGres scripts in the same namespace. The full script name includes the namespace in which the script is created.
spec:
type: object
properties:
managedVersions:
type: boolean
description: |
If `true` the versions will be managed by the operator automatically. The user will still be able to update them if needed. `true` by default.
continueOnError:
type: boolean
description: |
If `true`, when any script entry fail will not prevent subsequent script entries from being executed. `false` by default.
scripts:
type: array
description: |
A list of SQL scripts.
items:
type: object
description: |
Scripts are executed in auto-commit mode with the user `postgres` in the specified database (or in database `postgres` if not specified).
Fields `script` and `scriptFrom` are mutually exclusive and only one of them is required.
properties:
name:
type: string
description: |
Name of the script. Must be unique across this SGScript.
id:
type: integer
description: |
The id is immutable and must be unique across all the script entries. It is replaced by the operator and is used to identify the script for the whole life of the `SGScript` object.
version:
type: integer
description: |
Version of the script. It will allow to identify if this script entry has been changed.
database:
type: string
description: |
Database where the script is executed. Defaults to the `postgres` database, if not specified.
user:
type: string
description: |
User that will execute the script. Defaults to the `postgres` user.
wrapInTransaction:
type: string
description: |
Wrap the script in a transaction using the specified transaction mode:
* `read-committed`: The script will be wrapped in a transaction using [READ COMMITTED](https://www.postgresql.org/docs/current/transaction-iso.html#XACT-READ-COMMITTED) isolation level.
* `repeatable-read`: The script will be wrapped in a transaction using [REPEATABLE READ](https://www.postgresql.org/docs/current/transaction-iso.html#XACT-REPEATABLE-READ) isolation level.
* `serializable`: The script will be wrapped in a transaction using [SERIALIZABLE](https://www.postgresql.org/docs/current/transaction-iso.html#XACT-SERIALIZABLE) isolation level.
If not set the script entry will not be wrapped in a transaction
storeStatusInDatabase:
type: boolean
description: |
When set to `true` the script entry execution will include storing the status of the execution of this
script entry in the table `managed_sql.status` that will be created in the specified `database`. This
will avoid an operation that fails partially to be unrecoverable requiring the intervention from the user
if user in conjunction with `retryOnError`.
If set to `true` then `wrapInTransaction` field must be set.
This is `false` by default.
retryOnError:
type: boolean
description: |
If not set or set to `false` the script entry will not be retried if it fails.
When set to `true` the script execution will be retried with an exponential backoff of 5 minutes,
starting from 10 seconds and a standard deviation of 10 seconds.
This is `false` by default.
script:
type: string
description: |
Raw SQL script to execute. This field is mutually exclusive with `scriptFrom` field.
scriptFrom:
type: object
description: |
Reference to either a Kubernetes [Secret](https://kubernetes.io/docs/concepts/configuration/secret/) or a [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) that contains the SQL script to execute. This field is mutually exclusive with `script` field.
Fields `secretKeyRef` and `configMapKeyRef` are mutually exclusive, and one of them is required.
properties:
secretKeyRef:
type: object
description: |
A Kubernetes [SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#secretkeyselector-v1-core) that contains the SQL script to execute. This field is mutually exclusive with `configMapKeyRef` field.
properties:
name:
type: string
description: Name of the referent. [More information](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
key:
type: string
description: The key of the secret to select from. Must be a valid secret key.
configMapKeyRef:
type: object
description: |
A [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) reference that contains the SQL script to execute. This field is mutually exclusive with `secretKeyRef` field.
properties:
name:
type: string
description: |
The name of the ConfigMap that contains the SQL script to execute.
key:
type: string
description: |
The key name within the ConfigMap that contains the SQL script to execute.
status:
type: object
properties:
scripts:
type: array
description: |
A list of script entry statuses where a script entry under `.spec.scripts` is identified by the `id` field.
items:
type: object
properties:
id:
type: integer
description: |
The id that identifies a script entry.
hash:
type: string
description: |
The hash of a ConfigMap or Secret referenced with the associated script entry.
@@ -0,0 +1,146 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: sgshardedbackups.stackgres.io
spec:
group: stackgres.io
scope: Namespaced
names:
kind: SGShardedBackup
listKind: SGShardedBackupList
plural: sgshardedbackups
singular: sgshardedbackup
shortNames:
- sgsbk
versions:
- name: v1
served: true
storage: true
additionalPrinterColumns:
- name: cluster
type: string
jsonPath: .spec.sgShardedCluster
- name: managed
type: string
jsonPath: .spec.managedLifecycle
- name: status
type: string
jsonPath: .status.process.status
- name: pg-version
type: string
jsonPath: .status.backupInformation.postgresVersion
priority: 1
- name: compressed-size
type: integer
format: byte
jsonPath: .status.backupInformation.size.compressed
priority: 1
schema:
openAPIV3Schema:
type: object
required: [metadata, spec]
description: |
A manual or automatically generated sharded backup of an SGCluster configured with an SGBackupConfig.
When a SGBackup is created a Job will perform a full sharded backup of the database and update the status of the SGBackup
with the all the information required to restore it and some stats (or a failure message in case something unexpected
happened).
After an SGBackup is created the same Job performs a reconciliation of the sharded backups by applying the retention window
that has been configured in the SGBackupConfig and removing the sharded backups with managed lifecycle and the WAL files older
than the ones that fit in the retention window. The reconciliation also removes sharded backups (excluding WAL files) that do
not belongs to any SGBackup. If the target storage of the SGBackupConfig is changed deletion of an SGBackup sharded backups
with managed lifecycle and the WAL files older than the ones that fit in the retention window and of sharded backups that do
not belongs to any SGBackup will not be performed anymore on the previous storage, only on the new target storage.
properties:
metadata:
type: object
properties:
name:
type: string
maxLength: 56
pattern: "^[a-z]([-a-z0-9]*[a-z0-9])?$"
description: |
Name of the sharded backup. Following [Kubernetes naming conventions](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md), it must be an rfc1035/rfc1123 subdomain, that is, up to 253 characters consisting of one or more lowercase labels separated by `.`. Where each label is an alphanumeric (a-z, and 0-9) string, with the `-` character allowed anywhere except the first or last character.
The name must be unique across all StackGres sharded backups in the same namespace."
spec:
type: object
properties:
sgShardedCluster:
type: string
description: |
The name of the `SGShardedCluster` from which this sharded backup is/will be taken.
If this is a copy of an existing completed sharded backup in a different namespace
the value must be prefixed with the namespace of the source backup and a
dot `.` (e.g. `<sharded cluster namespace>.<sharded cluster name>`) or have the same value
if the source sharded backup is also a copy.
managedLifecycle:
type: boolean
description: |
Indicate if this sharded backup is permanent and should not be removed by the automated
retention policy. Default is `false`.
status:
type: object
properties:
sgBackups:
type: array
description: |
The list of SGBackups that compose the SGShardedBackup used to restore the sharded cluster.
items:
type: string
description: |
One of the SGBackups that compose the SGShardedBackup used to restore the sharded cluster.
process:
type: object
properties:
status:
type: string
description: |
Status of the sharded backup.
failure:
type: string
description: |
If the status is `failed` this field will contain a message indicating the failure reason.
jobPod:
type: string
description: |
Name of the pod assigned to the sharded backup. StackGres utilizes internally a locking mechanism based on the pod name of the job that creates the sharded backup.
timing:
type: object
properties:
start:
type: string
# format: date-time
description: |
Start time of sharded backup.
end:
type: string
# format: date-time
description: |
End time of sharded backup.
stored:
type: string
# format: date-time
description: |
Time at which the sharded backup is safely stored in the object storage.
backupInformation:
type: object
properties:
postgresVersion:
type: string
description: |
Postgres version of the server where the sharded backup is taken from.
size:
type: object
properties:
uncompressed:
type: integer
format: int64
description: |
Size (in bytes) of the uncompressed sharded backup.
compressed:
type: integer
format: int64
description: |
Size (in bytes) of the compressed sharded backup.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long