Docs Menu
Docs Home
/ /
MongoDB Atlas Kubernetes Operator
/

AtlasBackupPolicy Custom Resource

On this page

  • Example
  • Parameters

The AtlasBackupPolicy custom resource configures a backup policy that applies to the AtlasBackupSchedule Custom Resource that you can apply to your AtlasDeployment Custom Resource. When you create the AtlasBackupPolicy custom resource, Atlas Kubernetes Operator tries to create or update a backup policy.

Important

Custom Resources No Longer Delete Objects by Default

  • Atlas Kubernetes Operator uses custom resource configuration files to manage your Atlas configuration, but as of Atlas Kubernetes Operator 2.0, custom resources you delete in Kubernetes are no longer (by default) deleted in Atlas. Instead, Atlas Kubernetes Operator simply stops managing those resources in Atlas. For example, if you delete an AtlasProject Custom Resource in Kubernetes, by default the Atlas Kubernetes Operator no longer automatically deletes the corresponding project from Atlas. This change in behavior is intended to help prevent accidental or unexpected deletions. To learn more, including how to revert this behavior to the default used prior to Atlas Kubernetes Operator 2.0, see New Default: Deletion Protection in Atlas Kubernetes Operator 2.0.

    Similarly, Atlas Kubernetes Operator does not delete teams from Atlas if you remove them from an Atlas project in Kubernetes with the Atlas Kubernetes Operator.

  • Explicitly define your desired configuration details in order to avoid implicitly using default Atlas configuration values. In some cases, inheriting Atlas defaults may result in a reconciliation loop which can prevent your custom resource from achieving a READY state. For example, explicitly defining your desired autoscaling behavior in your AtlasDeployment custom resource, as shown in the included example, ensures that a static instance size in your custom resource is not being repeatedly applied to an Atlas deployment which has autoscaling enabled.

    autoScaling:
    diskGB:
    enabled: true
    compute:
    enabled: true
    scaleDownEnabled: true
    minInstanceSize: M30
    maxInstanceSize: M40

Atlas Kubernetes Operator does one of the following actions using the Atlas Cloud Backup Schedule API Resource:

  • Creates a new backup policy.

  • Updates an existing backup policy.

If you remove the AtlasBackupPolicy resource from your Kubernetes cluster, Atlas stops creating backups for your cluster.

Note

You must do all of the following tasks to back up a cluster:

  1. Create a backup policy.

  2. Create a backup schedule and set the spec.policy.name field to the name of the configured backup policy.

  3. Set the spec.backupRef.name field in the AtlasDeployment Custom Resource to the name of the configured backup schedule.

To learn more, see Back Up Your Atlas Cluster.

The following example shows an AtlasBackupPolicy custom resource that is configured to take snapshots weekly and retain snapshots for seven days:

apiVersion: atlas.mongodb.com/v1
kind: AtlasBackupPolicy
metadata:
name: "atlas-default-backuppolicy"
spec:
items:
- frequencyType: "weekly"
frequencyInterval: 1
retentionUnit: "days"
retentionValue: 7

This section describes some of the key AtlasBackupPolicy custom resource parameters available. For a full list of parameters available, see the Atlas Modify Cloud Backup Backup Policy API. Refer to these descriptions, the available examples, and the API documentation to customize your specifications.

spec.items

Type: array

Conditional

List that contains the policy item parameters from the API. For a full list of parameters available, see the Atlas Modify Cloud Backup Backup Policy API.

spec.items.frequencyInterval

Type: number

Required

Number that indicates the desired frequency of the new backup policy item specified by spec.items.frequencyType. A value of 1 specifies the first instance of the corresponding spec.items.frequencyType.

Example

  • In a monthly policy item, 1 indicates that the monthly snapshot occurs on the first day of the month.

  • In a weekly policy item, 1 indicates that the weekly snapshot occurs on Monday.

This setting accepts the following frequency values:

  • Hourly: 1, 2, 4, 6, 8, and 12.

  • Daily: 1.

  • Weekly: 1 through 7, where 1 is Monday and 7 is Sunday.

  • Monthly: 1 through 28 and 40, where 1 is the first day of the month and 40 is the last day of the month.

  • Yearly: 1 through 12, where 1 is the first day of January, and 12 is the first day of December.

spec.items.frequencyType

Type: string

Required

String that indicates the frequency associated with the backup policy item. Accepted values are: hourly, daily, weekly, monthly, or yearly.

Note

You can't specify multiple hourly and daily backup policy items.

spec.items.retentionUnit

Type: string

Required

String that indicates the scope of the backup policy item. Together with spec.items.retentionValue, these settings define the length of time to retain snapshots. Accepted values are: days, weeks, months, or years.

spec.items.retentionValue

Type: string

Required

String that indicates the value to associate with spec.items.retentionUnit. Together with spec.items.retentionUnit, these settings define the length of time to retain snapshots.

Back

AtlasDatabaseUser

On this page