hive-apps/projects/crossplane/manifests/composition-postgres.yml

165 lines
4.9 KiB
YAML
Raw Normal View History

2023-11-08 08:09:04 +00:00
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
labels:
provider: cnpg
name: postgres.gnu.one
spec:
compositeTypeRef:
apiVersion: db.gnu.one/v1alpha2
kind: XPostgres
mode: Resources
patchSets:
- name: common
patches:
- fromFieldPath: spec.name
toFieldPath: spec.forProvider.manifest.metadata.name
type: FromCompositeFieldPath
- fromFieldPath: spec.name
toFieldPath: spec.forProvider.manifest.spec.name
type: FromCompositeFieldPath
- fromFieldPath: metadata.labels[crossplane.io/claim-namespace]
toFieldPath: spec.forProvider.manifest.metadata.namespace
type: FromCompositeFieldPath
publishConnectionDetailsWithStoreConfigRef:
name: default
resources:
- base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: s3.gnu.one/v1alpha1
kind: Bucket
metadata:
namespace: namespace
spec:
name: name
name: bucket
patches:
- patchSetName: common
type: PatchSet
readinessChecks:
- matchCondition:
status: "True"
type: Ready
type: MatchCondition
- base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
namespace: namespace
spec:
backup:
barmanObjectStore:
data:
compression: gzip
destinationPath: s3://backup
endpointURL: http://s3-minio.s3.svc.cluster.local:9000
s3Credentials:
accessKeyId:
key: access_key
name: bucket-creds
secretAccessKey:
key: secret_key
name: bucket-creds
wal:
compression: gzip
retentionPolicy: 90d
bootstrap:
initdb:
database: app
owner: app
externalClusters:
- barmanObjectStore:
destinationPath: s3://bucket/
endpointURL: http://s3-minio.s3.svc.cluster.local:9000
s3Credentials:
accessKeyId:
key: access_key
name: bucket-creds
secretAccessKey:
key: secret_key
name: bucket-creds
wal:
maxParallel: 8
name: db
imageName: ghcr.io/cloudnative-pg/postgresql:15
instances: 1
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 50m
memory: 64Mi
storage:
size: 10Gi
name: postgres-db
patches:
- patchSetName: common
type: PatchSet
- fromFieldPath: spec.name
toFieldPath: spec.forProvider.manifest.spec.backup.barmanObjectStore.destinationPath
transforms:
- string:
fmt: s3://%s/
type: Format
type: string
type: FromCompositeFieldPath
- fromFieldPath: spec.instances
toFieldPath: spec.forProvider.manifest.spec.instances
type: FromCompositeFieldPath
- fromFieldPath: spec.name
toFieldPath: spec.forProvider.manifest.spec.externalClusters[0].barmanObjectStore.destinationPath
transforms:
- string:
fmt: s3://%s/
type: Format
type: string
type: FromCompositeFieldPath
- fromFieldPath: spec.storage.size
toFieldPath: spec.forProvider.manifest.spec.storage.size
type: FromCompositeFieldPath
- fromFieldPath: spec.storage.class
toFieldPath: spec.forProvider.manifest.spec.storage.storageClass
type: FromCompositeFieldPath
readinessChecks:
- matchCondition:
status: "True"
type: Ready
type: MatchCondition
- base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
namespace: namespace
spec:
backupOwnerReference: self
cluster:
name: name
schedule: 0 0 * * * *
name: postgres-backup
patches:
- patchSetName: common
type: PatchSet
- fromFieldPath: spec.name
toFieldPath: spec.forProvider.manifest.spec.cluster.name
type: FromCompositeFieldPath
readinessChecks:
- matchCondition:
status: "True"
type: Ready
type: MatchCondition