Parcourir la source

better failing (#12)

pull/14/head
Vladimir Smagin il y a 1 an
committed by GitHub
Parent
révision
4d1b5ba3e2
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 4AEE18F83AFDEB23
2 fichiers modifiés avec 21 ajouts et 9 suppressions
  1. +13
    -1
      pkg/controller/rabbitmq/rabbitmq_configmaps.go
  2. +8
    -8
      pkg/controller/rabbitmq/rabbitmq_secrets.go

+ 13
- 1
pkg/controller/rabbitmq/rabbitmq_configmaps.go Voir le fichier

@ -85,11 +85,23 @@ func (r *ReconcileRabbitmq) reconcileConfigMap(reqLogger logr.Logger, cr *rabbit
}
defaultUsername := string(secretObj.Data["username"])
if defaultUsername == "" {
reqLogger.Info("Empty service username", "ConfigMap.Namespace", cr.Namespace, "ConfigMap.Name", cr.Name)
return reconcile.Result{}, err
}
templateData.DefaultUser = defaultUsername
defaultPassword := string(secretObj.Data["password"])
if defaultPassword == "" {
reqLogger.Info("Empty service password", "ConfigMap.Namespace", cr.Namespace, "ConfigMap.Name", cr.Name)
return reconcile.Result{}, err
}
templateData.DefaultPassword = defaultPassword
cookieData := string(secretObj.Data["cookie"])
reqLogger.Info("Configmap decoded secret", "ConfigMap.Namespace", cr.Namespace, "ConfigMap.Name", cr.Name, "Secret decoded", cookieData)
if cookieData == "" {
reqLogger.Info("Empty cookie data", "ConfigMap.Namespace", cr.Namespace, "ConfigMap.Name", cr.Name)
return reconcile.Result{}, err
}
reqLogger.Info("Configmap decoded secret", "ConfigMap.Namespace", cr.Namespace, "ConfigMap.Name", cr.Name, "Secret cookie", cookieData)
templateData.Spec = cr.Spec


+ 8
- 8
pkg/controller/rabbitmq/rabbitmq_secrets.go Voir le fichier

@ -65,7 +65,7 @@ func (r *ReconcileRabbitmq) reconcileSecrets(reqLogger logr.Logger, cr *rabbitmq
} else if err != nil {
// happend something else, do nothing
reqLogger.Info("Service Account linked: error happend", err)
return secretNames, err
return secretResouces{}, err
}
} else {
// link empty, search standart service account secret
@ -80,7 +80,7 @@ func (r *ReconcileRabbitmq) reconcileSecrets(reqLogger logr.Logger, cr *rabbitmq
} else if err != nil {
// happend something else, do nothing
reqLogger.Info("Service Account standart: error happend", err)
return secretNames, err
return secretResouces{}, err
}
}
@ -101,13 +101,13 @@ func (r *ReconcileRabbitmq) reconcileSecrets(reqLogger logr.Logger, cr *rabbitmq
}
if err := controllerutil.SetControllerReference(cr, secretSAResource, r.scheme); err != nil {
return secretNames, err
return secretResouces{}, err
}
err := r.client.Create(context.TODO(), secretSAResource)
if err != nil {
return secretNames, err
return secretResouces{}, err
}
}
@ -130,7 +130,7 @@ func (r *ReconcileRabbitmq) reconcileSecrets(reqLogger logr.Logger, cr *rabbitmq
} else if err != nil {
// happend something else, do nothing
reqLogger.Info("User credentials: error happend", err)
return secretNames, err
return secretResouces{}, err
}
secretNames.Credentials = cr.Spec.RabbitmqSecretCredentials
} else {
@ -145,7 +145,7 @@ func (r *ReconcileRabbitmq) reconcileSecrets(reqLogger logr.Logger, cr *rabbitmq
} else if err != nil {
// happend something else, do nothing
reqLogger.Info("User credentials standart: error happend", err)
return secretNames, err
return secretResouces{}, err
}
}
@ -162,12 +162,12 @@ func (r *ReconcileRabbitmq) reconcileSecrets(reqLogger logr.Logger, cr *rabbitmq
}
if err := controllerutil.SetControllerReference(cr, secretCredResourceNew, r.scheme); err != nil {
return secretNames, err
return secretResouces{}, err
}
err := r.client.Create(context.TODO(), secretCredResourceNew)
if err != nil {
return secretNames, err
return secretResouces{}, err
}
}


Chargement…
Annuler
Enregistrer