Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some missing requeues for certain situations #328

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions controllers/amphoracontroller_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,11 @@ func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context
// create hash over all the different input resources to identify if any those changed
// and a restart/recreate is required.
//
inputHash, err := r.createHashOfInputHashes(instance, configMapVars)
inputHash, hashChanged, err := r.createHashOfInputHashes(instance, configMapVars)
if err != nil {
return ctrl.Result{}, err
} else if hashChanged {
return ctrl.Result{Requeue: true}, nil
}

instance.Status.Conditions.MarkTrue(condition.ServiceConfigReadyCondition, condition.ServiceConfigReadyMessage)
Expand Down Expand Up @@ -650,18 +652,18 @@ func (r *OctaviaAmphoraControllerReconciler) generateServiceConfigMaps(
func (r *OctaviaAmphoraControllerReconciler) createHashOfInputHashes(
instance *octaviav1.OctaviaAmphoraController,
envVars map[string]env.Setter,
) (string, error) {
) (string, bool, error) {
mergedMapVars := env.MergeEnvs([]corev1.EnvVar{}, envVars)
hash, err := util.ObjectHash(mergedMapVars)
if err != nil {
return hash, err
return hash, false, err
}

var changed bool
if hashMap, changed := util.SetHash(instance.Status.Hash, common.InputHashName, hash); changed {
instance.Status.Hash = hashMap
r.Log.Info(fmt.Sprintf("Input maps hash %s - %s", common.InputHashName, hash))
}
return hash, nil
return hash, changed, nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down
4 changes: 2 additions & 2 deletions controllers/octavia_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
//
if octaviaHealthManager.Status.ReadyCount != octaviaHealthManager.Status.DesiredNumberScheduled {
Log.Info("Health managers are not ready. Housekeeping and Worker services pending")
return ctrl.Result{}, nil
return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil
}

// Skip the other amphora controller pods until the health managers are all up and running.
Expand Down Expand Up @@ -1525,7 +1525,7 @@ func (r *OctaviaReconciler) checkAmphoraGeneration(
client.InNamespace(instance.Namespace),
}
if err := r.Client.List(context.Background(), amph, listOpts...); err != nil {
r.Log.Error(err, "Unable to retrieve OctaviaAPI %w")
r.Log.Error(err, "Unable to retrieve AmphoraController %w")
return false, err
}
for _, item := range amph.Items {
Expand Down