Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5a9fd78
K8SPSMDB-1237: add incremental backups
pooknull Feb 18, 2025
3642e59
Merge branch 'main' into K8SPSMDB-1237
pooknull Feb 18, 2025
3089c9f
fix tests
pooknull Feb 19, 2025
d027dc4
Merge branch 'main' into K8SPSMDB-1237
pooknull Feb 19, 2025
cb39268
Merge branch 'main' into K8SPSMDB-1237
hors Feb 20, 2025
fdf064a
Merge branch 'main' into K8SPSMDB-1237
hors Feb 25, 2025
2e048f7
Merge branch 'main' into K8SPSMDB-1237
hors Feb 25, 2025
12cb4da
use incremental-base backup type
pooknull Feb 25, 2025
20a094a
Merge branch 'main' into K8SPSMDB-1237
pooknull Feb 25, 2025
fd681cf
fix
pooknull Feb 25, 2025
be557c2
add examples to deploy/backup.yaml
pooknull Feb 25, 2025
9cf30c3
add proper example to deploy/cr.yaml
pooknull Feb 25, 2025
f533760
small improvements
pooknull Feb 28, 2025
1386647
Merge branch 'main' into K8SPSMDB-1237
pooknull Feb 28, 2025
60235d1
make manifests
pooknull Feb 28, 2025
2280fca
update tests
pooknull Feb 28, 2025
9b5d933
fix tests
pooknull Mar 1, 2025
ea262f8
fix incremental-base restore
egegunes Mar 3, 2025
5e3b374
Merge branch 'main' into K8SPSMDB-1237
pooknull Mar 4, 2025
3c9f920
Merge branch 'main' into K8SPSMDB-1237
hors Mar 4, 2025
b5c517f
fix incremental tests
hors Mar 4, 2025
9f69f5a
fix scheduled backups and disable delete-backup finalizer
pooknull Mar 5, 2025
0f5899e
fix CVE
hors Mar 6, 2025
88a7ff1
allow incremental-base to use finalizer and .keep
pooknull Mar 6, 2025
48f95f9
fix `multi-storage` test
pooknull Mar 6, 2025
ed8e6bc
Merge branch 'main' into K8SPSMDB-1237
egegunes Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
type: object
status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
required:
- enabled
Expand Down
4 changes: 4 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
type: object
status:
Expand Down Expand Up @@ -1093,6 +1095,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
required:
- enabled
Expand Down
16 changes: 16 additions & 0 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -723,3 +723,19 @@ spec:
# storageName: s3-us-west
# compressionType: gzip
# compressionLevel: 6
# - name: weekly-s3-us-west-incremental
# enabled: false
# schedule: "0 1 * * *"
# keep: 5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pooknull please check how the retention works for incremental backups. We can implement it in next release but now we need to remove "keep" option from incremental.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# type: incremental
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pooknull I have error when I try to use it

