in internal/controller/teamcity_controller.go [218:249]
func (r *TeamcityReconciler) validatePreconditions(ctx context.Context, builder resource.ResourceBuilder, instance TeamCity) (preconditionSuccessful bool) {
log := log.FromContext(ctx)
preconditionSuccessful = true
switch builder.(type) {
case *resource.SecondaryStatefulSetBuilder:
if instance.IsMultiNode() {
log.V(1).Info("Checking if the main node has started before starting secondary nodes")
mainNodeNamespacedName := types.NamespacedName{
Namespace: instance.Namespace,
Name: instance.Spec.MainNode.Name,
}
newestGeneration, err := isNewestGeneration(r, ctx, mainNodeNamespacedName)
if err != nil {
log.V(1).Error(err, "Unable to get generation information for the main node.")
}
updated, err := isNodeUpdateFinished(r, ctx, mainNodeNamespacedName)
if err != nil {
log.V(1).Error(err, "Unable to get revision status information of the main node")
}
ongoingUpdate := ongoingZeroDowntimeUpgrade(r, ctx, &instance)
log.V(1).Info(fmt.Sprintf("Newest generation: %s", strconv.FormatBool(newestGeneration)))
log.V(1).Info(fmt.Sprintf("Main node updated: %s", strconv.FormatBool(updated)))
log.V(1).Info(fmt.Sprintf("Ongoing update: %s", strconv.FormatBool(ongoingUpdate)))
preconditionSuccessful = newestGeneration && updated && !ongoingUpdate
}
}
return preconditionSuccessful
}