The name is defined in the 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}
Also, I note that the fetch that should be using the same helper func to get the name and it is not.
{code:java} //fetchAppConfigMap returns the config map resource created for this instance func (r *ReconcileMobileSecurityService) fetchAppConfigMap(reqLogger logr.Logger, instance *mobilesecurityservicev1alpha1.MobileSecurityService) (*corev1.ConfigMap, error) { reqLogger.Info("Checking if the ConfigMap already exists") configMap := &corev1.ConfigMap{} err := r.client.Get(context.TODO(), types.NamespacedName{Name: instance.Spec.ConfigMapName, Namespace: instance.Namespace}, configMap) return configMap, err }
{code} NOTE: We could fix by creating the ConfigMap with the same name always as well since i is not a requirement. If the fix is to change the possibility to specify a name do not forget to change all places and the readme. |
|