# perconaservermongodbs.psmdb.percona.com "some-name" was not valid:
# * spec.backup.tasks[0].type: Unsupported value: "incremental": supported values: "logical", "physical"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to skip percona.com/delete-backup finalizer for incremental backups
If we delete the base backup, all incremental backups should be deleted as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# storageName: s3-us-west
# compressionType: gzip
# compressionLevel: 6
# - name: weekly-s3-us-west-incremental-base
# enabled: false
# schedule: "0 5 * * 0"
# keep: 5
# type: incremental-base
# storageName: s3-us-west
# compressionType: gzip
# compressionLevel: 6
4 changes: 4 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
type: object
status:
Expand Down Expand Up @@ -1093,6 +1095,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
required:
- enabled
Expand Down
4 changes: 4 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
type: object
status:
Expand Down Expand Up @@ -1093,6 +1095,8 @@ spec:
enum:
- logical
- physical
- incremental
- incremental-base
type: string
required:
- enabled
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
switched to db myApp
{ "_id" : , "x" : 100501 }
{ "_id" : , "x" : 100502 }
bye
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
switched to db myApp
{ "_id" : , "x" : 100501 }
bye
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
switched to db myApp
{ "_id" : , "x" : 100500 }
bye
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
annotations:
percona.com/restore-in-progress: "true"
generation: 2
labels:
app.kubernetes.io/component: mongod
app.kubernetes.io/instance: some-name
app.kubernetes.io/managed-by: percona-server-mongodb-operator
app.kubernetes.io/name: percona-server-mongodb
app.kubernetes.io/part-of: percona-server-mongodb
app.kubernetes.io/replset: rs0
name: some-name-rs0
ownerReferences:
- controller: true
kind: PerconaServerMongoDB
name: some-name
spec:
podManagementPolicy: OrderedReady
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/component: mongod
app.kubernetes.io/instance: some-name
app.kubernetes.io/managed-by: percona-server-mongodb-operator
app.kubernetes.io/name: percona-server-mongodb
app.kubernetes.io/part-of: percona-server-mongodb
app.kubernetes.io/replset: rs0
serviceName: some-name-rs0
template:
metadata:
annotations: {}
labels:
app.kubernetes.io/component: mongod
app.kubernetes.io/instance: some-name
app.kubernetes.io/managed-by: percona-server-mongodb-operator
app.kubernetes.io/name: percona-server-mongodb
app.kubernetes.io/part-of: percona-server-mongodb
app.kubernetes.io/replset: rs0
spec:
containers:
- args:
- --bind_ip_all
- --auth
- --dbpath=/data/db
- --port=27017
- --replSet=rs0
- --storageEngine=wiredTiger
- --relaxPermChecks
- --sslAllowInvalidCertificates
- --clusterAuthMode=x509
- --tlsMode=preferTLS
- --shardsvr
- --enableEncryption
- --encryptionKeyFile=/etc/mongodb-encryption/encryption-key
- --wiredTigerCacheSizeGB=0.25
- --wiredTigerIndexPrefixCompression=true
- --config=/etc/mongodb-config/mongod.conf
- --quiet
command:
- /opt/percona/physical-restore-ps-entry.sh
env:
- name: SERVICE_NAME
value: some-name
- name: MONGODB_PORT
value: "27017"
- name: MONGODB_REPLSET
value: rs0
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: PBM_MONGODB_URI
value: mongodb://$(PBM_AGENT_MONGODB_USERNAME):$(PBM_AGENT_MONGODB_PASSWORD)@$(POD_NAME)
envFrom:
- secretRef:
name: internal-some-name-users
optional: false
imagePullPolicy: Always
livenessProbe:
exec:
command:
- /opt/percona/mongodb-healthcheck
- k8s
- liveness
- --ssl
- --sslInsecure
- --sslCAFile
- /etc/mongodb-ssl/ca.crt
- --sslPEMKeyFile
- /tmp/tls.pem
- --startupDelaySeconds
- "7200"
failureThreshold: 4
initialDelaySeconds: 60
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 10
name: mongod
ports:
- containerPort: 27017
name: mongodb
protocol: TCP
readinessProbe:
exec:
command:
- /opt/percona/mongodb-healthcheck
- k8s
- readiness
- --component
- mongod
failureThreshold: 8
initialDelaySeconds: 10
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 2
resources:
limits:
cpu: 500m
memory: 1G
requests:
cpu: 100m
memory: 100M
securityContext:
runAsNonRoot: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data/db
name: mongod-data
- mountPath: /etc/mongodb-secrets
name: some-name-mongodb-keyfile
readOnly: true
- mountPath: /etc/mongodb-ssl
name: ssl
readOnly: true
- mountPath: /etc/mongodb-ssl-internal
name: ssl-internal
readOnly: true
- mountPath: /etc/mongodb-config
name: config
- mountPath: /opt/percona
name: bin
- mountPath: /etc/mongodb-encryption
name: some-name-mongodb-encryption-key
readOnly: true
- mountPath: /etc/users-secret
name: users-secret-file
- mountPath: /etc/pbm/
name: pbm-config
readOnly: true
workingDir: /data/db
dnsPolicy: ClusterFirst
initContainers:
- command:
- /init-entrypoint.sh
imagePullPolicy: Always
name: mongo-init
resources:
limits:
cpu: 500m
memory: 1G
requests:
cpu: 100m
memory: 100M
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data/db
name: mongod-data
- mountPath: /opt/percona
name: bin
- command:
- bash
- -c
- install -D /usr/bin/pbm /opt/percona/pbm && install -D /usr/bin/pbm-agent /opt/percona/pbm-agent
imagePullPolicy: Always
name: pbm-init
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data/db
name: mongod-data
- mountPath: /opt/percona
name: bin
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 60
volumes:
- name: some-name-mongodb-keyfile
secret:
defaultMode: 288
optional: false
secretName: some-name-mongodb-keyfile
- emptyDir: {}
name: bin
- configMap:
defaultMode: 420
name: some-name-rs0-mongod
optional: true
name: config
- name: some-name-mongodb-encryption-key
secret:
defaultMode: 288
optional: false
secretName: some-name-mongodb-encryption-key
- name: ssl
secret:
defaultMode: 288
optional: false
secretName: some-name-ssl
- name: ssl-internal
secret:
defaultMode: 288
optional: true
secretName: some-name-ssl-internal
- name: users-secret-file
secret:
defaultMode: 420
secretName: internal-some-name-users
- name: pbm-config
secret:
defaultMode: 420
secretName: some-name-pbm-config
updateStrategy:
rollingUpdate:
partition: 0
type: RollingUpdate
volumeClaimTemplates:
- metadata:
name: mongod-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
status:
phase: Pending
Loading
Loading