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
/ /
/ / /

AtlasNetworkContainer Custom Resource

Important

Legacy subresources are deprecated as of the release of their corresponding CRDs. If your configuration currently relies on the subresource form of this resource definition, migrate to a CRD.

The AtlasNetworkContainer custom resource defines a network container for a Atlas project. You create VPC peering connections between network containers and the networks hosting your applications.

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 Network Peering API Resource:

  • Creates a new network container.

  • Updates an existing network container.

The following examples illustrate configurations for AtlasNetworkContainer CRDs.

  • The basic example configuration defines a resource that you manage with the same Atlas Kubernetes Operator instance with which you manage its parent Atlas project.

  • The Independent CRD example configures the same network container as the basic example, but for a Atlas project that you manage outside of the Atlas Kubernetes Operator instance with which you manage the network container.

The following shows an AtlasNetworkContainer custom resource for a container named my-atlas-nc that allows you to create a VPC peering connection between Atlas and AWS within the my-project project. To manage this resource in the same Atlas Kubernetes Operator instance as its parent Atlas project, you must identify the project with projectRef instead of externalProjectRef.

apiVersion: atlas.mongodb.com/v1
kind: AtlasNetworkContainer
metadata:
name: my-atlas-nc
spec:
projectRef:
name: my-project
namespace: my-operator-namespace
provider: AWS
id: 66e2f2b7e69a89b66b621571
cidrBlock: 10.11.0.0/16
region: US_EAST_1

The following example shows an AtlasNetworkContainer independent CRD that enables VPC peering under the same parameters enabled by the Basic Example. To enable independent operation, you must use an externalProjectRef instead of a projectRef, and you must supply a connectionSecret directly since this resource can't inherit API credentials from its parent project.

apiVersion: atlas.mongodb.com/v1
kind: AtlasNetworkContainer
metadata:
name: my-atlas-nc
spec:
externalProjectRef:
projectId: 66e2f2b621571b7e69a89b66
connectionSecret:
name: atlas-connection-secret
provider: AWS
id: 66e2f2b7e69a89b66b621571
cidrBlock: 10.11.0.0/16
region: US_EAST_1

AtlasNetworkContainer is the Schema for the AtlasNetworkContainer API

Name
Type
Description
Required

apiVersion

string

atlas.mongodb.com/v1

true

kind

string

AtlasNetworkContainer

true

metadata

object

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

true

spec

object

AtlasNetworkContainerSpec defines the target state of an AtlasNetworkContainer. Validations:

  • (has(self.``externalProjectRef``) && !has(self.``projectRef``)) || (!has(self.``externalProjectRef``) && has(self.``projectRef``)): must define only one project reference through externalProjectRef or projectRef

  • (has(self.``externalProjectRef``) && has(self.``connectionSecret``)) || !has(self.``externalProjectRef``): must define a local connection secret when referencing an external project

  • (self.provider == 'GCP' && !has(self.region)) || (self.provider != 'GCP'): must not set region for GCP containers

  • ((self.provider == 'AWS' || self.provider == 'AZURE') && has(self.region)) || (self.provider == 'GCP'): must set region for AWS and Azure containers

  • (self.id == oldSelf.id) || (!has(self.id) && !has(oldSelf.id)): id is immutable

  • (self.region == oldSelf.region) || (!has(self.region) && !has(oldSelf.region)): region is immutable

false

status

object

AtlasNetworkContainerStatus is a status for the AtlasNetworkContainer Custom resource. Not the one included in the AtlasProject

false

AtlasNetworkContainerSpec defines the target state of an AtlasNetworkContainer.

Name
Type
Description
Required

provider

enum

Provider is the name of the cloud provider hosting the network container. Enum: AWS, GCP, AZURE

true

cidrBlock

string

Atlas CIDR. It needs to be set if ContainerID is not set.

false

connectionSecret

object

Name of the secret containing Atlas API private and public keys.

false

externalProjectRef

object

externalProjectRef holds the parent Atlas project ID. Mutually exclusive with the "projectRef" field.

false

id

string

ID is the container identifier for an already existent network container to be managed by the operator. This field can be used in conjunction with cidrBlock to update the cidrBlock of an existing container. This field is immutable.

false

projectRef

object

projectRef is a reference to the parent AtlasProject resource. Mutually exclusive with the "externalProjectRef" field.

false

region

string

ContainerRegion is the provider region name of Atlas network peer container in Atlas region format This is required by AWS and Azure, but not used by GCP. This field is immutable, Atlas does not admit network container changes.

false

Name of the secret containing Atlas API private and public keys.

externalProjectRef holds the parent Atlas project ID. Mutually exclusive with the "projectRef" field.

Name
Type
Description
Required

id

string

ID is the Atlas project ID.

true

projectRef is a reference to the parent AtlasProject resource. Mutually exclusive with the "externalProjectRef" field.

Name
Type
Description
Required

name

string

Name of the Kubernetes Resource

true

namespace

string

Namespace of the Kubernetes Resource

false

AtlasNetworkContainerStatus is a status for the AtlasNetworkContainer Custom resource. Not the one included in the AtlasProject

Name
Type
Description
Required

conditions

[]object

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

true

id

string

ID record the identifier of the container in Atlas

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

provisioned

boolean

Provisioned is true when clusters have been deployed to the container before the last reconciliation

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

AtlasIPAccessList

On this page