MongoDB.local SF, Jan 15: See the speaker lineup & ship your AI vision faster. Use WEB50 to save 50%
Find out more >
Docs Menu
Docs Home
/ /
/ / /

AtlasBackupPolicy Custom Resource

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

AtlasBackupPolicy is the Schema for the atlasbackuppolicies API

Name
Type
Description
Required

apiVersion

string

atlas.mongodb.com/v1

true

kind

string

AtlasBackupPolicy

true

metadata

object

Refer to the Kubernetes API documentation for the fields of the metadata field.

true

spec

object

AtlasBackupPolicySpec defines the target state of AtlasBackupPolicy.

false

status

object

BackupPolicyStatus defines the observed state of AtlasBackupPolicy.

false

AtlasBackupPolicySpec defines the target state of AtlasBackupPolicy.

Name
Type
Description
Required

items

[]object

A list of BackupPolicy items.

true

Name
Type
Description
Required

frequencyInterval

integer

Frequency of the new backup policy item specified by FrequencyType. A value of 1 specifies the first instance of the corresponding FrequencyType. You can set FrequencyInterval only to 12 for NVMe clusters. Enum: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 40

true

frequencyType

enum

Frequency associated with the backup policy item. You can specify only one each of hourly or daily backup policy items. Enum: hourly, daily, weekly, monthly, yearly

true

retentionUnit

enum

Unit of time in which MongoDB Atlas measures snapshot retention. Enum: days, weeks, months, years

true

retentionValue

integer

Duration in days, weeks, months, or years that MongoDB Cloud retains the snapshot. For less frequent policy items, MongoDB Cloud requires that you specify a value greater than or equal to the value specified for more frequent policy items.

true

BackupPolicyStatus defines the observed state of AtlasBackupPolicy.

Name
Type
Description
Required

conditions

[]object

Conditions is the list of statuses showing the current state of the Atlas Custom Resource

true

backupScheduleIDs

[]string

DeploymentID of the deployment using the backup policy

false

observedGeneration

integer

ObservedGeneration indicates the generation of the resource specification of which the Atlas Operator is aware. The Atlas Operator updates this field to the value of 'metadata.generation' as soon as it starts reconciliation of the resource. Format: int64

false

Condition describes the state of an Atlas Custom Resource at a certain point.

Name
Type
Description
Required

status

string

Status of the condition; one of True, False, Unknown.

true

type

string

Type of Atlas Custom Resource condition.

true

lastTransitionTime

string

Last time the condition transitioned from one status to another. Represented in ISO 8601 format. Format: date-time

false

message

string

A message providing details about the transition.

false

reason

string

The reason for the condition's last transition.

false

Back

AtlasDatabaseUser

On this page