func()

in internal/controller/appconfigurationprovider_controller.go [323:350]


func (reconciler *AzureAppConfigurationProviderReconciler) logAndSetFailStatus(
	provider *acpv1.AzureAppConfigurationProvider,
	err error) {
	var showErrorAsWarning bool = false
	namespacedName := types.NamespacedName{
		Name:      provider.Name,
		Namespace: provider.Namespace,
	}
	reconcileState := reconciler.ProvidersReconcileState[namespacedName]
	if _, ok := err.(*loader.ArgumentError); ok {
		// If the error is caused by invalid argument, just show it as error.
		showErrorAsWarning = false
	} else if reconcileState != nil &&
		reconcileState.ConfigMapResourceVersion != nil &&
		(provider.Spec.Secret == nil ||
			len(reconcileState.ExistingK8sSecrets) == 0) {
		// If the target ConfigMap or Secret does exists, just show error as warning.
		showErrorAsWarning = true
	}

	if showErrorAsWarning {
		klog.Warningf("Fail to update the target ConfigMap or Secret of AzureAppConfigurationProvider '%s' in '%s' namespace: %s", provider.Name, provider.Namespace, err.Error())
		provider.Status = newProviderStatus(acpv1.PhaseUpdateFailed, acpv1.UpdateFailMessage, provider.Status.LastSyncTime, provider.Status.RefreshStatus)
	} else {
		klog.Errorf("Fail to create the target ConfigMap or Secret of AzureAppConfigurationProvider '%s' in '%s' namespace: %s", provider.Name, provider.Namespace, err.Error())
		provider.Status = newProviderStatus(acpv1.PhaseFailed, acpv1.CreateFailMessage, provider.Status.LastSyncTime, provider.Status.RefreshStatus)
	}
}