Skip to content

Commit d5683ad

Browse files
authored
adding redirect page (#1982)
1 parent 1bc3422 commit d5683ad

File tree

5 files changed

+110
-4
lines changed

5 files changed

+110
-4
lines changed

config/crd/bases/awx.ansible.com_awxs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,10 @@ spec:
20092009
description: Enable metrics utility shipping to Red Hat Hybrid Cloud Console
20102010
type: boolean
20112011
default: false
2012+
public_base_url:
2013+
description: Public base URL
2014+
type: string
2015+
default: ''
20122016
type: object
20132017
status:
20142018
properties:

config/manifests/bases/awx-operator.clusterserviceversion.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ spec:
173173
path: db_management_pod_node_selector
174174
x-descriptors:
175175
- urn:alm:descriptor:com.tectonic.ui:advanced
176+
- displayName: Public Base URL
177+
path: public_base_url
178+
x-descriptors:
179+
- urn:alm:descriptor:com.tectonic.ui:text
180+
- urn:alm:descriptor:com.tectonic.ui:advanced
181+
- urn:alm:descriptor:com.tectonic.ui:hidden
176182
statusDescriptors:
177183
- description: Persistent volume claim name used during backup
178184
displayName: Backup Claim

roles/installer/tasks/install.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
- name: Include secret key configuration tasks
4545
include_tasks: secret_key_configuration.yml
4646

47+
- name: Apply Redirect Page Configmap
48+
k8s:
49+
apply: true
50+
definition: "{{ lookup('template', 'configmaps/redirect-page.configmap.html.j2') }}"
51+
when: public_base_url is defined
52+
4753
- name: Load LDAP CAcert certificate (Deprecated)
4854
include_tasks: load_ldap_cacert_secret.yml
4955
when:
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ ansible_operator_meta.name }}-redirect-page
5+
namespace: {{ ansible_operator_meta.namespace }}
6+
data:
7+
redirect-page.html: |
8+
<!DOCTYPE html>
9+
<html lang="en">
10+
<head>
11+
<meta charset="UTF-8">
12+
<meta http-equiv="refresh" content="15; url={{ public_base_url }}">
13+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
14+
<title>Redirecting to Ansible Automation Platform</title>
15+
16+
<!-- Favicon links -->
17+
<link rel="icon" type="image/x-icon" href="static/media/favicon.ico">
18+
19+
<!-- Link to DRF's CSS -->
20+
<link rel="stylesheet" type="text/css" href="static/rest_framework/css/bootstrap.min.css">
21+
<link rel="stylesheet" type="text/css" href="static/rest_framework/css/bootstrap-theme.min.css">
22+
23+
<style>
24+
body {
25+
font-family: Arial, sans-serif;
26+
text-align: center;
27+
padding-top: 0px;
28+
/* background-color: rgb(34, 34, 34); */
29+
}
30+
.banner {
31+
background-color: #151414;
32+
color: rgb(255, 255, 255);
33+
padding: 20px;
34+
margin-bottom: 20px;
35+
min-height: 70px; /* Ensure the banner is tall enough to fit the logo */
36+
text-align: left;
37+
}
38+
.logo {
39+
width: 150px;
40+
margin-bottom: 20px;
41+
}
42+
a {
43+
color: #007BFF;
44+
text-decoration: none;
45+
}
46+
a:hover {
47+
text-decoration: underline;
48+
}
49+
.doc-note {
50+
font-size: 0.7em; /* Makes the text smaller */
51+
color: #555; /* Optional: Change text color to a lighter shade */
52+
background-color: #f9f9f9; /* Optional: Light background color */
53+
padding: 10px; /* Optional: Add some padding */
54+
margin: 10px 0; /* Optional: Add some margin */
55+
}
56+
</style>
57+
</head>
58+
<body>
59+
<!-- Banner Section with Brand Logo -->
60+
<div class="banner">
61+
<img src="/static/media/aap-logo.svg" alt="Brand Logo">
62+
</div>
63+
64+
<h2>Redirecting to Ansible Automation Platform...</h2>
65+
<p>If you are not redirected automatically, <a href="{{ public_base_url }}">click here</a> to go to AAP.</p>
66+
<p class="doc-note">
67+
The API endpoints for this platform service will temporarily remain available at the URL for this service.
68+
Please use the Ansible Automation Platform API endpoints corresponding to this component in the future.
69+
These can be found at <a href="{{ public_base_url }}/api/{{ deployment_type }}" target="_blank">{{ public_base_url }}/api/{{ deployment_type }}</a>.
70+
</p>
71+
72+
<!-- Include any additional scripts if needed -->
73+
<script src="static/rest_framework/js/jquery-3.5.1.min.js"></script>
74+
<script src="static/rest_framework/js/bootstrap.min.js"></script>
75+
</body>
76+
</html>

roles/installer/templates/deployments/web.yaml.j2

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ spec:
2828
annotations:
2929
kubectl.kubernetes.io/default-container: '{{ ansible_operator_meta.name }}-web'
3030
{% for template in [
31-
"configmaps/config",
32-
"secrets/app_credentials",
33-
"storage/persistent",
31+
"configmaps/config.yaml",
32+
"configmaps/redirect-page.configmap.html",
33+
"secrets/app_credentials.yaml",
34+
"storage/persistent.yaml",
3435
] %}
35-
checksum-{{ template | replace('/', '-') }}: "{{ lookup('template', template + '.yaml.j2') | sha1 }}"
36+
checksum-{{ template | replace('/', '-') }}: "{{ lookup('template', template + '.j2') | sha1 }}"
3637
{% endfor %}
3738
{% for secret in [
3839
"bundle_cacert",
@@ -197,6 +198,11 @@ spec:
197198
timeoutSeconds: {{ web_readiness_timeout }}
198199
{% endif %}
199200
volumeMounts:
201+
{% if public_base_url is defined %}
202+
- name: redirect-page
203+
mountPath: '/var/lib/awx/venv/awx/lib/python3.11/site-packages/awx/ui/build/index.html'
204+
subPath: redirect-page.html
205+
{% endif %}
200206
{% if bundle_ca_crt %}
201207
- name: "ca-trust-extracted"
202208
mountPath: "/etc/pki/ca-trust/extracted"
@@ -375,6 +381,14 @@ spec:
375381
{{ security_context_settings | to_nice_yaml | indent(8) }}
376382
{% endif %}
377383
volumes:
384+
{% if public_base_url is defined %}
385+
- name: redirect-page
386+
configMap:
387+
name: '{{ ansible_operator_meta.name }}-redirect-page'
388+
items:
389+
- key: redirect-page.html
390+
path: redirect-page.html
391+
{% endif %}
378392
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
379393
secret:
380394
secretName: "{{ ansible_operator_meta.name }}-receptor-ca"

0 commit comments

Comments
 (0)