Skip to content

Commit a266886

Browse files
authored
Add tablespace alpha functionality (CrunchyData#3575)
* Adds the tablespaceVolumes field to the CRD; * Adds basic tablespace functionality: mounts the volumes and preps them with correct permissions; * Adds option for restoring with tablespaces (needs more testing); * Adds docs/content/guides/tablespaces * Adds a basic KUTTL test for creating a cluster with tablespaces; * Updates the github test to add the feature gate Issue: [sc-17759]
1 parent 3201831 commit a266886

File tree

26 files changed

+1360
-15
lines changed

26 files changed

+1360
-15
lines changed

.github/workflows/test.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ jobs:
130130
--env 'RELATED_IMAGE_POSTGRES_13_GIS_3.1=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-13.9-3.1-2' \
131131
--env 'RELATED_IMAGE_POSTGRES_14=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.6-2' \
132132
--env 'RELATED_IMAGE_POSTGRES_14_GIS_3.1=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.6-3.1-2' \
133+
--env 'PGO_FEATURE_GATES=TablespaceVolumes=true' \
133134
--name 'postgres-operator' ubuntu \
134135
postgres-operator
135136
- name: Install kuttl

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ deploy-dev: createnamespaces
138138
hack/create-kubeconfig.sh postgres-operator pgo
139139
env \
140140
CRUNCHY_DEBUG=true \
141+
PGO_FEATURE_GATES="TablespaceVolumes=true" \
141142
CHECK_FOR_UPGRADES='$(if $(CHECK_FOR_UPGRADES),$(CHECK_FOR_UPGRADES),false)' \
142143
KUBECONFIG=hack/.kube/postgres-operator/pgo \
143144
PGO_NAMESPACE='postgres-operator' \

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

+200
Original file line numberDiff line numberDiff line change
@@ -9456,6 +9456,206 @@ spec:
94569456
type: object
94579457
type: object
94589458
type: object
9459+
tablespaceVolumes:
9460+
description: The list of tablespaces volumes to mount for this
9461+
postgrescluster This function is currently in alpha as of
9462+
PGO v5.4
9463+
items:
9464+
properties:
9465+
dataVolumeClaimSpec:
9466+
description: 'Defines a PersistentVolumeClaim for a tablespace.
9467+
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes'
9468+
properties:
9469+
accessModes:
9470+
description: 'accessModes contains the desired access
9471+
modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1'
9472+
items:
9473+
type: string
9474+
type: array
9475+
dataSource:
9476+
description: 'dataSource field can be used to specify
9477+
either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
9478+
* An existing PVC (PersistentVolumeClaim) If the
9479+
provisioner or an external controller can support
9480+
the specified data source, it will create a new
9481+
volume based on the contents of the specified data
9482+
source. If the AnyVolumeDataSource feature gate
9483+
is enabled, this field will always have the same
9484+
contents as the DataSourceRef field.'
9485+
properties:
9486+
apiGroup:
9487+
description: APIGroup is the group for the resource
9488+
being referenced. If APIGroup is not specified,
9489+
the specified Kind must be in the core API group.
9490+
For any other third-party types, APIGroup is
9491+
required.
9492+
type: string
9493+
kind:
9494+
description: Kind is the type of resource being
9495+
referenced
9496+
type: string
9497+
name:
9498+
description: Name is the name of resource being
9499+
referenced
9500+
type: string
9501+
required:
9502+
- kind
9503+
- name
9504+
type: object
9505+
dataSourceRef:
9506+
description: 'dataSourceRef specifies the object from
9507+
which to populate the volume with data, if a non-empty
9508+
volume is desired. This may be any local object
9509+
from a non-empty API group (non core object) or
9510+
a PersistentVolumeClaim object. When this field
9511+
is specified, volume binding will only succeed if
9512+
the type of the specified object matches some installed
9513+
volume populator or dynamic provisioner. This field
9514+
will replace the functionality of the DataSource
9515+
field and as such if both fields are non-empty,
9516+
they must have the same value. For backwards compatibility,
9517+
both fields (DataSource and DataSourceRef) will
9518+
be set to the same value automatically if one of
9519+
them is empty and the other is non-empty. There
9520+
are two important differences between DataSource
9521+
and DataSourceRef: * While DataSource only allows
9522+
two specific types of objects, DataSourceRef allows
9523+
any non-core object, as well as PersistentVolumeClaim
9524+
objects. * While DataSource ignores disallowed values
9525+
(dropping them), DataSourceRef preserves all values,
9526+
and generates an error if a disallowed value is
9527+
specified. (Beta) Using this field requires the
9528+
AnyVolumeDataSource feature gate to be enabled.'
9529+
properties:
9530+
apiGroup:
9531+
description: APIGroup is the group for the resource
9532+
being referenced. If APIGroup is not specified,
9533+
the specified Kind must be in the core API group.
9534+
For any other third-party types, APIGroup is
9535+
required.
9536+
type: string
9537+
kind:
9538+
description: Kind is the type of resource being
9539+
referenced
9540+
type: string
9541+
name:
9542+
description: Name is the name of resource being
9543+
referenced
9544+
type: string
9545+
required:
9546+
- kind
9547+
- name
9548+
type: object
9549+
resources:
9550+
description: 'resources represents the minimum resources
9551+
the volume should have. If RecoverVolumeExpansionFailure
9552+
feature is enabled users are allowed to specify
9553+
resource requirements that are lower than previous
9554+
value but must still be higher than capacity recorded
9555+
in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources'
9556+
properties:
9557+
limits:
9558+
additionalProperties:
9559+
anyOf:
9560+
- type: integer
9561+
- type: string
9562+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
9563+
x-kubernetes-int-or-string: true
9564+
description: 'Limits describes the maximum amount
9565+
of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
9566+
type: object
9567+
requests:
9568+
additionalProperties:
9569+
anyOf:
9570+
- type: integer
9571+
- type: string
9572+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
9573+
x-kubernetes-int-or-string: true
9574+
description: 'Requests describes the minimum amount
9575+
of compute resources required. If Requests is
9576+
omitted for a container, it defaults to Limits
9577+
if that is explicitly specified, otherwise to
9578+
an implementation-defined value. More info:
9579+
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
9580+
type: object
9581+
type: object
9582+
selector:
9583+
description: selector is a label query over volumes
9584+
to consider for binding.
9585+
properties:
9586+
matchExpressions:
9587+
description: matchExpressions is a list of label
9588+
selector requirements. The requirements are
9589+
ANDed.
9590+
items:
9591+
description: A label selector requirement is
9592+
a selector that contains values, a key, and
9593+
an operator that relates the key and values.
9594+
properties:
9595+
key:
9596+
description: key is the label key that the
9597+
selector applies to.
9598+
type: string
9599+
operator:
9600+
description: operator represents a key's
9601+
relationship to a set of values. Valid
9602+
operators are In, NotIn, Exists and DoesNotExist.
9603+
type: string
9604+
values:
9605+
description: values is an array of string
9606+
values. If the operator is In or NotIn,
9607+
the values array must be non-empty. If
9608+
the operator is Exists or DoesNotExist,
9609+
the values array must be empty. This array
9610+
is replaced during a strategic merge patch.
9611+
items:
9612+
type: string
9613+
type: array
9614+
required:
9615+
- key
9616+
- operator
9617+
type: object
9618+
type: array
9619+
matchLabels:
9620+
additionalProperties:
9621+
type: string
9622+
description: matchLabels is a map of {key,value}
9623+
pairs. A single {key,value} in the matchLabels
9624+
map is equivalent to an element of matchExpressions,
9625+
whose key field is "key", the operator is "In",
9626+
and the values array contains only "value".
9627+
The requirements are ANDed.
9628+
type: object
9629+
type: object
9630+
storageClassName:
9631+
description: 'storageClassName is the name of the
9632+
StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1'
9633+
type: string
9634+
volumeMode:
9635+
description: volumeMode defines what type of volume
9636+
is required by the claim. Value of Filesystem is
9637+
implied when not included in claim spec.
9638+
type: string
9639+
volumeName:
9640+
description: volumeName is the binding reference to
9641+
the PersistentVolume backing this claim.
9642+
type: string
9643+
type: object
9644+
name:
9645+
description: The name for the tablespace, used as the
9646+
path name for the volume. Must be unique in the instance
9647+
set since they become the directory names.
9648+
minLength: 1
9649+
pattern: ^[a-z][a-z0-9]*$
9650+
type: string
9651+
required:
9652+
- dataVolumeClaimSpec
9653+
- name
9654+
type: object
9655+
type: array
9656+
x-kubernetes-list-map-keys:
9657+
- name
9658+
x-kubernetes-list-type: map
94599659
tolerations:
94609660
description: 'Tolerations of a PostgreSQL pod. Changing this
94619661
value causes PostgreSQL to restart. More info: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration'

0 commit comments

Comments
 (0)