Skip to content

Commit 634ae09

Browse files
committed
Make cluster-proxy env in workbenches as optional
Signed-off-by: Harshad Reddy Nalla <[email protected]> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent eacf63c commit 634ae09

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

components/odh-notebook-controller/config/manager/manager.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,10 @@ spec:
5959
value: "true"
6060
- name: SET_PIPELINE_SECRET
6161
value: "true"
62+
- name: INJECT_CLUSTER_PROXY_ENV
63+
valueFrom:
64+
configMapKeyRef:
65+
name: notebook-controller-setting-config
66+
key: INJECT_CLUSTER_PROXY_ENV
67+
optional: true
68+

components/odh-notebook-controller/controllers/notebook_webhook.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"net/http"
2323
"os"
2424
"sort"
25+
"strconv"
2526
"strings"
2627
"sync"
2728

@@ -380,8 +381,17 @@ func (w *NotebookWebhook) Handle(ctx context.Context, req admission.Request) adm
380381
}
381382
}
382383

383-
// If cluster-wide-proxy is enabled add environment variables
384-
if w.ClusterWideProxyIsEnabled() {
384+
// If cluster-wide-proxy is enabled, and INJECT_CLUSTER_PROXY_ENV is set to true,
385+
// inject the environment variables.
386+
// RHOAIENG-26099: This is a temporary solution to inject the proxy environment variables
387+
// until the notebooks controller supports injecting the proxy environment variables
388+
injectClusterProxy := false
389+
if raw, ok := os.LookupEnv("INJECT_CLUSTER_PROXY_ENV"); ok {
390+
if val, err := strconv.ParseBool(strings.TrimSpace(raw)); err == nil {
391+
injectClusterProxy = val
392+
}
393+
}
394+
if w.ClusterWideProxyIsEnabled() && injectClusterProxy {
385395
err = InjectProxyConfigEnvVars(notebook)
386396
if err != nil {
387397
return admission.Errored(http.StatusInternalServerError, err)

0 commit comments

Comments
 (0)