Skip to content

Commit 9c267b7

Browse files
authored
Add Network Peering CRD (#371)
1 parent 3afe879 commit 9c267b7

File tree

2 files changed

+277
-0
lines changed

2 files changed

+277
-0
lines changed
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
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: atlasnetworkpeerings.atlas.mongodb.com
8+
spec:
9+
group: atlas.mongodb.com
10+
names:
11+
categories:
12+
- atlas
13+
kind: AtlasNetworkPeering
14+
listKind: AtlasNetworkPeeringList
15+
plural: atlasnetworkpeerings
16+
shortNames:
17+
- anp
18+
singular: atlasnetworkpeering
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.status
32+
name: Status
33+
type: string
34+
name: v1
35+
schema:
36+
openAPIV3Schema:
37+
description: AtlasNetworkPeering is the Schema for the AtlasNetworkPeering
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: AtlasNetworkPeeringSpec defines the desired state of AtlasNetworkPeering
59+
properties:
60+
awsConfiguration:
61+
description: AWSConfiguration is the specific AWS settings for network
62+
peering
63+
properties:
64+
accepterRegionName:
65+
description: AccepterRegionName is the provider region name of
66+
user's vpc in AWS native region format
67+
type: string
68+
awsAccountId:
69+
description: AccountID of the user's vpc.
70+
type: string
71+
routeTableCidrBlock:
72+
description: User VPC CIDR.
73+
type: string
74+
vpcId:
75+
description: AWS VPC ID.
76+
type: string
77+
required:
78+
- accepterRegionName
79+
type: object
80+
azureConfiguration:
81+
description: AzureConfiguration is the specific Azure settings for
82+
network peering
83+
properties:
84+
azureDirectoryId:
85+
description: AzureDirectoryID is the unique identifier for an
86+
Azure AD directory.
87+
type: string
88+
azureSubscriptionId:
89+
description: AzureSubscriptionID is the unique identifier of the
90+
Azure subscription in which the VNet resides.
91+
type: string
92+
resourceGroupName:
93+
description: ResourceGroupName is the name of your Azure resource
94+
group.
95+
type: string
96+
vnetName:
97+
description: VNetName is name of your Azure VNet. Its applicable
98+
only for Azure.
99+
type: string
100+
type: object
101+
connectionSecret:
102+
description: Name of the secret containing Atlas API private and public
103+
keys
104+
properties:
105+
name:
106+
description: |-
107+
Name of the resource being referred to
108+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
109+
type: string
110+
required:
111+
- name
112+
type: object
113+
containerRef:
114+
description: ContainerDualReference refers to an Network Container
115+
either by Kubernetes name or Atlas ID
116+
properties:
117+
id:
118+
description: |-
119+
ID is the Atlas identifier of the Network Container Atlas resource this Peering Connection relies on
120+
Use either name or ID, not both.
121+
type: string
122+
name:
123+
description: |-
124+
Name of the container Kubernetes resource, must be present in the same namespace
125+
Use either name or ID, not both.
126+
type: string
127+
type: object
128+
externalProjectRef:
129+
description: |-
130+
"externalProjectRef" holds the parent Atlas project ID.
131+
Mutually exclusive with the "projectRef" field
132+
properties:
133+
id:
134+
description: ID is the Atlas project ID
135+
type: string
136+
required:
137+
- id
138+
type: object
139+
gcpConfiguration:
140+
description: GCPConfiguration is the specific Google Cloud settings
141+
for network peering
142+
properties:
143+
gcpProjectId:
144+
description: User GCP Project ID. Its applicable only for GCP.
145+
type: string
146+
networkName:
147+
description: GCP Network Peer Name. Its applicable only for GCP.
148+
type: string
149+
type: object
150+
projectRef:
151+
description: |-
152+
"projectRef" is a reference to the parent AtlasProject resource.
153+
Mutually exclusive with the "externalProjectRef" field
154+
properties:
155+
name:
156+
description: Name is the name of the Kubernetes Resource
157+
type: string
158+
namespace:
159+
description: Namespace is the namespace of the Kubernetes Resource
160+
type: string
161+
required:
162+
- name
163+
type: object
164+
provider:
165+
description: Name of the cloud service provider for which you want
166+
to create the network peering service.
167+
enum:
168+
- AWS
169+
- GCP
170+
- AZURE
171+
type: string
172+
required:
173+
- containerRef
174+
- provider
175+
type: object
176+
x-kubernetes-validations:
177+
- message: must define only one project reference through externalProjectRef
178+
or projectRef
179+
rule: (has(self.externalProjectRef) && !has(self.projectRef)) || (!has(self.externalProjectRef)
180+
&& has(self.projectRef))
181+
- message: must define a local connection secret when referencing an external
182+
project
183+
rule: (has(self.externalProjectRef) && has(self.connectionSecret)) ||
184+
!has(self.externalProjectRef)
185+
- message: must either have a container Atlas id or Kubernetes name, but
186+
not both (or neither)
187+
rule: (self.containerRef.name != '' && self.containerRef.id == '') ||
188+
(self.containerRef.name == '' && self.containerRef.id != '')
189+
status:
190+
description: |-
191+
AtlasNetworkPeeringStatus is a status for the AtlasNetworkPeering Custom resource.
192+
Not the one included in the AtlasProject
193+
properties:
194+
awsStatus:
195+
description: AWSStatus contains AWS only related status information
196+
properties:
197+
connectionId:
198+
description: ConnectionID is the AWS VPC peering connection ID
199+
type: string
200+
vpcId:
201+
description: VpcID is AWS VPC id on the Atlas side
202+
type: string
203+
type: object
204+
azureStatus:
205+
description: AzureStatus contains Azure only related status information
206+
properties:
207+
azureSubscriptionIDpcId:
208+
description: AzureSubscriptionID is Azure Subscription id on the
209+
Atlas side
210+
type: string
211+
vNetName:
212+
description: VnetName is Azure network on the Atlas side
213+
type: string
214+
type: object
215+
conditions:
216+
description: Conditions is the list of statuses showing the current
217+
state of the Atlas Custom Resource
218+
items:
219+
description: Condition describes the state of an Atlas Custom Resource
220+
at a certain point.
221+
properties:
222+
lastTransitionTime:
223+
description: Last time the condition transitioned from one status
224+
to another.
225+
format: date-time
226+
type: string
227+
message:
228+
description: A human readable message indicating details about
229+
the transition.
230+
type: string
231+
reason:
232+
description: The reason for the condition's last transition.
233+
type: string
234+
status:
235+
description: Status of the condition, one of True, False, Unknown.
236+
type: string
237+
type:
238+
description: Type of Atlas Custom Resource condition.
239+
type: string
240+
required:
241+
- status
242+
- type
243+
type: object
244+
type: array
245+
gcpStatus:
246+
description: GCPStatus contains GCP only related status information
247+
properties:
248+
gcpProjectID:
249+
description: GCPProjectID is GCP project on the Atlas side
250+
type: string
251+
networkName:
252+
description: NetworkName is GCP network on the Atlas side
253+
type: string
254+
type: object
255+
id:
256+
description: ID recrods the identified of the peer created by Atlas
257+
type: string
258+
observedGeneration:
259+
description: |-
260+
ObservedGeneration indicates the generation of the resource specification that the Atlas Operator is aware of.
261+
The Atlas Operator updates this field to the 'metadata.generation' as soon as it starts reconciliation of the resource.
262+
format: int64
263+
type: integer
264+
status:
265+
description: Status describes the last status seen for the network
266+
peering setup
267+
type: string
268+
required:
269+
- conditions
270+
type: object
271+
type: object
272+
served: true
273+
storage: true
274+
subresources:
275+
status: {}

charts/atlas-operator/rbac.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- atlasstreaminstances
3737
- atlasteams
3838
- atlasnetworkcontainers
39+
- atlasnetworkpeerings
3940
verbs:
4041
- create
4142
- delete
@@ -63,6 +64,7 @@
6364
- atlasstreaminstances/status
6465
- atlasteams/status
6566
- atlasnetworkcontainers/status
67+
- atlasnetworkpeerings/status
6668
verbs:
6769
- get
6870
- patch

0 commit comments

Comments
 (0)