Skip to content

Commit be530fc

Browse files
authored
Merge pull request #628 from harshad16/optional-proxy-vars
RHOAIENG-26099: Make cluster-proxy env in workbenches as optional
2 parents 22c635d + 634ae09 commit be530fc

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

@@ -383,8 +384,17 @@ func (w *NotebookWebhook) Handle(ctx context.Context, req admission.Request) adm
383384
}
384385
}
385386

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

0 commit comments

Comments
 (0)