Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding redirect page #1982

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/crd/bases/awx.ansible.com_awxs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,10 @@ spec:
description: Enable metrics utility shipping to Red Hat Hybrid Cloud Console
type: boolean
default: false
public_base_url:
description: Public base URL
type: string
default: ''
type: object
status:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ spec:
path: db_management_pod_node_selector
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- displayName: Public Base URL
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
statusDescriptors:
- description: Persistent volume claim name used during backup
displayName: Backup Claim
Expand Down
6 changes: 6 additions & 0 deletions roles/installer/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
- name: Include secret key configuration tasks
include_tasks: secret_key_configuration.yml

- name: Apply Redirect Page Configmap
k8s:
apply: true
definition: "{{ lookup('template', 'configmaps/redirect-page.configmap.html.j2') }}"
when: public_base_url is defined

- name: Load LDAP CAcert certificate (Deprecated)
include_tasks: load_ldap_cacert_secret.yml
when:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ ansible_operator_meta.name }}-redirect-page
namespace: {{ ansible_operator_meta.namespace }}
data:
redirect-page.html: |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="15; url={{ public_base_url }}">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirecting to Ansible Automation Platform</title>

<!-- Favicon links -->
<link rel="icon" type="image/x-icon" href="static/media/favicon.ico">

<!-- Link to DRF's CSS -->
<link rel="stylesheet" type="text/css" href="static/rest_framework/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="static/rest_framework/css/bootstrap-theme.min.css">

<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding-top: 0px;
/* background-color: rgb(34, 34, 34); */
}
.banner {
background-color: #151414;
color: rgb(255, 255, 255);
padding: 20px;
margin-bottom: 20px;
min-height: 70px; /* Ensure the banner is tall enough to fit the logo */
text-align: left;
}
.logo {
width: 150px;
margin-bottom: 20px;
}
a {
color: #007BFF;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.doc-note {
font-size: 0.7em; /* Makes the text smaller */
color: #555; /* Optional: Change text color to a lighter shade */
background-color: #f9f9f9; /* Optional: Light background color */
padding: 10px; /* Optional: Add some padding */
margin: 10px 0; /* Optional: Add some margin */
}
</style>
</head>
<body>
<!-- Banner Section with Brand Logo -->
<div class="banner">
<img src="/static/media/aap-logo.svg" alt="Brand Logo">
</div>

<h2>Redirecting to Ansible Automation Platform...</h2>
<p>If you are not redirected automatically, <a href="{{ public_base_url }}">click here</a> to go to AAP.</p>
<p class="doc-note">
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 <a href="{{ public_base_url }}/api/{{ deployment_type }}" target="_blank">{{ public_base_url }}/api/{{ deployment_type }}</a>.
</p>

<!-- Include any additional scripts if needed -->
<script src="static/rest_framework/js/jquery-3.5.1.min.js"></script>
<script src="static/rest_framework/js/bootstrap.min.js"></script>
</body>
</html>
22 changes: 18 additions & 4 deletions roles/installer/templates/deployments/web.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ spec:
annotations:
kubectl.kubernetes.io/default-container: '{{ ansible_operator_meta.name }}-web'
{% for template in [
"configmaps/config",
"secrets/app_credentials",
"storage/persistent",
"configmaps/config.yaml",
"configmaps/redirect-page.configmap.html",
"secrets/app_credentials.yaml",
"storage/persistent.yaml",
] %}
checksum-{{ template | replace('/', '-') }}: "{{ lookup('template', template + '.yaml.j2') | sha1 }}"
checksum-{{ template | replace('/', '-') }}: "{{ lookup('template', template + '.j2') | sha1 }}"
{% endfor %}
{% for secret in [
"bundle_cacert",
Expand Down Expand Up @@ -197,6 +198,11 @@ spec:
timeoutSeconds: {{ web_readiness_timeout }}
{% endif %}
volumeMounts:
{% if public_base_url is defined %}
- name: redirect-page
mountPath: '/var/lib/awx/venv/awx/lib/python3.11/site-packages/awx/ui/build/index.html'
subPath: redirect-page.html
{% endif %}
{% if bundle_ca_crt %}
- name: "ca-trust-extracted"
mountPath: "/etc/pki/ca-trust/extracted"
Expand Down Expand Up @@ -375,6 +381,14 @@ spec:
{{ security_context_settings | to_nice_yaml | indent(8) }}
{% endif %}
volumes:
{% 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 }}-receptor-ca"
secret:
secretName: "{{ ansible_operator_meta.name }}-receptor-ca"
Expand Down
Loading