Skip to content
Permalink
Browse files
Add configurable scheme for webserver probes (#22815)
* Add configurable scheme for webserver probes

- add scheme to webserver probes
- update values schema
- add unittest
  • Loading branch information
dan-vaughan committed Jul 4, 2022
1 parent c61f86d commit 34b2ed4066794368f9bcf96b7ccd5a70ee342639
Showing 4 changed files with 32 additions and 0 deletions.
@@ -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 }}
@@ -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"
}
}
},
@@ -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
@@ -101,6 +101,24 @@ def test_should_use_templated_base_url_for_probes(self):
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"}},

0 comments on commit 34b2ed4

Please sign in to comment.