Skip to content

Commit 958ddf0

Browse files
Merge pull request #2166 from danielmellado/monitoring_console_ipv6_remove
OCPBUGS-21610: Change config to allow ipv6/4
2 parents 1af6396 + 0ee8922 commit 958ddf0

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

assets/monitoring-plugin/config-map.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ data:
88
default_type application/octet-stream;
99
keepalive_timeout 65;
1010
server {
11-
listen 9443 ssl;
12-
listen [::]:9443 ssl;
11+
listen LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME ssl;
1312
ssl_certificate /var/cert/tls.crt;
1413
ssl_certificate_key /var/cert/tls.key;
1514
root /usr/share/nginx/html;

assets/monitoring-plugin/deployment.yaml

+17-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,23 @@ spec:
4444
topologyKey: kubernetes.io/hostname
4545
automountServiceAccountToken: false
4646
containers:
47-
- image: quay.io/openshift/origin-monitoring-plugin:1.0.0
47+
- command:
48+
- /bin/sh
49+
- -c
50+
- |
51+
if echo "$POD_IP" | grep -qE '^([0-9]{1,3}\.){3}[0-9]{1,3}$'; then
52+
LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME="9943"
53+
else
54+
LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME="[::]:9443"
55+
fi
56+
sed "s/LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME/$LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME/g" /etc/nginx/nginx.conf > /tmp/nginx.conf
57+
exec nginx -c /tmp/nginx.conf -g 'daemon off;'
58+
env:
59+
- name: POD_IP
60+
valueFrom:
61+
fieldRef:
62+
fieldPath: status.podIP
63+
image: quay.io/openshift/origin-monitoring-plugin:1.0.0
4864
imagePullPolicy: IfNotPresent
4965
name: monitoring-plugin
5066
ports:

jsonnet/components/monitoring-plugin.libsonnet

+24-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ function(params)
2222
default_type application/octet-stream;
2323
keepalive_timeout 65;
2424
server {
25-
listen %(nginxPort)d ssl;
26-
listen [::]:%(nginxPort)d ssl;
25+
listen LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME ssl;
2726
ssl_certificate %(tlsPath)s/tls.crt;
2827
ssl_certificate_key %(tlsPath)s/tls.key;
2928
root /usr/share/nginx/html;
@@ -212,8 +211,29 @@ function(params)
212211
$.volumeMount(tlsVolumeName, tlsMountPath),
213212
$.volumeMount(nginxCMVolName, nginxConfMountPath, 'nginx.conf'),
214213
],
215-
216-
214+
env: [
215+
{
216+
name: 'POD_IP',
217+
valueFrom: {
218+
fieldRef: {
219+
fieldPath: 'status.podIP',
220+
},
221+
},
222+
},
223+
],
224+
command: [
225+
'/bin/sh',
226+
'-c',
227+
|||
228+
if echo "$POD_IP" | grep -qE '^([0-9]{1,3}\.){3}[0-9]{1,3}$'; then
229+
LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME="9943"
230+
else
231+
LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME="[::]:9443"
232+
fi
233+
sed "s/LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME/$LISTEN_ADDRESS_PORT_REPLACED_AT_RUNTIME/g" /etc/nginx/nginx.conf > /tmp/nginx.conf
234+
exec nginx -c /tmp/nginx.conf -g 'daemon off;'
235+
|||,
236+
],
217237
}, // monitoring-plugin container
218238
], // containers
219239

0 commit comments

Comments
 (0)