The problem shows be name is defined in the follow following code and it came from the spec . (CR)
{code:java} ObjectMeta: metav1.ObjectMeta { Name: getConfigMapName(m), Namespace: m.Namespace, Labels: getAppLabels(m.Name), }, { code }
The problem can be in the fetch that should be using the same helper func to get the name.
{code :java} // getConfigMapName fetchAppConfigMap returns an string name with the name of the configMap config map resource created for this instance func getConfigMapName ( m r * ReconcileMobileSecurityService) fetchAppConfigMap(reqLogger logr.Logger, instance * mobilesecurityservicev1alpha1.MobileSecurityService) string (*corev1.ConfigMap, error) { if len reqLogger.Info ( m "Checking if the ConfigMap already exists") configMap := &corev1 . Spec ConfigMap{} err := r . ConfigMapName client.Get(context.TODO( ) > 0 , types.NamespacedName { return m Name: instance .Spec.ConfigMapName , Namespace: instance.Namespace } , configMap) return m.Name configMap, err } {code} For some reason, it is not getting the specified name in the CR. We can just remove the name from the CR and make the configMap be always the m.name since it is not a requirement at all.
|
|