Skip to content

Commit 835bdda

Browse files
authored
CLOUDP-299197: Support Atlas Network Container CRD (#374)
Signed-off-by: jose.vazquez <[email protected]>
1 parent e340dce commit 835bdda

File tree

2 files changed

+229
-0
lines changed

2 files changed

+229
-0
lines changed
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
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+
id:
89+
description: |-
90+
ID is the container identified for an already existent network container to be managed by the operator.
91+
This field can be used in conjunction with cidrBlock to update the cidrBlock of an existing container.
92+
This field is immutable.
93+
type: string
94+
projectRef:
95+
description: |-
96+
"projectRef" is a reference to the parent AtlasProject resource.
97+
Mutually exclusive with the "externalProjectRef" field
98+
properties:
99+
name:
100+
description: Name is the name of the Kubernetes Resource
101+
type: string
102+
namespace:
103+
description: Namespace is the namespace of the Kubernetes Resource
104+
type: string
105+
required:
106+
- name
107+
type: object
108+
provider:
109+
description: Provider is the name of the cloud provider hosting the
110+
network container
111+
enum:
112+
- AWS
113+
- GCP
114+
- AZURE
115+
type: string
116+
region:
117+
description: |-
118+
ContainerRegion is the provider region name of Atlas network peer container in Atlas region format
119+
This is required by AWS and Azure, but not used by GCP.
120+
This field is immutable, Atlas does not admit network container changes.
121+
type: string
122+
required:
123+
- provider
124+
type: object
125+
x-kubernetes-validations:
126+
- message: must define only one project reference through externalProjectRef
127+
or projectRef
128+
rule: (has(self.externalProjectRef) && !has(self.projectRef)) || (!has(self.externalProjectRef)
129+
&& has(self.projectRef))
130+
- message: must define a local connection secret when referencing an external
131+
project
132+
rule: (has(self.externalProjectRef) && has(self.connectionSecret)) ||
133+
!has(self.externalProjectRef)
134+
- message: must not set region for GCP containers
135+
rule: (self.provider == 'GCP' && !has(self.region)) || (self.provider
136+
!= 'GCP')
137+
- message: must set region for AWS and Azure containers
138+
rule: ((self.provider == 'AWS' || self.provider == 'AZURE') && has(self.region))
139+
|| (self.provider == 'GCP')
140+
- message: id is immutable
141+
rule: (self.id == oldSelf.id) || (!has(self.id) && !has(oldSelf.id))
142+
- message: region is immutable
143+
rule: (self.region == oldSelf.region) || (!has(self.region) && !has(oldSelf.region))
144+
status:
145+
description: |-
146+
AtlasNetworkContainerStatus is a status for the AtlasNetworkContainer Custom resource.
147+
Not the one included in the AtlasProject
148+
properties:
149+
awsStatus:
150+
description: AWSStatus contains AWS only related status information
151+
properties:
152+
vpcId:
153+
description: VpcID is AWS VPC id on the Atlas side
154+
type: string
155+
type: object
156+
azureStatus:
157+
description: AzureStatus contains Azure only related status information
158+
properties:
159+
azureSubscriptionIDpcId:
160+
description: AzureSubscriptionID is Azure Subscription id on the
161+
Atlas side
162+
type: string
163+
vNetName:
164+
description: VnetName is Azure network on the Atlas side
165+
type: string
166+
type: object
167+
conditions:
168+
description: Conditions is the list of statuses showing the current
169+
state of the Atlas Custom Resource
170+
items:
171+
description: Condition describes the state of an Atlas Custom Resource
172+
at a certain point.
173+
properties:
174+
lastTransitionTime:
175+
description: Last time the condition transitioned from one status
176+
to another.
177+
format: date-time
178+
type: string
179+
message:
180+
description: A human readable message indicating details about
181+
the transition.
182+
type: string
183+
reason:
184+
description: The reason for the condition's last transition.
185+
type: string
186+
status:
187+
description: Status of the condition, one of True, False, Unknown.
188+
type: string
189+
type:
190+
description: Type of Atlas Custom Resource condition.
191+
type: string
192+
required:
193+
- status
194+
- type
195+
type: object
196+
type: array
197+
gcpStatus:
198+
description: GCPStatus contains GCP only related status information
199+
properties:
200+
gcpProjectID:
201+
description: GCPProjectID is GCP project on the Atlas side
202+
type: string
203+
networkName:
204+
description: NetworkName is GCP network on the Atlas side
205+
type: string
206+
type: object
207+
id:
208+
description: ID record the identifier of the container in Atlas
209+
type: string
210+
observedGeneration:
211+
description: |-
212+
ObservedGeneration indicates the generation of the resource specification that the Atlas Operator is aware of.
213+
The Atlas Operator updates this field to the 'metadata.generation' as soon as it starts reconciliation of the resource.
214+
format: int64
215+
type: integer
216+
provisioned:
217+
description: Provisioned is true when clusters have been deployed
218+
to the container
219+
type: boolean
220+
required:
221+
- conditions
222+
type: object
223+
type: object
224+
served: true
225+
storage: true
226+
subresources:
227+
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)