// enforceEffectiveEndpointPublishingStrategy uses the infrastructure config to
// determine the appropriate endpoint publishing strategy configuration for the
// given ingresscontroller and publishes it to the ingresscontroller's status.
enforceEffectiveEndpointPublishingStrategy uses the infrastructure config to
determine the appropriate endpoint publishing strategy configuration for the
given ingresscontroller and publishes it to the ingresscontroller's status.
// enforceEffectiveEndpointPublishingStrategy uses the infrastructure config to // determine the appropriate endpoint publishing strategy configuration for the // given ingresscontroller and publishes it to the ingresscontroller ' s status .
func (r *reconciler) enforceEffectiveEndpointPublishingStrategy(ci *operatorv1.IngressController, infraConfig *configv1.Infrastructure) error {
	if ci.Status.EndpointPublishingStrategy != nil {
		return nil
	}
	updated := ci.DeepCopy()
	switch {
	case ci.Spec.EndpointPublishingStrategy != nil:
		updated.Status.EndpointPublishingStrategy = ci.Spec.EndpointPublishingStrategy.DeepCopy()
	default:
		updated.Status.EndpointPublishingStrategy = &operatorv1.EndpointPublishingStrategy{
			Type: publishingStrategyTypeForInfra(infraConfig),
		}
	}
	if err := r.client.Status().Update(context.TODO(), updated); err != nil {
		return fmt.Errorf("failed to update status of ingresscontroller %s/%s: %v", updated.Namespace, updated.Name, err)
	}
	if err := r.client.Get(context.TODO(), types.NamespacedName{Namespace: updated.Namespace, Name: updated.Name}, ci); err != nil {
		return fmt.Errorf("failed to get ingresscontroller %s/%s: %v", updated.Namespace, updated.Name, err)
	}
	return nil
}
func ( r * reconciler ) enforceEffectiveEndpointPublishingStrategy ( ci * operatorv1 . IngressController , infraConfig * configv1 . Infrastructure ) error { if ci . Status . EndpointPublishingStrategy != nil { return nil } updated := ci . DeepCopy ( ) switch { case ci . Spec . EndpointPublishingStrategy != nil : updated . Status . EndpointPublishingStrategy = ci . Spec . EndpointPublishingStrategy . DeepCopy ( ) default : updated . Status . EndpointPublishingStrategy = & operatorv1 . EndpointPublishingStrategy { Type : publishingStrategyTypeForInfra ( infraConfig ) , } } if err := r . client . Status ( ) . Update ( context . TODO ( ) , updated ) ; err != nil { return fmt . Errorf ( " " , updated . Namespace , updated . Name , err ) } if err := r . client . Get ( context . TODO ( ) , types . NamespacedName { Namespace : updated . Namespace , Name : updated . Name } , ci ) ; err != nil { return fmt . Errorf ( " " , updated . Namespace , updated . Name , err ) } return nil }
enforceEffectiveEndpointPublishingStrategy uses the infrastructure config to
determine the appropriate endpoint publishing strategy configuration for the
given ingresscontroller and publishes it to the ingresscontroller's status.
enforceEffectiveEndpointPublishingStrategy uses the infrastructure config to determine the appropriate endpoint publishing strategy configuration for the given ingresscontroller and publishes it to the ingresscontroller ' s status .
// The ingresscontroller's endpoint publishing strategy is immutable, so // if we have previously published a strategy in status, we must // continue to use that strategy it.