Skip to content

Commit 4f0a405

Browse files
authored
Use AKO specific Open2CRD YAML config (#2901)
* Use AKO specific Open2CRD YAML config * Add DatabaseUser to the working set * Fix output folders switcheroo
1 parent a04ffe7 commit 4f0a405

File tree

3 files changed

+241
-2
lines changed

3 files changed

+241
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ tools/scaffolder/bin/scaffolder:
880880

881881
gen-crds: $(BUILD_OPENAPI2CRD)
882882
@echo "==> Generating CRDs..."
883-
$(OPENAPI2CRD) --config tools/openapi2crd/config.yaml \
883+
$(OPENAPI2CRD) --config config/openapi2crd.yaml \
884884
--output $(realpath .)/config/generated/crd/bases/crds.yaml
885885

886886
gen-crds-override: $(BUILD_OPENAPI2CRD)
@@ -902,7 +902,7 @@ run-scaffolder: $(BUILD_SCAFFOLDER)
902902
run-scaffolder-override: $(BUILD_SCAFFOLDER)
903903
@echo "==> Generating Go controller scaffolding and indexers..."
904904
$(SCAFFOLDER) --input $(realpath .)/config/generated/crd/bases/crds.yaml \
905-
--all --override --indexer-out $(realpath .)/internal/generated/indexers \
905+
--all --override --indexer-out $(realpath .)/internal/generated/indexer \
906906
--controller-out $(realpath .)/internal/generated/controller
907907

908908
gen-all: gen-crds gen-go-types run-scaffolder

config/openapi2crd.yaml

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
# Copyright 2025 MongoDB Inc
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
kind: Config
17+
apiVersion: atlas2crd.mongodb.com/v1alpha1
18+
19+
.definitions:
20+
myGroupRef: &groupRef
21+
name: groupRef
22+
property: $.groupId
23+
target:
24+
type:
25+
kind: Group
26+
resource: groups
27+
group: atlas.generated.mongodb.com
28+
version: v1
29+
properties:
30+
- $.status.v20250312.id
31+
32+
spec:
33+
pluginSets:
34+
- name: atlas
35+
default: true
36+
plugins:
37+
- base
38+
- major_version
39+
- parameters
40+
- connection_secret
41+
- mutual_exclusive_group
42+
- entry
43+
- status
44+
- sensitive_properties
45+
- skipped_properties
46+
- read_only_properties
47+
- read_write_properties
48+
- references
49+
- references_metadata
50+
- mutual_exclusive_major_versions
51+
- atlas_sdk_version
52+
53+
openapi:
54+
- name: v20250312
55+
package: go.mongodb.org/atlas-sdk/v20250312008/admin
56+
57+
crd:
58+
- gvk:
59+
version: v1
60+
kind: Group
61+
group: atlas.generated.mongodb.com
62+
categories:
63+
- atlas
64+
shortNames:
65+
- ag
66+
mappings:
67+
- majorVersion: v20250312
68+
openAPIRef:
69+
name: v20250312
70+
parameters:
71+
path:
72+
name: '/api/atlas/v2/groups'
73+
verb: post
74+
entry:
75+
schema: "Group"
76+
filters:
77+
readWriteOnly: true
78+
status:
79+
schema: "Group"
80+
filters:
81+
readOnly: true
82+
skipProperties:
83+
- $.links
84+
85+
- gvk:
86+
version: v1
87+
kind: Cluster
88+
group: atlas.generated.mongodb.com
89+
categories:
90+
- atlas
91+
shortNames:
92+
- ac
93+
mappings:
94+
- majorVersion: v20250312
95+
openAPIRef:
96+
name: v20250312
97+
parameters:
98+
path:
99+
name: '/api/atlas/v2/groups/{groupId}/clusters'
100+
verb: post
101+
references:
102+
- *groupRef
103+
entry:
104+
schema: 'ClusterDescription20240805'
105+
filters:
106+
skipProperties:
107+
- $.connectionStrings
108+
- $.createDate
109+
- $.groupId
110+
- $.id
111+
- $.links
112+
- $.mongoDBVersion
113+
- $.replicationSpecs[*].id
114+
- $.stateName
115+
status:
116+
schema: 'ClusterDescription20240805'
117+
filters:
118+
skipProperties:
119+
- $.acceptDataRisksAndForceReplicaSetReconfig
120+
- $.backupEnabled
121+
- $.biConnector
122+
- $.clusterType
123+
- $.diskSizeGB
124+
- $.diskWarmingMode
125+
- $.encryptionAtRestProvider
126+
- $.labels
127+
- $.links
128+
- $.mongoDBMajorVersion
129+
- $.name
130+
- $.paused
131+
- $.pitEnabled
132+
- $.replicationSpecs[*].numShards
133+
- $.replicationSpecs[*].regionConfigs
134+
- $.replicationSpecs[*].zoneName
135+
- $.rootCertType
136+
- $.tags
137+
- $.terminationProtectionEnabled
138+
- $.versionReleaseSystem
139+
- majorVersion: v20250312
140+
openAPIRef:
141+
name: v20250312
142+
parameters:
143+
path:
144+
name: '/api/atlas/v2/groups/{groupId}/clusters'
145+
verb: post
146+
references:
147+
- *groupRef
148+
entry:
149+
schema: 'ClusterDescription20240805'
150+
filters:
151+
skipProperties:
152+
- $.connectionStrings
153+
- $.createDate
154+
- $.groupId
155+
- $.id
156+
- $.links
157+
- $.mongoDBVersion
158+
- $.replicationSpecs[*].id
159+
- $.stateName
160+
status:
161+
schema: 'ClusterDescription20240805'
162+
filters:
163+
skipProperties:
164+
- $.acceptDataRisksAndForceReplicaSetReconfig
165+
- $.backupEnabled
166+
- $.biConnector
167+
- $.clusterType
168+
- $.diskSizeGB
169+
- $.diskWarmingMode
170+
- $.encryptionAtRestProvider
171+
- $.labels
172+
- $.links
173+
- $.mongoDBMajorVersion
174+
- $.name
175+
- $.paused
176+
- $.pitEnabled
177+
- $.replicationSpecs[*].numShards
178+
- $.replicationSpecs[*].regionConfigs
179+
- $.replicationSpecs[*].zoneName
180+
- $.rootCertType
181+
- $.tags
182+
- $.terminationProtectionEnabled
183+
- $.versionReleaseSystem
184+
185+
- gvk:
186+
version: v1
187+
kind: FlexCluster
188+
group: atlas.generated.mongodb.com
189+
categories:
190+
- atlas
191+
shortNames:
192+
- afc
193+
mappings:
194+
- majorVersion: v20250312
195+
openAPIRef:
196+
name: v20250312
197+
parameters:
198+
path:
199+
name: '/api/atlas/v2/groups/{groupId}/flexClusters'
200+
verb: post
201+
references:
202+
- *groupRef
203+
entry:
204+
schema: 'FlexClusterDescriptionCreate20241113'
205+
filters:
206+
skipProperties:
207+
- $.links
208+
- $.providerSettings.diskSizeGB
209+
- $.providerSettings.providerName
210+
status:
211+
schema: 'FlexClusterDescription20241113'
212+
filters:
213+
skipProperties:
214+
- $.links
215+
- $.tags
216+
- $.terminationProtectionEnabled
217+
218+
- gvk:
219+
version: v1
220+
kind: DatabaseUser
221+
group: atlas.generated.mongodb.com
222+
categories:
223+
- atlas
224+
shortNames:
225+
- adu
226+
mappings:
227+
- majorVersion: v20250312
228+
openAPIRef:
229+
name: v20250312
230+
parameters:
231+
path:
232+
name: '/api/atlas/v2/groups/{groupId}/databaseUsers'
233+
verb: post
234+
references:
235+
- *groupRef
236+
entry:
237+
schema: 'CloudDatabaseUser'
238+
filters:
239+
readWriteOnly: true

0 commit comments

Comments
 (0)