diff --git a/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml b/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml index df383c5..a2d6795 100644 --- a/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml @@ -190,6 +190,8 @@ spec: path: public_base_url x-descriptors: - urn:alm:descriptor:com.tectonic.ui:text + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden - displayName: Automation Server URL path: automation_server_url x-descriptors: diff --git a/roles/eda/tasks/deploy_eda.yml b/roles/eda/tasks/deploy_eda.yml index a3e0b6b..2fec590 100644 --- a/roles/eda/tasks/deploy_eda.yml +++ b/roles/eda/tasks/deploy_eda.yml @@ -14,10 +14,17 @@ changed_when: false - name: Apply ConfigMap resources + k8s: + apply: yes + definition: "{{ lookup('template', 'redirect-page.configmap.html.j2') }}" + wait: yes + +- name: Apply Redirect Page Configmap k8s: apply: yes definition: "{{ lookup('template', 'eda.configmap.yaml.j2') }}" wait: yes + when: public_base_url is defined - name: Apply Backend deployment resources k8s: diff --git a/roles/eda/templates/eda-api.configmap.yaml.j2 b/roles/eda/templates/eda-api.configmap.yaml.j2 index eb7d3dd..f52c5a4 100644 --- a/roles/eda/templates/eda-api.configmap.yaml.j2 +++ b/roles/eda/templates/eda-api.configmap.yaml.j2 @@ -40,11 +40,8 @@ data: proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location / { - proxy_pass http://gunicorn; # Forward requests to Django app - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + root {{ static_path }}; + try_files /redirect-page.html =404; access_log /var/log/nginx/proxy_access.log; error_log /var/log/nginx/proxy_error.log; } diff --git a/roles/eda/templates/eda-api.deployment.yaml.j2 b/roles/eda/templates/eda-api.deployment.yaml.j2 index 4d35bd4..fd8efa9 100644 --- a/roles/eda/templates/eda-api.deployment.yaml.j2 +++ b/roles/eda/templates/eda-api.deployment.yaml.j2 @@ -374,7 +374,12 @@ spec: - containerPort: {{ api_nginx_port }} volumeMounts: - name: static-files - mountPath: {{ static_path }} + mountPath: '{{ static_path }}' +{% if public_base_url is defined %} + - name: redirect-page + mountPath: '{{ static_path }}/redirect-page.html' + subPath: redirect-page.html +{% endif %} - name: '{{ ansible_operator_meta.name }}-nginx-api-conf' mountPath: /etc/nginx/nginx.conf subPath: nginx.conf @@ -387,6 +392,14 @@ spec: volumes: - name: static-files emptyDir: {} +{% if public_base_url is defined %} + - name: redirect-page + configMap: + name: '{{ ansible_operator_meta.name }}-redirect-page' + items: + - key: redirect-page.html + path: redirect-page.html +{% endif %} - name: '{{ ansible_operator_meta.name }}-nginx-api-conf' configMap: name: '{{ ansible_operator_meta.name }}-nginx-api-configmap' diff --git a/roles/eda/templates/redirect-page.configmap.html.j2 b/roles/eda/templates/redirect-page.configmap.html.j2 new file mode 100644 index 0000000..e6a73fd --- /dev/null +++ b/roles/eda/templates/redirect-page.configmap.html.j2 @@ -0,0 +1,77 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ ansible_operator_meta.name }}-redirect-page + namespace: {{ ansible_operator_meta.namespace }} +data: + redirect-page.html: | + + + + + + + Redirecting to Ansible Automation Platform + + + + + + + + + + + + + + +

Redirecting to Ansible Automation Platform...

+

If you are not redirected automatically, click here to go to AAP.

+

+ The API endpoints for this platform service will temporarily remain available at the URL for this service. + Please use the Ansible Automation Platform API endpoints corresponding to this component in the future. + These can be found at {{ public_base_url }}/api/eda. +

+ + + + + +