diff options
Diffstat (limited to 'kubernetes/portal')
-rw-r--r-- | kubernetes/portal/docker/init/ubuntu/Dockerfile | 11 | ||||
-rw-r--r-- | kubernetes/portal/resources/scripts/update_hosts.sh | 17 | ||||
-rw-r--r-- | kubernetes/portal/templates/portal-vnc-dep.yaml | 29 | ||||
-rw-r--r-- | kubernetes/portal/values.yaml | 1 |
4 files changed, 33 insertions, 25 deletions
diff --git a/kubernetes/portal/docker/init/ubuntu/Dockerfile b/kubernetes/portal/docker/init/ubuntu/Dockerfile deleted file mode 100644 index 779a7fa921..0000000000 --- a/kubernetes/portal/docker/init/ubuntu/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:16.04 - -ENV no_proxy "localhost,127.0.0.1,.cluster.local,$KUBERNETES_SERVICE_HOST" -# Setup Corporate proxy -ENV https_proxy ${HTTPS_PROXY} -ENV http_proxy ${HTTP_PROXY} - -RUN apt-get update -RUN apt-get install -y host dnsutils - -VOLUME /ubuntu-init diff --git a/kubernetes/portal/resources/scripts/update_hosts.sh b/kubernetes/portal/resources/scripts/update_hosts.sh new file mode 100644 index 0000000000..cd38fafb40 --- /dev/null +++ b/kubernetes/portal/resources/scripts/update_hosts.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +_SRC_HOST=$1 +_DST_HOST=$2 +_IP=`getent hosts ${_SRC_HOST}|cut -d' ' -f1` +if [ -z ${_IP} ]; then + echo "Cannot retreive IP for host mapping ${_SRC_HOST} -> ${_DST_HOST}" + exit 1 +fi +_REGEX=".*[[:blank:]]${_DST_HOST}$" +if grep -c -e "${_REGEX}" /etc/hosts > /dev/null 2>&1 ; then + cp /etc/hosts /tmp/hosts + sed -i "s/${_REGEX}/${_IP} ${_DST_HOST}/g" /tmp/hosts + cp /tmp/hosts /etc/hosts +else + echo "${_IP} ${_DST_HOST}" >> /etc/hosts +fi diff --git a/kubernetes/portal/templates/portal-vnc-dep.yaml b/kubernetes/portal/templates/portal-vnc-dep.yaml index 536ac37396..b200d8fc15 100644 --- a/kubernetes/portal/templates/portal-vnc-dep.yaml +++ b/kubernetes/portal/templates/portal-vnc-dep.yaml @@ -6,6 +6,14 @@ metadata: data: {{ (.Files.Glob "resources/vnc/init_profile/profiles.ini").AsConfig | indent 2 }} --- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vnc-update-hosts + namespace: "{{ .Values.nsPrefix }}-portal" +data: +{{ (.Files.Glob "resources/scripts/update_hosts.sh").AsConfig | indent 2 }} +--- apiVersion: extensions/v1beta1 kind: Deployment metadata: @@ -71,21 +79,13 @@ spec: image: {{ .Values.image.readiness }} imagePullPolicy: {{ .Values.pullPolicy }} name: vnc-vid-readiness - - command: ["/bin/sh","-c"] - args: ["echo `host sdc-be.{{ .Values.nsPrefix }}-sdc | awk ''{print$4}''` sdc.api.be.simpledemo.onap.org >> /ubuntu-init/hosts; echo `host portalapps.{{ .Values.nsPrefix }}-portal | awk ''{print$4}''` portal.api.simpledemo.onap.org >> /ubuntu-init/hosts; echo `host pap.{{ .Values.nsPrefix }}-policy | awk ''{print$4}''` policy.api.simpledemo.onap.org >> /ubuntu-init/hosts; echo `host sdc-fe.{{ .Values.nsPrefix }}-sdc | awk ''{print$4}''` sdc.api.simpledemo.onap.org >> /ubuntu-init/hosts; echo `host vid-server.{{ .Values.nsPrefix }}-vid | awk ''{print$4}''` vid.api.simpledemo.onap.org >> /ubuntu-init/hosts; echo `host sparky-be.{{ .Values.nsPrefix }}-aai | awk ''{print$4}''` aai.api.simpledemo.onap.org >> /ubuntu-init/hosts"] - image: {{ .Values.image.ubuntuInit }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: vnc-init-hosts - volumeMounts: - - name: ubuntu-init - mountPath: /ubuntu-init/ containers: - image: {{ .Values.image.ubuntuDesktop }} imagePullPolicy: {{ .Values.pullPolicy }} lifecycle: postStart: exec: - command: ["/bin/sh", "-c", "mkdir -p /root/.mozilla/firefox/onap.default; cp /root/.init_profile/profiles.ini /root/.mozilla/firefox/; echo 'user_pref(\"browser.tabs.remote.autostart.2\", false);' > /root/.mozilla/firefox/onap.default/prefs.js; cat /ubuntu-init/hosts >> /etc/hosts"] + command: ["/bin/sh", "-c", "mkdir -p /root/.mozilla/firefox/onap.default; cp /root/.init_profile/profiles.ini /root/.mozilla/firefox/; echo 'user_pref(\"browser.tabs.remote.autostart.2\", false);' > /root/.mozilla/firefox/onap.default/prefs.js; (while true; do /tmp/update_hosts.sh sdc-be.{{ .Values.nsPrefix }}-sdc sdc.api.be.simpledemo.onap.org; /tmp/update_hosts.sh portalapps.{{ .Values.nsPrefix }}-portal portal.api.simpledemo.onap.org; /tmp/update_hosts.sh pap.{{ .Values.nsPrefix }}-policy policy.api.simpledemo.onap.org; /tmp/update_hosts.sh sdc-fe.{{ .Values.nsPrefix }}-sdc sdc.api.simpledemo.onap.org; /tmp/update_hosts.sh vid-server.{{ .Values.nsPrefix }}-vid vid.api.simpledemo.onap.org; /tmp/update_hosts.sh sparky-be.{{ .Values.nsPrefix }}-aai aai.api.simpledemo.onap.org; sleep 10; done) > update_hosts.log 2>&1 &"] env: - name: VNC_PASSWORD value: password @@ -94,11 +94,12 @@ spec: - mountPath: /etc/localtime name: localtime readOnly: true - - mountPath: /ubuntu-init/ - name: ubuntu-init - mountPath: /root/.init_profile/profiles.ini name: vnc-profiles-ini subPath: profiles.ini + - mountPath: /tmp/update_hosts.sh + name: vnc-update-hosts + subPath: update_hosts.sh securityContext: privileged: true securityContext: {} @@ -106,11 +107,13 @@ spec: - name: localtime hostPath: path: /etc/localtime - - name: ubuntu-init - emptyDir: {} - name: vnc-profiles-ini configMap: name: vnc-profiles-ini + - name: vnc-update-hosts + configMap: + name: vnc-update-hosts + defaultMode: 0755 imagePullSecrets: - name: "{{ .Values.nsPrefix }}-docker-registry-key" #{{ end }} diff --git a/kubernetes/portal/values.yaml b/kubernetes/portal/values.yaml index aaa781995a..6e2e83d215 100644 --- a/kubernetes/portal/values.yaml +++ b/kubernetes/portal/values.yaml @@ -7,7 +7,6 @@ image: portaldb: nexus3.onap.org:10001/onap/portal-db:v1.3.0 mariadbClient: oomk8s/mariadb-client-init:1.0.0 portalwms: nexus3.onap.org:10001/onap/portal-wms:v1.3.0 - ubuntuInit: oomk8s/ubuntu-init:1.0.0 ubuntuDesktop: dorowu/ubuntu-desktop-lxde-vnc filebeat: docker.elastic.co/beats/filebeat:5.5.0 onapPortal: |