Kind: SGDbOps
listKind: SGDbOpsList
plural: sgdbops
singular: sgdbops
shortNames sgdo
The SGDbOps
custom resource represents database operations that are performed on a Postgres cluster.
Example:
apiVersion: stackgres.io/v1
kind: SGDbOps
metadata:
name: benchmark
spec:
sgCluster: my-cluster
op: benchmark
maxRetries: 1
benchmark:
type: pgbench
pgbench:
databaseSize: 1Gi
duration: P0DT0H10M0S
concurrentClients: 10
threads: 10
connectionType: primary-service
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
apiVersion | ✓ | string | stackgres.io/v1 | ||
kind | ✓ | string | SGDbOps | ||
metadata | ✓ | ✓ | object | Refer to the Kubernetes API documentation for the fields of the metadata field. |
|
spec | ✓ | ✓ | object |
|
|
status | ✓ | object |
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
op | ✓ | ✓ | string |
The kind of operation that will be performed on the SGCluster. Available operations are:
|
|
sgCluster | ✓ | ✓ | string |
The name of SGCluster on which the operation will be performed.
|
|
benchmark | ✓ | object |
Configuration of the benchmark
|
||
majorVersionUpgrade | ✓ | object |
Configuration of major version upgrade (see also pg_upgrade command)
|
||
maxRetries | ✓ | integer |
The maximum number of retries the operation is allowed to do after a failure.
A value of |
||
minorVersionUpgrade | ✓ | object |
Configuration of minor version upgrade
|
||
repack | ✓ | object |
Configuration of pg_repack command
|
||
restart | ✓ | object |
Configuration of restart
|
||
runAt | ✓ | string |
An ISO 8601 date, that holds UTC scheduled date of the operation execution.
If not specified or if the date it’s in the past, it will be interpreted ASAP.
|
||
scheduling | ✓ | object |
Pod custom node scheduling and affinity configuration |
||
securityUpgrade | ✓ | object |
Configuration of security upgrade
|
||
timeout | ✓ | string |
An ISO 8601 duration in the format PnDTnHnMn.nS , that specifies a timeout after which the operation execution will be canceled.
If the operation can not be performed due to timeout expiration, the condition If not specified the operation will never fail for timeout expiration.
|
||
vacuum | ✓ | object |
Configuration of vacuum operation
|
Configuration of the benchmark
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
type | ✓ | ✓ | string |
The type of benchmark that will be performed on the SGCluster. Available benchmarks are:
|
|
connectionType | ✓ | string |
Specify the service where the benchmark will connect to:
|
||
pgbench | ✓ | object |
Configuration of pgbench benchmark
|
Configuration of pgbench benchmark
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
databaseSize | ✓ | ✓ | string |
Size of the database to generate. This size is specified either in Mebibytes, Gibibytes or Tebibytes (multiples of 2^20, 2^30 or 2^40, respectively).
|
|
duration | ✓ | ✓ | string |
An ISO 8601 duration in the format PnDTnHnMn.nS , that specifies how long the benchmark will run.
|
|
concurrentClients | ✓ | integer |
Number of clients simulated, that is, number of concurrent database sessions. Defaults to: 1 .
|
||
threads | ✓ | integer |
Number of worker threads within pgbench. Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1 .
|
||
usePreparedStatements | ✓ | boolean |
Use extended query protocol with prepared statements. Defaults to: false .
|
Configuration of major version upgrade (see also pg_upgrade
command)
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
backupPath | ✓ | string |
The path were the backup is stored. If not set this field is filled up by the operator.
When provided will indicate were the backups and WAL files will be stored. The path should be different from the current |
||
check | ✓ | boolean |
If true does some checks to see if the cluster can perform a major version upgrade without changing any data. Defaults to: false .
|
||
clone | ✓ | boolean |
If true use efficient file cloning (also known as “reflinks” on some systems) instead of copying files to the new cluster.
This can result in near-instantaneous copying of the data files, giving the speed advantages of link while leaving the old
cluster untouched. This option is mutually exclusive with link . Defaults to: false .
File cloning is only supported on some operating systems and file systems. If it is selected but not supported, the pg_upgrade
run will error. At present, it is supported on Linux (kernel 4.5 or later) with Btrfs and XFS (on file systems created with
reflink support), and on macOS with APFS.
|
||
link | ✓ | boolean |
If true use hard links instead of copying files to the new cluster. This option is mutually exclusive with clone . Defaults to: false .
|
||
postgresExtensions | ✓ | []object |
A major version upgrade can not be performed if a required extension is not present for the target major version of the upgrade.
In those cases you will have to provide the target extension version of the extension for the target major version of postgres.
Beware that in some cases it is not possible to upgrade an extension alongside postgres. This is the case for PostGIS or timescaledb.
In such cases you will have to upgrade the extension before or after the major version upgrade. Please make sure you read the
documentation of each extension in order to understand if it is possible to upgrade it during a major version upgrade of postgres.
|
||
postgresVersion | ✓ | string |
The target postgres version that must have the same major version of the target SGCluster.
|
||
sgPostgresConfig | ✓ | string |
The postgres config that must have the same major version of the target postgres version.
|
||
toInstallPostgresExtensions | ✓ | []object |
The list of Postgres extensions to install.
This section is filled by the operator.
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | ✓ | string |
The name of the extension to deploy. |
|
publisher | ✓ | string |
The id of the publisher of the extension to deploy. If not specified com.ongres will be used by default.Default: com.ongres |
||
repository | ✓ | string |
The repository base URL from where to obtain the extension to deploy.
This section is filled by the operator.
|
||
version | ✓ | string |
The version of the extension to deploy. If not specified version of stable channel will be used by default and if only a version is available that one will be used. |
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | ✓ | string |
The name of the extension to install. |
|
postgresVersion | ✓ | ✓ | string |
The postgres major version of the extension to install. |
|
publisher | ✓ | ✓ | string |
The id of the publisher of the extension to install. |
|
repository | ✓ | ✓ | string |
The repository base URL from where the extension will be installed from. |
|
version | ✓ | ✓ | string |
The version of the extension to install. |
|
build | ✓ | string |
The build version of the extension to install. |
||
extraMounts | ✓ | []string |
The extra mounts of the extension to install. |
Configuration of minor version upgrade
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
method | ✓ | string |
The method used to perform the minor version upgrade operation. Available methods are:
|
||
postgresVersion | ✓ | string |
The target postgres version that must have the same major version of the target SGCluster.
|
Configuration of pg_repack
command
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
databases | ✓ | []object |
List of database to vacuum or repack, don’t specify to select all databases
|
||
excludeExtension | ✓ | boolean |
If true don’t repack tables which belong to specific extension. Defaults to: false .
|
||
noAnalyze | ✓ | boolean |
If true don’t analyze at end. Defaults to: false .
|
||
noKillBackend | ✓ | boolean |
If true don’t kill other backends when timed out. Defaults to: false .
|
||
noOrder | ✓ | boolean |
If true do vacuum full instead of cluster. Defaults to: false .
|
||
waitTimeout | ✓ | string |
If specified, an ISO 8601 duration format PnDTnHnMn.nS to set a timeout to cancel other backends on conflict.
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | ✓ | string |
the name of the database |
|
excludeExtension | ✓ | boolean |
If true don’t repack tables which belong to specific extension. Defaults to: false .
|
||
noAnalyze | ✓ | boolean |
If true don’t analyze at end. Defaults to: false .
|
||
noKillBackend | ✓ | boolean |
If true don’t kill other backends when timed out. Defaults to: false .
|
||
noOrder | ✓ | boolean |
If true do vacuum full instead of cluster. Defaults to: false .
|
||
waitTimeout | ✓ | string |
If specified, an ISO 8601 duration format PnDTnHnMn.nS to set a timeout to cancel other backends on conflict.
|
Configuration of restart
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
method | ✓ | string |
The method used to perform the restart operation. Available methods are:
|
||
onlyPendingRestart | ✓ | boolean |
By default all Pods are restarted. Setting this option to true allow to restart only those Pods which
are in pending restart state as detected by the operation. Defaults to: false .
|
Pod custom node scheduling and affinity configuration
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
nodeAffinity | ✓ | object |
Node affinity is a group of node affinity scheduling rules.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#nodeaffinity-v1-core
|
||
nodeSelector | ✓ | map[string]string |
NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node’s labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
|
||
podAffinity | ✓ | object |
Pod affinity is a group of inter pod affinity scheduling rules.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#podaffinity-v1-core
|
||
podAntiAffinity | ✓ | object |
Pod anti affinity is a group of inter pod anti affinity scheduling rules.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#podantiaffinity-v1-core
|
||
priorityClassName | ✓ | string |
Priority indicates the importance of a Pod relative to other Pods. If a Pod cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling of the pending Pod possible.
|
||
tolerations | ✓ | []object |
If specified, the pod’s tolerations.
See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#toleration-v1-core
|
Configuration of security upgrade
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
method | ✓ | string |
The method used to perform the security upgrade operation. Available methods are:
|
Configuration of vacuum operation
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
analyze | ✓ | boolean |
If true, updates statistics used by the planner to determine the most efficient way to execute a query. Defaults to: true .
|
||
databases | ✓ | []object |
List of databases to vacuum or repack, don’t specify to select all databases
|
||
disablePageSkipping | ✓ | boolean |
Normally, VACUUM will skip pages based on the visibility map. Pages where all tuples are known to be frozen can always be
skipped, and those where all tuples are known to be visible to all transactions may be skipped except when performing an
aggressive vacuum. Furthermore, except when performing an aggressive vacuum, some pages may be skipped in order to avoid
waiting for other sessions to finish using them. This option disables all page-skipping behavior, and is intended to be
used only when the contents of the visibility map are suspect, which should happen only if there is a hardware or
software issue causing database corruption. Defaults to: false .
|
||
freeze | ✓ | boolean |
If true selects aggressive “freezing” of tuples. Specifying FREEZE is equivalent to performing VACUUM with the
vacuum_freeze_min_age and vacuum_freeze_table_age parameters set to zero. Aggressive freezing is always performed
when the table is rewritten, so this option is redundant when FULL is specified. Defaults to: false .
|
||
full | ✓ | boolean |
If true selects “full” vacuum, which can reclaim more space, but takes much longer and exclusively locks the table.
This method also requires extra disk space, since it writes a new copy of the table and doesn’t release the old copy
until the operation is complete. Usually this should only be used when a significant amount of space needs to be
reclaimed from within the table. Defaults to: false .
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
name | ✓ | ✓ | string |
the name of the database |
|
analyze | ✓ | boolean |
If true, updates statistics used by the planner to determine the most efficient way to execute a query. Defaults to: true .
|
||
disablePageSkipping | ✓ | boolean |
Normally, VACUUM will skip pages based on the visibility map. Pages where all tuples are known to be frozen can always be
skipped, and those where all tuples are known to be visible to all transactions may be skipped except when performing an
aggressive vacuum. Furthermore, except when performing an aggressive vacuum, some pages may be skipped in order to avoid
waiting for other sessions to finish using them. This option disables all page-skipping behavior, and is intended to be
used only when the contents of the visibility map are suspect, which should happen only if there is a hardware or
software issue causing database corruption. Defaults to: false .
|
||
freeze | ✓ | boolean |
If true selects aggressive “freezing” of tuples. Specifying FREEZE is equivalent to performing VACUUM with the
vacuum_freeze_min_age and vacuum_freeze_table_age parameters set to zero. Aggressive freezing is always performed
when the table is rewritten, so this option is redundant when FULL is specified. Defaults to: false .
|
||
full | ✓ | boolean |
If true selects “full” vacuum, which can reclaim more space, but takes much longer and exclusively locks the table.
This method also requires extra disk space, since it writes a new copy of the table and doesn’t release the old copy
until the operation is complete. Usually this should only be used when a significant amount of space needs to be
reclaimed from within the table. Defaults to: false .
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
benchmark | ✓ | object |
The results of the benchmark
|
||
conditions | ✓ | []object |
Possible conditions are:
|
||
majorVersionUpgrade | ✓ | object |
The results of a major version upgrade
|
||
minorVersionUpgrade | ✓ | object |
The results of a minor version upgrade
|
||
opRetries | ✓ | integer |
The number of retries performed by the operation
|
||
opStarted | ✓ | string |
The ISO 8601 timestamp of when the operation started running
|
||
restart | ✓ | object |
The results of a restart
|
||
securityUpgrade | ✓ | object |
The results of a security upgrade
|
The results of the benchmark
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
pgbench | ✓ | object |
The results of the pgbench benchmark
|
The results of the pgbench benchmark
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
latency | ✓ | object |
The latency results of the pgbench benchmark
|
||
scaleFactor | ✓ | number |
The scale factor used to run pgbench (--scale ).
|
||
transactionsPerSecond | ✓ | object |
All the transactions per second results of the pgbench benchmark
|
||
transactionsProcessed | ✓ | integer |
The number of transactions processed.
|
The latency results of the pgbench benchmark
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
average | ✓ | object |
Average latency of transactions
|
||
standardDeviation | ✓ | object |
The latency standard deviation of transactions.
|
Average latency of transactions
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
unit | ✓ | string |
The latency measure unit represented in milliseconds
|
||
value | ✓ | number |
The latency average value
|
The latency standard deviation of transactions.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
unit | ✓ | string |
The latency measure unit represented in milliseconds
|
||
value | ✓ | number |
The latency standard deviation value
|
All the transactions per second results of the pgbench benchmark
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
excludingConnectionsEstablishing | ✓ | object |
Number of Transaction Per Second (tps) excluding connection establishing.
|
||
includingConnectionsEstablishing | ✓ | object |
Number of Transaction Per Second (tps) including connection establishing.
|
Number of Transaction Per Second (tps) excluding connection establishing.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
unit | ✓ | string |
Transaction Per Second (tps) measure
|
||
value | ✓ | number |
The Transaction Per Second (tps) excluding connections establishing value
|
Number of Transaction Per Second (tps) including connection establishing.
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
unit | ✓ | string |
Transaction Per Second (tps) measure
|
||
value | ✓ | number |
The Transaction Per Second (tps) including connections establishing value
|
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
lastTransitionTime | ✓ | string |
Last time the condition transitioned from one status to another. |
||
message | ✓ | string |
A human-readable message indicating details about the transition. |
||
reason | ✓ | string |
The reason for the condition last transition. |
||
status | ✓ | string |
Status of the condition, one of True , False or Unknown . |
||
type | ✓ | string |
Type of deployment condition. |
The results of a major version upgrade
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
failure | ✓ | string |
A failure message (when available)
|
||
initialInstances | ✓ | []string |
The instances present when the operation started
|
||
pendingToRestartInstances | ✓ | []string |
The instances that are pending to be restarted
|
||
phase | ✓ | string |
The phase the operation is or was executing)
|
||
primaryInstance | ✓ | string |
The primary instance when the operation started
|
||
restartedInstances | ✓ | []string |
The instances that have been restarted
|
||
sourcePostgresVersion | ✓ | string |
The postgres version currently used by the primary instance
|
||
targetPostgresVersion | ✓ | string |
The postgres version that the cluster will be upgraded to
|
The results of a minor version upgrade
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
failure | ✓ | string |
A failure message (when available)
|
||
initialInstances | ✓ | []string |
The instances present when the operation started
|
||
pendingToRestartInstances | ✓ | []string |
The instances that are pending to be restarted
|
||
primaryInstance | ✓ | string |
The primary instance when the operation started
|
||
restartedInstances | ✓ | []string |
The instances that have been restarted
|
||
sourcePostgresVersion | ✓ | string |
The postgres version currently used by the primary instance
|
||
switchoverFinalized | ✓ | string |
An ISO 8601 date indicating if and when the switchover finalized
|
||
switchoverInitiated | ✓ | string |
An ISO 8601 date indicating if and when the switchover initiated
|
||
targetPostgresVersion | ✓ | string |
The postgres version that the cluster will be upgraded (or downgraded) to
|
The results of a restart
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
failure | ✓ | string |
A failure message (when available)
|
||
initialInstances | ✓ | []string |
The instances present when the operation started
|
||
pendingToRestartInstances | ✓ | []string |
The instances that are pending to be restarted
|
||
primaryInstance | ✓ | string |
The primary instance when the operation started
|
||
restartedInstances | ✓ | []string |
The instances that have been restarted
|
||
switchoverFinalized | ✓ | string |
An ISO 8601 date indicating if and when the switchover finalized
|
||
switchoverInitiated | ✓ | string |
An ISO 8601 date indicating if and when the switchover initiated
|
The results of a security upgrade
Property |
Required |
Updatable |
May Require Restart |
Type |
Description |
---|---|---|---|---|---|
failure | ✓ | string |
A failure message (when available)
|
||
initialInstances | ✓ | []string |
The instances present when the operation started
|
||
pendingToRestartInstances | ✓ | []string |
The instances that are pending to be restarted
|
||
primaryInstance | ✓ | string |
The primary instance when the operation started
|
||
restartedInstances | ✓ | []string |
The instances that have been restarted
|
||
switchoverFinalized | ✓ | string |
An ISO 8601 date indicating if and when the switchover finalized
|
||
switchoverInitiated | ✓ | string |
An ISO 8601 date indicating if and when the switchover initiated
|