@@ -18,6 +18,7 @@ package controllers
18
18
import (
19
19
"context"
20
20
"fmt"
21
+ "net/http"
21
22
"strconv"
22
23
"strings"
23
24
"time"
@@ -27,6 +28,7 @@ import (
27
28
"github.com/devfile/devworkspace-operator/controllers/workspace/metrics"
28
29
"github.com/devfile/devworkspace-operator/pkg/common"
29
30
"github.com/devfile/devworkspace-operator/pkg/conditions"
31
+ "github.com/devfile/devworkspace-operator/pkg/config"
30
32
wkspConfig "github.com/devfile/devworkspace-operator/pkg/config"
31
33
"github.com/devfile/devworkspace-operator/pkg/constants"
32
34
"github.com/devfile/devworkspace-operator/pkg/dwerrors"
@@ -142,7 +144,12 @@ func (r *DevWorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request
142
144
reqLogger = reqLogger .WithValues (constants .DevWorkspaceIDLoggerKey , workspace .Status .DevWorkspaceId )
143
145
reqLogger .Info ("Reconciling Workspace" , "resolvedConfig" , configString )
144
146
145
- setupHttpClients (r .Client , config , r .Log )
147
+ // Inject ca certificates to the http clint if the certificates configmap is created and defined in the config.
148
+ if certs , ok := readCertificates (r .Client , config , r .Log ); ok {
149
+ for _ , certsPem := range certs {
150
+ injectCertificates ([]byte (certsPem ), httpClient .Transport .(* http.Transport ))
151
+ }
152
+ }
146
153
147
154
// Check if the DevWorkspaceRouting instance is marked to be deleted, which is
148
155
// indicated by the deletion timestamp being set.
@@ -670,6 +677,8 @@ func (r *DevWorkspaceReconciler) getWorkspaceId(ctx context.Context, workspace *
670
677
}
671
678
672
679
func (r * DevWorkspaceReconciler ) SetupWithManager (mgr ctrl.Manager ) error {
680
+ setupHttpClients (mgr .GetClient (), config .GetGlobalConfig (), mgr .GetLogger ())
681
+
673
682
maxConcurrentReconciles , err := wkspConfig .GetMaxConcurrentReconciles ()
674
683
if err != nil {
675
684
return err
0 commit comments