Skip to content

Commit 747ea60

Browse files
committed
CLOUDP-299197: Support Atlas Network Container CRD
1 parent 40a6a41 commit 747ea60

File tree

2 files changed

+191
-0
lines changed

2 files changed

+191
-0
lines changed
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.16.1
7+
name: atlasnetworkcontainers.atlas.mongodb.com
8+
spec:
9+
group: atlas.mongodb.com
10+
names:
11+
categories:
12+
- atlas
13+
kind: AtlasNetworkContainer
14+
listKind: AtlasNetworkContainerList
15+
plural: atlasnetworkcontainers
16+
shortNames:
17+
- anc
18+
singular: atlasnetworkcontainer
19+
scope: Namespaced
20+
versions:
21+
- additionalPrinterColumns:
22+
- jsonPath: .status.conditions[?(@.type=="Ready")].status
23+
name: Ready
24+
type: string
25+
- jsonPath: .spec.provider
26+
name: Provider
27+
type: string
28+
- jsonPath: .status.id
29+
name: Id
30+
type: string
31+
- jsonPath: .status.provisioned
32+
name: Provisioned
33+
type: string
34+
name: v1
35+
schema:
36+
openAPIV3Schema:
37+
description: AtlasNetworkContainer is the Schema for the AtlasNetworkContainer
38+
API
39+
properties:
40+
apiVersion:
41+
description: |-
42+
APIVersion defines the versioned schema of this representation of an object.
43+
Servers should convert recognized schemas to the latest internal value, and
44+
may reject unrecognized values.
45+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
46+
type: string
47+
kind:
48+
description: |-
49+
Kind is a string value representing the REST resource this object represents.
50+
Servers may infer this from the endpoint the client submits requests to.
51+
Cannot be updated.
52+
In CamelCase.
53+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
54+
type: string
55+
metadata:
56+
type: object
57+
spec:
58+
description: AtlasNetworkContainerSpec defines the desired state of an
59+
AtlasNetworkContainer
60+
properties:
61+
cidrBlock:
62+
description: Atlas CIDR. It needs to be set if ContainerID is not
63+
set.
64+
type: string
65+
connectionSecret:
66+
description: Name of the secret containing Atlas API private and public
67+
keys
68+
properties:
69+
name:
70+
description: |-
71+
Name of the resource being referred to
72+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
73+
type: string
74+
required:
75+
- name
76+
type: object
77+
externalProjectRef:
78+
description: |-
79+
"externalProjectRef" holds the parent Atlas project ID.
80+
Mutually exclusive with the "projectRef" field
81+
properties:
82+
id:
83+
description: ID is the Atlas project ID
84+
type: string
85+
required:
86+
- id
87+
type: object
88+
projectRef:
89+
description: |-
90+
"projectRef" is a reference to the parent AtlasProject resource.
91+
Mutually exclusive with the "externalProjectRef" field
92+
properties:
93+
name:
94+
description: Name is the name of the Kubernetes Resource
95+
type: string
96+
namespace:
97+
description: Namespace is the namespace of the Kubernetes Resource
98+
type: string
99+
required:
100+
- name
101+
type: object
102+
provider:
103+
description: Provider is the name of the cloud provider hosting the
104+
network container
105+
enum:
106+
- AWS
107+
- GCP
108+
- AZURE
109+
type: string
110+
region:
111+
description: |-
112+
ContainerRegion is the provider region name of Atlas network peer container in Atlas region format
113+
This is required by AWS and Azure, but not used by GCP
114+
type: string
115+
required:
116+
- cidrBlock
117+
- provider
118+
type: object
119+
x-kubernetes-validations:
120+
- message: must define only one project reference through externalProjectRef
121+
or projectRef
122+
rule: (has(self.externalProjectRef) && !has(self.projectRef)) || (!has(self.externalProjectRef)
123+
&& has(self.projectRef))
124+
- message: must define a local connection secret when referencing an external
125+
project
126+
rule: (has(self.externalProjectRef) && has(self.connectionSecret)) ||
127+
!has(self.externalProjectRef)
128+
- message: must not set region for GCP containers
129+
rule: (self.provider == 'GCP' && !has(self.region)) || (self.provider
130+
!= 'GCP')
131+
- message: must set region for AWS and Azure containers
132+
rule: ((self.provider == 'AWS' || self.provider == 'Azure') && has(self.region))
133+
|| (self.provider == 'GCP')
134+
status:
135+
description: |-
136+
AtlasNetworkContainerStatus is a status for the AtlasNetworkContainer Custom resource.
137+
Not the one included in the AtlasProject
138+
properties:
139+
conditions:
140+
description: Conditions is the list of statuses showing the current
141+
state of the Atlas Custom Resource
142+
items:
143+
description: Condition describes the state of an Atlas Custom Resource
144+
at a certain point.
145+
properties:
146+
lastTransitionTime:
147+
description: Last time the condition transitioned from one status
148+
to another.
149+
format: date-time
150+
type: string
151+
message:
152+
description: A human readable message indicating details about
153+
the transition.
154+
type: string
155+
reason:
156+
description: The reason for the condition's last transition.
157+
type: string
158+
status:
159+
description: Status of the condition, one of True, False, Unknown.
160+
type: string
161+
type:
162+
description: Type of Atlas Custom Resource condition.
163+
type: string
164+
required:
165+
- status
166+
- type
167+
type: object
168+
type: array
169+
containerProvisioned:
170+
description: Provisioned is true when the container has been provisioned
171+
in Atlas
172+
type: boolean
173+
id:
174+
description: ID record the identifier of the container in Atlas
175+
type: string
176+
observedGeneration:
177+
description: |-
178+
ObservedGeneration indicates the generation of the resource specification that the Atlas Operator is aware of.
179+
The Atlas Operator updates this field to the 'metadata.generation' as soon as it starts reconciliation of the resource.
180+
format: int64
181+
type: integer
182+
required:
183+
- conditions
184+
type: object
185+
type: object
186+
served: true
187+
storage: true
188+
subresources:
189+
status: {}

charts/atlas-operator/rbac.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- atlasstreamconnections
3636
- atlasstreaminstances
3737
- atlasteams
38+
- atlasnetworkcontainers
3839
verbs:
3940
- create
4041
- delete
@@ -61,6 +62,7 @@
6162
- atlasstreamconnections/status
6263
- atlasstreaminstances/status
6364
- atlasteams/status
65+
- atlasnetworkcontainers/status
6466
verbs:
6567
- get
6668
- patch

0 commit comments

Comments
 (0)