@@ -123,35 +123,18 @@ func (r *Registry) registerControllers(c cluster.Cluster, ap atlas.Provider) err
123123 }
124124
125125 var reconcilers []Reconciler
126- reconcilers = append (reconcilers , atlasproject .NewAtlasProjectReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
127- reconcilers = append (reconcilers , atlasdeployment .NewAtlasDeploymentReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
128- reconcilers = append (reconcilers , atlasdatabaseuser .NewAtlasDatabaseUserReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .featureFlags , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
129- reconcilers = append (reconcilers , atlasdatafederation .NewAtlasDataFederationReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
130- reconcilers = append (reconcilers , atlasfederatedauth .NewAtlasFederatedAuthReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
131- reconcilers = append (reconcilers , atlasstream .NewAtlasStreamsInstanceReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
132- reconcilers = append (reconcilers , atlasstream .NewAtlasStreamsConnectionReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .maxConcurrentReconciles ))
133- reconcilers = append (reconcilers , atlassearchindexconfig .NewAtlasSearchIndexConfigReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .maxConcurrentReconciles ))
134- reconcilers = append (reconcilers , atlasbackupcompliancepolicy .NewAtlasBackupCompliancePolicyReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .maxConcurrentReconciles ))
135- reconcilers = append (reconcilers , atlascustomrole .NewAtlasCustomRoleReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
136- reconcilers = append (reconcilers , atlasprivateendpoint .NewAtlasPrivateEndpointReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
137- reconcilers = append (reconcilers , atlasipaccesslist .NewAtlasIPAccessListReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
138- reconcilers = append (reconcilers , atlasnetworkcontainer .NewAtlasNetworkContainerReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .logger , r .independentSyncPeriod , r .globalSecretRef , r .maxConcurrentReconciles ))
139- reconcilers = append (reconcilers , atlasnetworkpeering .NewAtlasNetworkPeeringsReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .logger , r .independentSyncPeriod , r .globalSecretRef , r .maxConcurrentReconciles ))
126+ reconcilers = append (reconcilers , r .legacyReconcilers (c , ap )... )
140127
141- orgSettingsReconciler := atlasorgsettings .NewAtlasOrgSettingsReconciler (c , ap , r .logger , r .globalSecretRef , r .reapplySupport )
142- reconcilers = append (reconcilers , newCtrlStateReconciler (orgSettingsReconciler , r .maxConcurrentReconciles ))
143- integrationsReconciler := integrations .NewAtlasThirdPartyIntegrationsReconciler (c , ap , r .deletionProtection , r .logger , r .globalSecretRef , r .reapplySupport )
144- reconcilers = append (reconcilers , newCtrlStateReconciler (integrationsReconciler , r .maxConcurrentReconciles ))
128+ generatedReconcilers , err := r .generatedReconcilers (c , ap )
129+ if err != nil {
130+ return fmt .Errorf ("error creating generated reconcilers: %w" , err )
131+ }
132+ reconcilers = append (reconcilers , generatedReconcilers ... )
145133
146134 if version .IsExperimental () {
147135 // Add experimental controllers here
148136 reconcilers = append (reconcilers , connectionsecret .NewConnectionSecretReconciler (c , r .defaultPredicates (), ap , r .logger , r .globalSecretRef ))
149137
150- groupReconciler , err := group .NewGroupReconciler (c , ap , r .logger , r .globalSecretRef , r .deletionProtection , true , r .defaultPredicates ())
151- if err != nil {
152- return fmt .Errorf ("error creating group reconciler: %w" , err )
153- }
154-
155138 clusterController , err := akov2generatedcluster .NewClusterReconciler (c , ap , r .logger , r .globalSecretRef , r .deletionProtection , true , r .defaultPredicates ())
156139 if err != nil {
157140 return fmt .Errorf ("error creating cluster reconciler: %w" , err )
@@ -168,7 +151,6 @@ func (r *Registry) registerControllers(c cluster.Cluster, ap atlas.Provider) err
168151 }
169152
170153 reconcilers = append (reconcilers ,
171- newCtrlStateReconciler (groupReconciler , r .maxConcurrentReconciles ),
172154 newCtrlStateReconciler (clusterController , r .maxConcurrentReconciles ),
173155 newCtrlStateReconciler (flexController , r .maxConcurrentReconciles ),
174156 newCtrlStateReconciler (databaseUserReconciler , r .maxConcurrentReconciles ),
@@ -180,6 +162,43 @@ func (r *Registry) registerControllers(c cluster.Cluster, ap atlas.Provider) err
180162 return nil
181163}
182164
165+ func (r * Registry ) legacyReconcilers (c cluster.Cluster , ap atlas.Provider ) []Reconciler {
166+ var reconcilers []Reconciler
167+ reconcilers = append (reconcilers , atlasproject .NewAtlasProjectReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
168+ reconcilers = append (reconcilers , atlasdeployment .NewAtlasDeploymentReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
169+ reconcilers = append (reconcilers , atlasdatabaseuser .NewAtlasDatabaseUserReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .featureFlags , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
170+ reconcilers = append (reconcilers , atlasdatafederation .NewAtlasDataFederationReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
171+ reconcilers = append (reconcilers , atlasfederatedauth .NewAtlasFederatedAuthReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
172+ reconcilers = append (reconcilers , atlasstream .NewAtlasStreamsInstanceReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
173+ reconcilers = append (reconcilers , atlasstream .NewAtlasStreamsConnectionReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .maxConcurrentReconciles ))
174+ reconcilers = append (reconcilers , atlassearchindexconfig .NewAtlasSearchIndexConfigReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .maxConcurrentReconciles ))
175+ reconcilers = append (reconcilers , atlasbackupcompliancepolicy .NewAtlasBackupCompliancePolicyReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .logger , r .maxConcurrentReconciles ))
176+ reconcilers = append (reconcilers , atlascustomrole .NewAtlasCustomRoleReconciler (c , r .deprecatedPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
177+ reconcilers = append (reconcilers , atlasprivateendpoint .NewAtlasPrivateEndpointReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
178+ reconcilers = append (reconcilers , atlasipaccesslist .NewAtlasIPAccessListReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .independentSyncPeriod , r .logger , r .globalSecretRef , r .maxConcurrentReconciles ))
179+ reconcilers = append (reconcilers , atlasnetworkcontainer .NewAtlasNetworkContainerReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .logger , r .independentSyncPeriod , r .globalSecretRef , r .maxConcurrentReconciles ))
180+ reconcilers = append (reconcilers , atlasnetworkpeering .NewAtlasNetworkPeeringsReconciler (c , r .defaultPredicates (), ap , r .deletionProtection , r .logger , r .independentSyncPeriod , r .globalSecretRef , r .maxConcurrentReconciles ))
181+
182+ orgSettingsReconciler := atlasorgsettings .NewAtlasOrgSettingsReconciler (c , ap , r .logger , r .globalSecretRef , r .reapplySupport )
183+ reconcilers = append (reconcilers , newCtrlStateReconciler (orgSettingsReconciler , r .maxConcurrentReconciles ))
184+ integrationsReconciler := integrations .NewAtlasThirdPartyIntegrationsReconciler (c , ap , r .deletionProtection , r .logger , r .globalSecretRef , r .reapplySupport )
185+ reconcilers = append (reconcilers , newCtrlStateReconciler (integrationsReconciler , r .maxConcurrentReconciles ))
186+
187+ return reconcilers
188+ }
189+
190+ func (r * Registry ) generatedReconcilers (c cluster.Cluster , ap atlas.Provider ) ([]Reconciler , error ) {
191+ var reconcilers []Reconciler
192+
193+ groupReconciler , err := group .NewGroupReconciler (c , ap , r .logger , r .globalSecretRef , r .deletionProtection , true , r .defaultPredicates ())
194+ if err != nil {
195+ return nil , fmt .Errorf ("error creating group reconciler: %w" , err )
196+ }
197+ reconcilers = append (reconcilers , newCtrlStateReconciler (groupReconciler , r .maxConcurrentReconciles ))
198+
199+ return reconcilers , nil
200+ }
201+
183202// deprecatedPredicates are to be phased out in favor of defaultPredicates
184203func (r * Registry ) deprecatedPredicates () []predicate.Predicate {
185204 return append (r .sharedPredicates , watch .DeprecatedCommonPredicates [client.Object ]())
0 commit comments