// ensureIngressController ensures all necessary router resources exist for a given ingresscontroller.
ensureIngressController ensures all necessary router resources exist for a given ingresscontroller.
// ensureIngressController ensures all necessary router resources exist for a given ingresscontroller .
func (r *reconciler) ensureIngressController(ci *operatorv1.IngressController, dnsConfig *configv1.DNS, infraConfig *configv1.Infrastructure) error {
	errs := []error{}
	if deployment, err := r.ensureRouterDeployment(ci, infraConfig); err != nil {
		errs = append(errs, fmt.Errorf("failed to ensure router deployment for %s: %v", ci.Name, err))
	} else {
		trueVar := true
		deploymentRef := metav1.OwnerReference{
			APIVersion: "apps/v1",
			Kind:       "Deployment",
			Name:       deployment.Name,
			UID:        deployment.UID,
			Controller: &trueVar,
		}
		lbService, err := r.ensureLoadBalancerService(ci, deploymentRef, infraConfig)
		if err != nil {
			errs = append(errs, fmt.Errorf("failed to ensure load balancer service for %s: %v", ci.Name, err))
		} else if lbService != nil {
			if err := r.ensureDNS(ci, lbService, dnsConfig); err != nil {
				errs = append(errs, fmt.Errorf("failed to ensure DNS for %s: %v", ci.Name, err))
			}
		}
		if internalSvc, err := r.ensureInternalIngressControllerService(ci, deploymentRef); err != nil {
			errs = append(errs, fmt.Errorf("failed to create internal router service for ingresscontroller %s: %v", ci.Name, err))
		} else if err := r.ensureMetricsIntegration(ci, internalSvc, deploymentRef); err != nil {
			errs = append(errs, fmt.Errorf("failed to integrate metrics with openshift-monitoring for ingresscontroller %s: %v", ci.Name, err))
		}
		operandEvents := &corev1.EventList{}
		if err := r.cache.List(context.TODO(), operandEvents, client.InNamespace("openshift-ingress")); err != nil {
			errs = append(errs, fmt.Errorf("failed to list events in namespace %q: %v", "openshift-ingress", err))
		}
		if err := r.syncIngressControllerStatus(ci, deployment, lbService, operandEvents.Items); err != nil {
			errs = append(errs, fmt.Errorf("failed to sync ingresscontroller status: %v", err))
		}
	}
	return utilerrors.NewAggregate(errs)
}
func ( r * reconciler ) ensureIngressController ( ci * operatorv1 . IngressController , dnsConfig * configv1 . DNS , infraConfig * configv1 . Infrastructure ) error { errs := [ ] error { } if deployment , err := r . ensureRouterDeployment ( ci , infraConfig ) ; err != nil { errs = append ( errs , fmt . Errorf ( " " , ci . Name , err ) ) } else { trueVar := true deploymentRef := metav1 . OwnerReference { APIVersion : " " , Kind : " " , Name : deployment . Name , UID : deployment . UID , Controller : & trueVar , } lbService , err := r . ensureLoadBalancerService ( ci , deploymentRef , infraConfig ) if err != nil { errs = append ( errs , fmt . Errorf ( " " , ci . Name , err ) ) } else if lbService != nil { if err := r . ensureDNS ( ci , lbService , dnsConfig ) ; err != nil { errs = append ( errs , fmt . Errorf ( " " , ci . Name , err ) ) } } if internalSvc , err := r . ensureInternalIngressControllerService ( ci , deploymentRef ) ; err != nil { errs = append ( errs , fmt . Errorf ( " " , ci . Name , err ) ) } else if err := r . ensureMetricsIntegration ( ci , internalSvc , deploymentRef ) ; err != nil { errs = append ( errs , fmt . Errorf ( " " , ci . Name , err ) ) } operandEvents := & corev1 . EventList { } if err := r . cache . List ( context . TODO ( ) , operandEvents , client . InNamespace ( " " ) ) ; err != nil { errs = append ( errs , fmt . Errorf ( " " , " " , err ) ) } if err := r . syncIngressControllerStatus ( ci , deployment , lbService , operandEvents . Items ) ; err != nil { errs = append ( errs , fmt . Errorf ( " " , err ) ) } } return utilerrors . NewAggregate ( errs ) }
ensureIngressController ensures all necessary router resources exist for a given ingresscontroller.
ensureIngressController ensures all necessary router resources exist for a given ingresscontroller .