From ecdb7ad315cd5a5b59c321f48c09c4f9d2adfece Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Sun, 18 Feb 2024 17:18:42 +0100 Subject: [PATCH] openshift: add custom haproxy 504 page --- .../openshift-apps/custom-error-pages.yml | 19 ++ .../openshift-config/templates/504.html | 260 ++++++++++++++++++ .../templates/error-code-pages.yml | 10 + 3 files changed, 289 insertions(+) create mode 100644 playbooks/openshift-apps/custom-error-pages.yml create mode 100644 roles/openshift-apps/openshift-config/templates/504.html create mode 100644 roles/openshift-apps/openshift-config/templates/error-code-pages.yml diff --git a/playbooks/openshift-apps/custom-error-pages.yml b/playbooks/openshift-apps/custom-error-pages.yml new file mode 100644 index 0000000000..36334213a6 --- /dev/null +++ b/playbooks/openshift-apps/custom-error-pages.yml @@ -0,0 +1,19 @@ +- name: make the app be real + hosts: os_control[0]:os_control_stg[0] + user: root + gather_facts: false + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml + + roles: + - role: openshift/object + app: openshift-config + objectname: error-code-pages.yml + template: error-code-pages.yml + + post_tasks: + - name: Patch ingress controller with custom error pages + command: oc patch -n openshift-ingress-operator ingresscontroller/default --patch '{"spec":{"httpErrorCodePages":{"name":"fedora-error-code-pages"}}}' --type=merge diff --git a/roles/openshift-apps/openshift-config/templates/504.html b/roles/openshift-apps/openshift-config/templates/504.html new file mode 100644 index 0000000000..7d6ce687ca --- /dev/null +++ b/roles/openshift-apps/openshift-config/templates/504.html @@ -0,0 +1,260 @@ +HTTP/1.0 503 Service Unavailable +Pragma: no-cache +Cache-Control: private, max-age=0, no-cache, no-store +Connection: close +Content-Type: text/html + + + + + + + + + +
+

Application is not available :(

+

The application is currently not serving requests at this endpoint. It may not have been started or is still + starting.

+ +
+

+ Possible reasons you are seeing this page: +

+
    +
  • + Scheduled maintenance. + Check if there is a maintenance planned or known outage on the Fedora Infrastructure Status page. +
  • +
  • + Service outage. + If you see this message for an extended time, it might indicate a more serious problem with this application. + Contact the oncall person for more information on the Fedora Infrastructure Matrix channel by + using the !oncall command. + Alternatively, open a ticket on the Fedora + Infrastructure issue tracker. +
  • +
  • + Configuration issue. + If you are a developer working on this application, make sure that the resources exposed by this route (pods, + services, deployments, etc) exist and have at least one pod running. +
  • +
+
+
+ + + + \ No newline at end of file diff --git a/roles/openshift-apps/openshift-config/templates/error-code-pages.yml b/roles/openshift-apps/openshift-config/templates/error-code-pages.yml new file mode 100644 index 0000000000..07a7e010d3 --- /dev/null +++ b/roles/openshift-apps/openshift-config/templates/error-code-pages.yml @@ -0,0 +1,10 @@ +{% macro load_file(filename) %}{% include filename %}{%- endmacro -%} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: fedora-error-code-pages + namespace: openshift-config +data: + error-page-503.http: |- + {{ load_file('504.html') | indent(4) }} \ No newline at end of file