Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoliy Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Jun 11, 2020
1 parent e7c8502 commit 7488938
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
9 changes: 6 additions & 3 deletions pkg/controller/che/che_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 7 additions & 3 deletions pkg/deploy/configmap_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/deploy/registry_configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 7488938

Please sign in to comment.