From b7fe03492a104de62c9687e1167ca20d83779113 Mon Sep 17 00:00:00 2001 From: Anatoliy Bazko Date: Thu, 11 Jun 2020 13:40:45 +0300 Subject: [PATCH] Fixes Signed-off-by: Anatoliy Bazko --- pkg/controller/che/che_controller.go | 9 ++++++--- pkg/deploy/configmap_cert.go | 10 +++++++--- pkg/deploy/registry_configmap.go | 1 - 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pkg/controller/che/che_controller.go b/pkg/controller/che/che_controller.go index b85b63658a..aaebd7f576 100644 --- a/pkg/controller/che/che_controller.go +++ b/pkg/controller/che/che_controller.go @@ -315,18 +315,21 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e } } + // Read proxy configuration proxy, err := r.getProxyConfiguration(instance) if err != nil { - logrus.Error(err) + logrus.Errorf("Error on reading proxy configuration: %v", err) return reconcile.Result{}, err } if proxy.TrustedCAMapName != "" { provisioned, err := r.putOpenShiftCertsIntoConfigMap(instance, proxy, clusterAPI) if !provisioned { - logrus.Infof("Waiting on provisioning OpenShift certificates into '%s' config map", instance.Spec.Server.ServerTrustStoreConfigMapName) + configMapName := instance.Spec.Server.ServerTrustStoreConfigMapName if err != nil { - logrus.Error(err) + logrus.Errorf("Error on provisioning config map '%s': %v", configMapName, err) + } else { + logrus.Infof("Waiting on provisioning config map '%s'", configMapName) } return reconcile.Result{}, err } diff --git a/pkg/deploy/configmap_cert.go b/pkg/deploy/configmap_cert.go index e244743504..cb21586e2c 100644 --- a/pkg/deploy/configmap_cert.go +++ b/pkg/deploy/configmap_cert.go @@ -19,6 +19,10 @@ import ( corev1 "k8s.io/api/core/v1" ) +const ( + injector = "config.openshift.io/inject-trusted-cabundle" +) + func SyncTrustStoreConfigMapToCluster(checluster *orgv1.CheCluster, clusterAPI ClusterAPI) (*corev1.ConfigMap, error) { name := checluster.Spec.Server.ServerTrustStoreConfigMapName specConfigMap, err := GetSpecConfigMap(checluster, name, map[string]string{}, clusterAPI) @@ -27,7 +31,7 @@ func SyncTrustStoreConfigMapToCluster(checluster *orgv1.CheCluster, clusterAPI C } // OpenShift will automatically injects all certs into the configmap - specConfigMap.ObjectMeta.Labels["config.openshift.io/inject-trusted-cabundle"] = "true" + specConfigMap.ObjectMeta.Labels[injector] = "true" clusterConfigMap, err := getClusterConfigMap(specConfigMap.Name, specConfigMap.Namespace, clusterAPI.Client) if err != nil { @@ -40,8 +44,8 @@ func SyncTrustStoreConfigMapToCluster(checluster *orgv1.CheCluster, clusterAPI C return nil, err } - if clusterConfigMap.ObjectMeta.Labels["config.openshift.io/inject-trusted-cabundle"] != "true" { - clusterConfigMap.ObjectMeta.Labels["config.openshift.io/inject-trusted-cabundle"] = "true" + if clusterConfigMap.ObjectMeta.Labels[injector] != "true" { + clusterConfigMap.ObjectMeta.Labels[injector] = "true" logrus.Infof("Updating existed object: %s, name: %s", specConfigMap.Kind, specConfigMap.Name) err := clusterAPI.Client.Update(context.TODO(), clusterConfigMap) return nil, err diff --git a/pkg/deploy/registry_configmap.go b/pkg/deploy/registry_configmap.go index 7cc9974a65..5c137b4850 100644 --- a/pkg/deploy/registry_configmap.go +++ b/pkg/deploy/registry_configmap.go @@ -50,7 +50,6 @@ func CreateDevfileRegistryConfigMap(cr *orgv1.CheCluster, endpoint string) *core func CreatePluginRegistryConfigMap(cr *orgv1.CheCluster) *corev1.ConfigMap { labels := GetLabels(cr, DefaultCheFlavor(cr)) - fmt.Println("Cr namespace " + cr.Namespace) return &corev1.ConfigMap{ TypeMeta: metav1.TypeMeta{ Kind: "ConfigMap",