@@ -121,7 +121,7 @@ func (r *MongoDBSearchReconcileHelper) reconcile(ctx context.Context, log *zap.S
121121 return workflow .Failed (err )
122122 }
123123
124- if shardedSource , ok := r .db .(ShardedSearchSourceDBResource ); ok {
124+ if shardedSource , ok := r .db .(SearchSourceShardedDeployment ); ok {
125125 return r .reconcileSharded (ctx , log , shardedSource , version )
126126 }
127127
@@ -192,7 +192,7 @@ func (r *MongoDBSearchReconcileHelper) reconcileNonSharded(ctx context.Context,
192192}
193193
194194// reconcileSharded deploys one mongot StatefulSet, Service, and ConfigMap per shard.
195- func (r * MongoDBSearchReconcileHelper ) reconcileSharded (ctx context.Context , log * zap.SugaredLogger , shardedSource ShardedSearchSourceDBResource , version string ) workflow.Status {
195+ func (r * MongoDBSearchReconcileHelper ) reconcileSharded (ctx context.Context , log * zap.SugaredLogger , shardedSource SearchSourceShardedDeployment , version string ) workflow.Status {
196196 log .Infof ("Reconciling MongoDBSearch for sharded source deployment with %d shards" , shardedSource .GetShardCount ())
197197
198198 keyfileStsModification := statefulset .NOOP ()
@@ -235,7 +235,7 @@ func (r *MongoDBSearchReconcileHelper) reconcileSharded(ctx context.Context, log
235235 return workflow .Failed (err )
236236 }
237237
238- shardMongotConfig := createShardMongotConfig (r .mdbSearch , shardedSource , shardIdx )
238+ shardMongotConfig := createMongotConfigForShard (r .mdbSearch , shardedSource , shardIdx )
239239 configHash , err := r .ensureShardMongotConfig (ctx , shardLog , shardName , shardMongotConfig , ingressTlsMongotModification , egressTlsMongotModification , embeddingConfigMongotModification )
240240 if err != nil {
241241 return workflow .Failed (err )
@@ -250,7 +250,7 @@ func (r *MongoDBSearchReconcileHelper) reconcileSharded(ctx context.Context, log
250250 mutatedSts , err := r .createOrUpdateShardStatefulSet (ctx ,
251251 shardLog ,
252252 shardName ,
253- CreateShardSearchStatefulSetFunc (r .mdbSearch , shardedSource , shardIdx , searchImage ),
253+ CreateSearchStatefulSetForShardFunc (r .mdbSearch , shardedSource , shardIdx , searchImage ),
254254 configHashModification ,
255255 keyfileStsModification ,
256256 ingressTlsStsModification ,
@@ -304,7 +304,7 @@ func (r *MongoDBSearchReconcileHelper) validatePerShardTLSSecrets(ctx context.Co
304304
305305 // Per-shard mode: validate each shard's source secret exists
306306 for _ , shardName := range shardNames {
307- secretNsName := r .mdbSearch .TLSSecretNamespacedNameForShard (shardName )
307+ secretNsName := r .mdbSearch .TLSSecretForShard (shardName )
308308 tlsSecret := & corev1.Secret {}
309309 err := r .client .Get (ctx , secretNsName , tlsSecret )
310310 if apierrors .IsNotFound (err ) {
@@ -389,11 +389,11 @@ func (r *MongoDBSearchReconcileHelper) ensureMongotConfig(ctx context.Context, l
389389}
390390
391391func (r * MongoDBSearchReconcileHelper ) ensureShardSearchService (ctx context.Context , shardName string ) error {
392- svcName := r .mdbSearch .MongotServiceNamespacedNameForShard (shardName )
392+ svcName := r .mdbSearch .MongotServiceForShard (shardName )
393393 svc := & corev1.Service {ObjectMeta : metav1.ObjectMeta {Name : svcName .Name , Namespace : svcName .Namespace }}
394394 op , err := controllerutil .CreateOrUpdate (ctx , r .client , svc , func () error {
395395 resourceVersion := svc .ResourceVersion
396- * svc = buildShardSearchHeadlessService (r .mdbSearch , shardName )
396+ * svc = buildSearchHeadlessServiceForShard (r .mdbSearch , shardName )
397397 svc .ResourceVersion = resourceVersion
398398 return controllerutil .SetOwnerReference (r .mdbSearch , svc , r .client .Scheme ())
399399 })
@@ -414,7 +414,7 @@ func (r *MongoDBSearchReconcileHelper) ensureShardMongotConfig(ctx context.Conte
414414 return "" , err
415415 }
416416
417- cmName := r .mdbSearch .MongotConfigMapNamespacedNameForShard (shardName )
417+ cmName := r .mdbSearch .MongotConfigMapForShard (shardName )
418418 cm := & corev1.ConfigMap {ObjectMeta : metav1.ObjectMeta {Name : cmName .Name , Namespace : cmName .Namespace }, Data : map [string ]string {}}
419419 op , err := controllerutil .CreateOrUpdate (ctx , r .client , cm , func () error {
420420 resourceVersion := cm .ResourceVersion
@@ -435,7 +435,7 @@ func (r *MongoDBSearchReconcileHelper) ensureShardMongotConfig(ctx context.Conte
435435}
436436
437437func (r * MongoDBSearchReconcileHelper ) createOrUpdateShardStatefulSet (ctx context.Context , log * zap.SugaredLogger , shardName string , modifications ... statefulset.Modification ) (* appsv1.StatefulSet , error ) {
438- stsName := r .mdbSearch .MongotStatefulSetNamespacedNameForShard (shardName )
438+ stsName := r .mdbSearch .MongotStatefulSetForShard (shardName )
439439 sts := & appsv1.StatefulSet {ObjectMeta : metav1.ObjectMeta {Name : stsName .Name , Namespace : stsName .Namespace }}
440440 op , err := controllerutil .CreateOrUpdate (ctx , r .client , sts , func () error {
441441 statefulset .Apply (modifications ... )(sts )
@@ -450,10 +450,10 @@ func (r *MongoDBSearchReconcileHelper) createOrUpdateShardStatefulSet(ctx contex
450450 return sts , nil
451451}
452452
453- // buildShardSearchHeadlessService builds a headless Service for a specific shard's mongot.
454- func buildShardSearchHeadlessService (search * searchv1.MongoDBSearch , shardName string ) corev1.Service {
455- svcName := search .MongotServiceNamespacedNameForShard (shardName )
456- stsName := search .MongotStatefulSetNamespacedNameForShard (shardName ).Name
453+ // buildSearchHeadlessServiceForShard builds a headless Service for a specific shard's mongot.
454+ func buildSearchHeadlessServiceForShard (search * searchv1.MongoDBSearch , shardName string ) corev1.Service {
455+ svcName := search .MongotServiceForShard (shardName )
456+ stsName := search .MongotStatefulSetForShard (shardName ).Name
457457
458458 labels := map [string ]string {
459459 "app" : svcName .Name ,
@@ -495,9 +495,9 @@ func buildShardSearchHeadlessService(search *searchv1.MongoDBSearch, shardName s
495495 return serviceBuilder .Build ()
496496}
497497
498- // createShardMongotConfig creates the mongot configuration for a specific shard.
498+ // createMongotConfigForShard creates the mongot configuration for a specific shard.
499499// Each shard's mongot connects to its own shard's mongod hosts.
500- func createShardMongotConfig (search * searchv1.MongoDBSearch , shardedSource ShardedSearchSourceDBResource , shardIdx int ) mongot.Modification {
500+ func createMongotConfigForShard (search * searchv1.MongoDBSearch , shardedSource SearchSourceShardedDeployment , shardIdx int ) mongot.Modification {
501501 return func (config * mongot.Config ) {
502502 hostAndPorts := shardedSource .HostSeedsForShard (shardIdx )
503503
@@ -697,12 +697,12 @@ type perShardTLSResource struct {
697697
698698// TLSSecretNamespacedName returns the per-shard source secret name.
699699func (p * perShardTLSResource ) TLSSecretNamespacedName () types.NamespacedName {
700- return p .MongoDBSearch .TLSSecretNamespacedNameForShard (p .shardName )
700+ return p .MongoDBSearch .TLSSecretForShard (p .shardName )
701701}
702702
703703// TLSOperatorSecretNamespacedName returns the per-shard operator-managed secret name.
704704func (p * perShardTLSResource ) TLSOperatorSecretNamespacedName () types.NamespacedName {
705- return p .MongoDBSearch .TLSOperatorSecretNamespacedNameForShard (p .shardName )
705+ return p .MongoDBSearch .TLSOperatorSecretForShard (p .shardName )
706706}
707707
708708// ensureIngressTlsConfigForShard processes TLS configuration for a specific shard.
@@ -941,7 +941,7 @@ func mongotHostAndPort(search *searchv1.MongoDBSearch, clusterDomain string) str
941941
942942// shardMongotHostAndPort returns the internal service endpoint for a shard's mongot deployment
943943func shardMongotHostAndPort (search * searchv1.MongoDBSearch , shardName string , clusterDomain string ) string {
944- svcName := search .MongotServiceNamespacedNameForShard (shardName )
944+ svcName := search .MongotServiceForShard (shardName )
945945 port := search .GetEffectiveMongotPort ()
946946 return fmt .Sprintf ("%s.%s.svc.%s:%d" , svcName .Name , svcName .Namespace , clusterDomain , port )
947947}
0 commit comments