You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/07/05 00:00:00 UTC

[airflow] branch main updated: Add configurable scheme for webserver probes (#22815)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 34b2ed4066 Add configurable scheme for webserver probes (#22815)
34b2ed4066 is described below

commit 34b2ed4066794368f9bcf96b7ccd5a70ee342639
Author: Dan Vaughan <82...@users.noreply.github.com>
AuthorDate: Tue Jul 5 00:59:52 2022 +0100

    Add configurable scheme for webserver probes (#22815)
    
    * Add configurable scheme for webserver probes
    
    - add scheme to webserver probes
    - update values schema
    - add unittest
---
 chart/templates/webserver/webserver-deployment.yaml |  2 ++
 chart/values.schema.json                            | 10 ++++++++++
 chart/values.yaml                                   |  2 ++
 tests/charts/test_webserver.py                      | 18 ++++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml
index 8ef76bdcf9..c8d8e6ad15 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -199,6 +199,7 @@ spec:
                 - name: Host
                   value: {{ regexReplaceAll ":\\d+$" (urlParse (tpl .Values.config.webserver.base_url .)).host  "" }}
 {{- end }}
+              scheme: {{ .Values.webserver.livenessProbe.scheme | default "http" }}
             initialDelaySeconds: {{ .Values.webserver.livenessProbe.initialDelaySeconds | default 15 }}
             timeoutSeconds: {{ .Values.webserver.livenessProbe.timeoutSeconds | default 30 }}
             failureThreshold: {{ .Values.webserver.livenessProbe.failureThreshold | default 20 }}
@@ -212,6 +213,7 @@ spec:
                 - name: Host
                   value: {{ regexReplaceAll ":\\d+$" (urlParse (tpl .Values.config.webserver.base_url .)).host  "" }}
 {{- end }}
+              scheme: {{ .Values.webserver.readinessProbe.scheme | default "http" }}
             initialDelaySeconds: {{ .Values.webserver.readinessProbe.initialDelaySeconds | default 15 }}
             timeoutSeconds: {{ .Values.webserver.readinessProbe.timeoutSeconds | default 30 }}
             failureThreshold: {{ .Values.webserver.readinessProbe.failureThreshold | default 20 }}
diff --git a/chart/values.schema.json b/chart/values.schema.json
index bd0ac13dcf..f92c89b397 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -2527,6 +2527,11 @@
                             "description": "Webserver Liveness probe period seconds.",
                             "type": "integer",
                             "default": 5
+                        },
+                        "scheme": {
+                            "description": "Webserver Liveness probe scheme.",
+                            "type": "string",
+                            "default": "HTTP"
                         }
                     }
                 },
@@ -2554,6 +2559,11 @@
                             "description": "Webserver Readiness probe period seconds.",
                             "type": "integer",
                             "default": 5
+                        },
+                        "scheme": {
+                            "description": "Webserver Readiness probe scheme.",
+                            "type": "string",
+                            "default": "HTTP"
                         }
                     }
                 },
diff --git a/chart/values.yaml b/chart/values.yaml
index 44a40eebac..b311b7580f 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -842,12 +842,14 @@ webserver:
     timeoutSeconds: 30
     failureThreshold: 20
     periodSeconds: 5
+    scheme: HTTP
 
   readinessProbe:
     initialDelaySeconds: 15
     timeoutSeconds: 30
     failureThreshold: 20
     periodSeconds: 5
+    scheme: HTTP
 
   # Number of webservers
   replicas: 1
diff --git a/tests/charts/test_webserver.py b/tests/charts/test_webserver.py
index e7a84d1828..b15a50d181 100644
--- a/tests/charts/test_webserver.py
+++ b/tests/charts/test_webserver.py
@@ -101,6 +101,24 @@ class WebserverDeploymentTest(unittest.TestCase):
         assert "/mypath/RELEASE-NAME/path/health" == jmespath.search("livenessProbe.httpGet.path", container)
         assert "/mypath/RELEASE-NAME/path/health" == jmespath.search("readinessProbe.httpGet.path", container)
 
+    def test_should_add_scheme_to_liveness_and_readiness_probes(self):
+        docs = render_chart(
+            values={
+                "webserver": {
+                    "livenessProbe": {"scheme": "HTTPS"},
+                    "readinessProbe": {"scheme": "HTTPS"},
+                }
+            },
+            show_only=["templates/webserver/webserver-deployment.yaml"],
+        )
+
+        assert "HTTPS" in jmespath.search(
+            "spec.template.spec.containers[0].livenessProbe.httpGet.scheme", docs[0]
+        )
+        assert "HTTPS" in jmespath.search(
+            "spec.template.spec.containers[0].readinessProbe.httpGet.scheme", docs[0]
+        )
+
     def test_should_add_volume_and_volume_mount_when_exist_webserver_config(self):
         docs = render_chart(
             values={"webserver": {"webserverConfig": "CSRF_ENABLED = True"}},