@@ -407,7 +407,7 @@ func (r *GaleraReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
407407 condition .UnknownCondition (condition .InputReadyCondition , condition .InitReason , condition .InputReadyInitMessage ),
408408 // TLS cert secrets
409409 condition .UnknownCondition (condition .TLSInputReadyCondition , condition .InitReason , condition .InputReadyInitMessage ),
410- // endpoint for adoption redirect
410+ // service (expose database to pods) and headless service (between galera pods)
411411 condition .UnknownCondition (condition .ExposeServiceReadyCondition , condition .InitReason , condition .ExposeServiceReadyInitMessage ),
412412 // configmap generation
413413 condition .UnknownCondition (condition .ServiceConfigReadyCondition , condition .InitReason , condition .ServiceConfigReadyInitMessage ),
@@ -464,34 +464,6 @@ func (r *GaleraReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
464464 // Create/Update all the resources associated to this galera instance
465465 //
466466
467- adoption := & instance .Spec .AdoptionRedirect
468-
469- // Endpoints
470- endpoints := mariadb .EndpointsForAdoption (instance , adoption )
471- if endpoints != nil {
472- op , err := controllerutil .CreateOrPatch (ctx , r .Client , endpoints , func () error {
473- err := controllerutil .SetControllerReference (instance , endpoints , r .Scheme )
474- if err != nil {
475- return err
476- }
477- return nil
478- })
479- if err != nil {
480- instance .Status .Conditions .Set (condition .FalseCondition (
481- condition .ExposeServiceReadyCondition ,
482- condition .ErrorReason ,
483- condition .SeverityWarning ,
484- condition .ExposeServiceReadyErrorMessage ,
485- err .Error ()))
486- return ctrl.Result {}, err
487- }
488- if op != controllerutil .OperationResultNone {
489- log .Info ("" , "Kind" , instance .Kind , "Name" , instance .Name , "database endpoints" , endpoints .Name , "operation:" , string (op ))
490- }
491- }
492-
493- instance .Status .Conditions .MarkTrue (condition .ExposeServiceReadyCondition , condition .ExposeServiceReadyMessage )
494-
495467 // the headless service provides DNS entries for pods
496468 // the name of the resource must match the name of the app selector
497469 pkghl := mariadb .HeadlessService (instance )
@@ -511,7 +483,7 @@ func (r *GaleraReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
511483 log .Info ("" , "Kind" , instance .Kind , "Name" , instance .Name , "database headless service" , headless .Name , "operation" , string (op ))
512484 }
513485
514- pkgsvc := mariadb .ServiceForAdoption (instance , "galera" , adoption )
486+ pkgsvc := mariadb .Service (instance )
515487 service := & corev1.Service {ObjectMeta : pkgsvc .ObjectMeta }
516488 op , err = controllerutil .CreateOrPatch (ctx , r .Client , service , func () error {
517489 // Add finalizer to the svc to prevent deletion. If the svc gets deleted
@@ -542,6 +514,8 @@ func (r *GaleraReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
542514 log .Info ("" , "Kind" , instance .Kind , "Name" , instance .Name , "database service" , service .Name , "operation" , string (op ))
543515 }
544516
517+ instance .Status .Conditions .MarkTrue (condition .ExposeServiceReadyCondition , condition .ExposeServiceReadyMessage )
518+
545519 // Map of all resources that may cause a rolling service restart
546520 inputHashEnv := make (map [string ]env.Setter )
547521
0 commit comments