]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: adding health check endpoint for mgmt-gateway 59927/head
authorRedouane Kachach <rkachach@ibm.com>
Mon, 23 Sep 2024 14:16:46 +0000 (16:16 +0200)
committerRedouane Kachach <rkachach@ibm.com>
Mon, 23 Sep 2024 14:56:18 +0000 (16:56 +0200)
Signed-off-by: Redouane Kachach <rkachach@ibm.com>
src/pybind/mgr/cephadm/templates/services/mgmt-gateway/external_server.conf.j2
src/pybind/mgr/cephadm/templates/services/mgmt-gateway/internal_server.conf.j2
src/python-common/ceph/deployment/service_spec.py

index 260e7418e2d7fa295b73f4b83e5e8e0c6ad37671..f33bc6c8dfdc8fdc29d24dd31e1ae4fe53a7e711 100644 (file)
@@ -46,6 +46,12 @@ server {
     # add_header Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'none'; require-trusted-types-for 'script'; frame-ancestors 'self';";
 {% endif %}
 
+{% if spec.enable_health_check_endpoint %}
+    location /health {
+         return 200 'OK';
+         add_header Content-Type text/plain;
+    }
+{% endif %}
 {% if oauth2_proxy_url %}
     location /oauth2/ {
         proxy_pass {{ oauth2_proxy_url }};
index f2c32f8797750505aa9c076d4d0cee952fbb957a..829c075758921a94aec98a17e57c5fbdc783bc87 100644 (file)
@@ -9,6 +9,12 @@ server {
     ssl_ciphers         ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
     ssl_prefer_server_ciphers on;
 
+{% if spec.enable_health_check_endpoint %}
+    location /health {
+         return 200 'OK';
+         add_header Content-Type text/plain;
+    }
+{% endif %}
 {% if dashboard_endpoints %}
     location /internal/dashboard {
         rewrite ^/internal/dashboard/(.*) /$1 break;
index d1ef9f5ac95115845d5d1fad494320250dc014b0..459ab7df1a00224517aba0fc12c4f70a55a6c123 100644 (file)
@@ -1804,6 +1804,7 @@ class MgmtGatewaySpec(ServiceSpec):
                  ssl_stapling_verify: Optional[str] = None,
                  ssl_protocols: Optional[List[str]] = None,
                  ssl_ciphers: Optional[List[str]] = None,
+                 enable_health_check_endpoint: bool = False,
                  preview_only: bool = False,
                  unmanaged: bool = False,
                  extra_container_args: Optional[GeneralArgList] = None,
@@ -1849,6 +1850,7 @@ class MgmtGatewaySpec(ServiceSpec):
         self.ssl_protocols = ssl_protocols
         #: List of supported secure SSL ciphers. Changing this list may reduce system security.
         self.ssl_ciphers = ssl_ciphers
+        self.enable_health_check_endpoint = enable_health_check_endpoint
 
     def get_port_start(self) -> List[int]:
         ports = []