Skip to content

Commit b757f86

Browse files
Merge pull request #877 from opendatahub-io/revert-827-clean-fix-ipv6-issue
Revert "RHOAIENG-17306, RHOAIENG-17307, RHOAIENG-17308: feat(workbenches): tolerate IPv6 environments in codeserver, jupyterlab and rstudio"
2 parents 9840e7b + a394e6e commit b757f86

File tree

10 files changed

+16
-46
lines changed

10 files changed

+16
-46
lines changed

codeserver/ubi9-python-3.11/nginx/api/kernels/access.cgi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ echo "Status: 200"
33
echo "Content-type: application/json"
44
echo
55
# Query the heartbeat endpoint
6-
HEALTHZ=$(curl -s http://localhost:8888/codeserver/healthz)
6+
HEALTHZ=$(curl -s http://127.0.0.1:8888/codeserver/healthz)
77
# Extract last_activity | remove milliseconds
88
LAST_ACTIVITY_EPOCH=$(echo $HEALTHZ | grep -Po 'lastHeartbeat":\K.*?(?=})' | awk '{ print substr( $0, 1, length($0)-3 ) }')
99
# Convert to ISO8601 date format

codeserver/ubi9-python-3.11/nginx/root/opt/app-root/nginxconf.sed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change port
22
/listen/s%80%8888 default_server%
33

4+
# Remove listening on IPv6
5+
/\[::\]/d
6+
47
# One worker only
58
/worker_processes/s%auto%1%
69

codeserver/ubi9-python-3.11/nginx/serverconf/proxy.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ location = /codeserver {
4545

4646
location /codeserver/ {
4747
# Standard code-server/NGINX configuration
48-
proxy_pass http://localhost:8787/;
48+
proxy_pass http://127.0.0.1:8787/;
4949
proxy_http_version 1.1;
5050
proxy_set_header Upgrade $http_upgrade;
5151
proxy_set_header Connection $connection_upgrade;

codeserver/ubi9-python-3.11/nginx/serverconf/proxy.conf.template_nbprefix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ location = / {
5959
location /codeserver/ {
6060
rewrite ^/codeserver/(.*)$ /$1 break;
6161
# Standard RStudio/NGINX configuration
62-
proxy_pass http://localhost:8787;
62+
proxy_pass http://127.0.0.1:8787;
6363
proxy_http_version 1.1;
6464
proxy_set_header Upgrade $http_upgrade;
6565
proxy_set_header Connection $connection_upgrade;

codeserver/ubi9-python-3.11/run-code-server.sh

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,10 @@ if [ ! -d "$logs_dir" ]; then
110110
mkdir -p "$logs_dir"
111111
fi
112112

113-
# IPv6 support
114-
echo "Checking IPv6 support..."
115-
if [ -f /proc/net/if_inet6 ]; then
116-
BIND_ADDR="[::]:8787" # IPv6/dual-stack
117-
echo "IPv6 detected: binding to all interfaces (IPv4 + IPv6)"
118-
else
119-
BIND_ADDR="0.0.0.0:8787" # IPv4 only
120-
echo "IPv6 not detected: falling back to IPv4 only"
121-
fi
122-
123113
# Start server
124114
start_process /usr/bin/code-server \
125-
--bind-addr "${BIND_ADDR}" \
126-
--disable-telemetry \
127-
--auth none \
128-
--disable-update-check \
129-
/opt/app-root/src
115+
--bind-addr 0.0.0.0:8787 \
116+
--disable-telemetry \
117+
--auth none \
118+
--disable-update-check \
119+
/opt/app-root/src

jupyter/minimal/ubi9-python-3.11/start-notebook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ fi
3535

3636
# Start the JupyterLab notebook
3737
start_process jupyter lab ${NOTEBOOK_PROGRAM_ARGS} \
38-
--ServerApp.ip="" \
38+
--ServerApp.ip=0.0.0.0 \
3939
--ServerApp.allow_origin="*" \
4040
--ServerApp.open_browser=False

rstudio/c9s-python-3.11/nginx/serverconf/proxy.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ location = /rstudio {
5050
location /rstudio/ {
5151
rewrite ^/rstudio/(.*)$ /$1 break;
5252
# Standard RStudio/NGINX configuration
53-
proxy_pass http://localhost:8787;
53+
proxy_pass http://127.0.0.1:8787;
5454
proxy_http_version 1.1;
5555
proxy_set_header Upgrade $http_upgrade;
5656
proxy_set_header Connection $connection_upgrade;

rstudio/c9s-python-3.11/nginx/serverconf/proxy.conf.template_nbprefix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ location = / {
7777
location /rstudio/ {
7878
rewrite ^/rstudio/(.*)$ /$1 break;
7979
# Standard RStudio/NGINX configuration
80-
proxy_pass http://localhost:8787;
80+
proxy_pass http://127.0.0.1:8787;
8181
proxy_http_version 1.1;
8282
proxy_set_header Upgrade $http_upgrade;
8383
proxy_set_header Connection $connection_upgrade;

rstudio/c9s-python-3.11/setup_rstudio.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,6 @@ def _support_arg(arg):
4646
ret = subprocess.check_output([get_rstudio_executable('rserver'), '--help'])
4747
return ret.decode().find(arg) != -1
4848

49-
def detect_env():
50-
import socket
51-
supports_ipv4 = supports_ipv6 = False
52-
try:
53-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
54-
s.bind(('127.0.0.1', 0))
55-
supports_ipv4 = True
56-
except OSError:
57-
pass
58-
try:
59-
with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as s:
60-
s.bind(('::1', 0))
61-
supports_ipv6 = True
62-
except OSError:
63-
pass
64-
if supports_ipv4 and supports_ipv6:
65-
return '::' # Dual-stack
66-
elif supports_ipv6:
67-
return '::'
68-
elif supports_ipv4:
69-
return '0.0.0.0'
70-
else:
71-
raise EnvironmentError('No IPv4 or IPv6 support detected.')
72-
7349
def _get_cmd(port):
7450
ntf = tempfile.NamedTemporaryFile()
7551

@@ -84,7 +60,7 @@ def _get_cmd(port):
8460
'--server-working-dir=' + os.getenv('HOME'),
8561
'--auth-none=1',
8662
'--www-frame-origin=same',
87-
'--www-address='+ detect_env(),
63+
#'--www-address=0.0.0.0',
8864
'--www-port=' + str(port),
8965
'--www-verify-user-agent=0',
9066
'--rsession-which-r=' + get_rstudio_executable('R'),

tests/containers/workbenches/workbench_image_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def test_image_entrypoint_starts(self, image: str, sysctls) -> None:
4949
finally:
5050
docker_utils.NotebookContainer(container).stop(timeout=0)
5151

52+
@pytest.mark.skip(reason="RHOAIENG-17305: currently our Workbench images don't tolerate IPv6")
5253
def test_ipv6_only(self, image: str, test_frame):
5354
"""Test that workbench image is accessible via IPv6.
5455
Workarounds for macOS will be needed, so that's why it's a separate test."""

0 commit comments

Comments
 (0)