@@ -67,6 +67,14 @@ func getOrDefault(source string, def string) string {
6767 return source
6868}
6969
70+ // NOTE(beagles): refactoring this is a little tricky because it has multiple
71+ // side-effects. It sets a parameter in conditions, sets a hash in the envVars,
72+ // and returns results. The function name is a little misleading as well because
73+ // it doesn't actually get the secret. It's more that it checks for it and gets
74+ // the hash. At the very least a rename to"ensureSecret" is warranted. It might
75+ // also be better to move into a separate file along with other helper
76+ // functions.
77+
7078// helper function for retrieving a secret.
7179func getSecret (
7280 ctx context.Context ,
@@ -701,6 +709,9 @@ func (r *DesignateReconciler) reconcileNormal(ctx context.Context, instance *des
701709 return ctrlResult , nil
702710 }
703711
712+ // NOTE(beagles): consider moving the API reconcile until after the pools
713+ // yaml can be created. This avoid the "no servers" error that occurs when
714+ // there aren't any configured DNS servers.
704715 //
705716 // normal reconcile tasks
706717 //
@@ -748,6 +759,8 @@ func (r *DesignateReconciler) reconcileNormal(ctx context.Context, instance *des
748759 }
749760 Log .Info ("Deployment API task reconciled" )
750761
762+ // NOTE(beagles): Consider moving IP Map construction into a separate function.
763+
751764 // Handle Mdns predictable IPs configmap
752765 nad , err := nad .GetNADWithName (ctx , helper , instance .Spec .DesignateNetworkAttachment , instance .Namespace )
753766 if err != nil {
@@ -850,6 +863,8 @@ func (r *DesignateReconciler) reconcileNormal(ctx context.Context, instance *des
850863 return ctrl.Result {}, err
851864 }
852865
866+ // NOTE(beagles): Consider moving pools yaml generation into a separate function.
867+
853868 Log .Info ("Bind configmap was created successfully" )
854869 if len (nsRecords ) > 0 && instance .Status .DesignateCentralReadyCount > 0 {
855870 Log .Info ("NS records data found" )
@@ -908,7 +923,10 @@ func (r *DesignateReconciler) reconcileNormal(ctx context.Context, instance *des
908923 }
909924 }
910925
911- // deploy designate-central
926+ // NOTE(beagles): Kind of makes you wish for macros. These are all the same
927+ // pattern with just different names.
928+ //
929+ // deploy designate-central
912930 designateCentral , op , err := r .centralDeploymentCreateOrUpdate (ctx , instance )
913931 if err != nil {
914932 instance .Status .Conditions .Set (condition .FalseCondition (
0 commit comments