Skip to content

Commit

Permalink
Make startup probes optional (#646)
Browse files Browse the repository at this point in the history
Co-authored-by: Yevhen Ivantsov <[email protected]>
  • Loading branch information
bianchi2 and Yevhen Ivantsov authored Aug 17, 2023
1 parent 430e0c8 commit fda4e2e
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/charts/bamboo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Kubernetes: `>=1.21.x-0`
| bamboo.setPermissions | bool | `true` | Boolean to define whether to set local home directory permissions on startup of Bamboo container. Set to 'false' to disable this behaviour. |
| bamboo.shutdown.command | string | `"/shutdown-wait.sh"` | By default pods will be stopped via a [preStop hook](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/), using a script supplied by the Docker image. If any other shutdown behaviour is needed it can be achieved by overriding this value. Note that the shutdown command needs to wait for the application shutdown completely before exiting; see [the default command](https://bitbucket.org/atlassian-docker/docker-bamboo-server/src/master/shutdown-wait.sh) for details. |
| bamboo.shutdown.terminationGracePeriodSeconds | int | `30` | The termination grace period for pods during shutdown. This should be set to the internal grace period, plus a small buffer to allow the JVM to fully terminate. |
| bamboo.startupProbe.enabled | bool | `true` | Whether to apply the startupProbe check to pod. |
| bamboo.startupProbe.failureThreshold | int | `120` | The number of consecutive failures of the Bamboo container startup probe before the pod fails startup checks. |
| bamboo.startupProbe.periodSeconds | int | `5` | How often (in seconds) the Bamboo container startup probe will run |
| bamboo.sysadminCredentials | object | `{"displayNameSecretKey":"displayName","emailAddressSecretKey":"emailAddress","passwordSecretKey":"password","secretName":null,"usernameSecretKey":"username"}` | The admin user configuration, and credentials that Bamboo should use. If supplied here the admin configuration will be skipped in the setup wizard. |
Expand Down
2 changes: 2 additions & 0 deletions src/main/charts/bamboo/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ spec:
failureThreshold: {{ .Values.bamboo.readinessProbe.failureThreshold }}
{{- end }}
{{- end }}
{{- if .Values.bamboo.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: {{ .Values.bamboo.ports.http }}
periodSeconds: {{ .Values.bamboo.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.bamboo.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.bamboo.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/bamboo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ bamboo:
#
startupProbe:

# -- Whether to apply the startupProbe check to pod.
#
enabled: true

# -- How often (in seconds) the Bamboo container startup probe will run
#
periodSeconds: 5
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/bitbucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Kubernetes: `>=1.21.x-0`
| bitbucket.sshService.loadBalancerIP | string | `nil` | Use specific loadBalancerIP. Only applies to service type LoadBalancer. |
| bitbucket.sshService.port | int | `22` | Port to expose the SSH service on. |
| bitbucket.sshService.type | string | `"LoadBalancer"` | SSH Service type |
| bitbucket.startupProbe.enabled | bool | `true` | Whether to apply the startupProbe check to pod. |
| bitbucket.startupProbe.failureThreshold | int | `120` | The number of consecutive failures of the Bitbucket container startup probe before the pod fails startup checks. |
| bitbucket.startupProbe.periodSeconds | int | `5` | How often (in seconds) the Bitbucket container startup probe will run |
| bitbucket.sysadminCredentials.displayNameSecretKey | string | `"displayName"` | The key in the Kubernetes Secret that contains the sysadmin display name |
Expand Down
2 changes: 2 additions & 0 deletions src/main/charts/bitbucket/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ spec:
failureThreshold: {{ .Values.bitbucket.readinessProbe.failureThreshold }}
{{- end }}
{{- end }}
{{- if .Values.bitbucket.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: {{ .Values.bitbucket.ports.http }}
periodSeconds: {{ .Values.bitbucket.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.bitbucket.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.bitbucket.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/bitbucket/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,10 @@ bitbucket:
#
startupProbe:

# -- Whether to apply the startupProbe check to pod.
#
enabled: true

# -- How often (in seconds) the Bitbucket container startup probe will run
#
periodSeconds: 5
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/confluence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Kubernetes: `>=1.21.x-0`
| confluence.setPermissions | bool | `true` | Boolean to define whether to set local home directory permissions on startup of Confluence container. Set to 'false' to disable this behaviour. |
| confluence.shutdown.command | string | `"/shutdown-wait.sh"` | By default pods will be stopped via a [preStop hook](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/), using a script supplied by the Docker image. If any other shutdown behaviour is needed it can be achieved by overriding this value. Note that the shutdown command needs to wait for the application shutdown completely before exiting; see [the default command](https://bitbucket.org/atlassian-docker/docker-atlassian-confluence-server/src/master/shutdown-wait.sh) for details. |
| confluence.shutdown.terminationGracePeriodSeconds | int | `25` | The termination grace period for pods during shutdown. This should be set to the Confluence internal grace period (default 20 seconds), plus a small buffer to allow the JVM to fully terminate. |
| confluence.startupProbe.enabled | bool | `true` | Whether to apply the startupProbe check to pod. |
| confluence.startupProbe.failureThreshold | int | `120` | The number of consecutive failures of the Confluence container startup probe before the pod fails startup checks. |
| confluence.startupProbe.periodSeconds | int | `5` | How often (in seconds) the Confluence container startup probe will run |
| confluence.tomcatConfig | object | `{"acceptCount":"10","connectionTimeout":"20000","customServerXml":"","debug":"0","enableLookups":"false","generateByHelm":false,"maxHttpHeaderSize":"8192","maxThreads":"100","mgmtPort":"8000","minSpareThreads":"10","port":"8090","protocol":"org.apache.coyote.http11.Http11NioProtocol","proxyInternalIps":null,"proxyName":null,"proxyPort":null,"redirectPort":"8443","scheme":null,"secure":null,"uriEncoding":"UTF-8"}` | By default Tomcat's server.xml is generated in the container entrypoint from a template shipped with an official Confluence image. However, server.xml generation may fail if container is not run as root, which is a common case if Confluence is deployed to OpenShift. |
Expand Down
2 changes: 2 additions & 0 deletions src/main/charts/confluence/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ spec:
failureThreshold: {{ .Values.confluence.readinessProbe.failureThreshold }}
{{- end }}
{{- end }}
{{- if .Values.confluence.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: {{ .Values.confluence.ports.http }}
periodSeconds: {{ .Values.confluence.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.confluence.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.confluence.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/confluence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@ confluence:
#
startupProbe:

# -- Whether to apply the startupProbe check to pod.
#
enabled: true

# -- How often (in seconds) the Confluence container startup probe will run
#
periodSeconds: 5
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/crowd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Kubernetes: `>=1.21.x-0`
| crowd.setPermissions | bool | `true` | Boolean to define whether to set local home directory permissions on startup of Crowd container. Set to 'false' to disable this behaviour. |
| crowd.shutdown.command | string | `"/shutdown-wait.sh"` | By default pods will be stopped via a [preStop hook](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/), using a script supplied by the Docker image. If any other shutdown behaviour is needed it can be achieved by overriding this value. Note that the shutdown command needs to wait for the application shutdown completely before exiting; see [the default command](https://bitbucket.org/atlassian-docker/docker-atlassian-crowd/src/master/shutdown-wait.sh) for details. |
| crowd.shutdown.terminationGracePeriodSeconds | int | `30` | The termination grace period for pods during shutdown. This should be set to the internal grace period, plus a small buffer to allow the JVM to fully terminate. |
| crowd.startupProbe.enabled | bool | `true` | Whether to apply the startupProbe check to pod. |
| crowd.startupProbe.failureThreshold | int | `120` | The number of consecutive failures of the Crowd container startup probe before the pod fails startup checks. |
| crowd.startupProbe.periodSeconds | int | `5` | How often (in seconds) the Crowd container startup probe will run |
| crowd.topologySpreadConstraints | list | `[]` | Defines topology spread constraints for Crowd pods. See details: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/ |
Expand Down
2 changes: 2 additions & 0 deletions src/main/charts/crowd/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ spec:
failureThreshold: {{ .Values.crowd.readinessProbe.failureThreshold }}
{{- end }}
{{- end }}
{{- if .Values.crowd.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: {{ .Values.crowd.ports.http }}
periodSeconds: {{ .Values.crowd.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.crowd.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.crowd.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/crowd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ crowd:

startupProbe:

# -- Whether to apply the startupProbe check to pod.
#
enabled: true

# -- How often (in seconds) the Crowd container startup probe will run
#
periodSeconds: 5
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/jira/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Kubernetes: `>=1.21.x-0`
| jira.setPermissions | bool | `true` | Boolean to define whether to set local home directory permissions on startup of Jira container. Set to 'false' to disable this behaviour. |
| jira.shutdown.command | string | `"/shutdown-wait.sh"` | By default pods will be stopped via a [preStop hook](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/), using a script supplied by the Docker image. If any other shutdown behaviour is needed it can be achieved by overriding this value. Note that the shutdown command needs to wait for the application shutdown completely before exiting; see [the default command](https://bitbucket.org/atlassian-docker/docker-atlassian-jira/src/master/shutdown-wait.sh) for details. |
| jira.shutdown.terminationGracePeriodSeconds | int | `30` | The termination grace period for pods during shutdown. This should be set to the internal grace period, plus a small buffer to allow the JVM to fully terminate. |
| jira.startupProbe.enabled | bool | `true` | Whether to apply the startupProbe check to pod. |
| jira.startupProbe.failureThreshold | int | `120` | The number of consecutive failures of the Jira container startup probe before the pod fails startup checks. |
| jira.startupProbe.periodSeconds | int | `5` | How often (in seconds) the Jira container startup probe will run |
| jira.tomcatConfig | object | `{"acceptCount":"10","connectionTimeout":"20000","customServerXml":"","enableLookups":"false","generateByHelm":false,"maxHttpHeaderSize":"8192","maxThreads":"100","mgmtPort":"8005","minSpareThreads":"10","port":"8080","protocol":"HTTP/1.1","proxyName":null,"proxyPort":null,"redirectPort":"8443","scheme":null,"secure":null}` | By default Tomcat's server.xml is generated in the container entrypoint from a template shipped with an official Jira image. However, server.xml generation may fail if container is not run as root, which is a common case if Jira is deployed to OpenShift. |
Expand Down
2 changes: 2 additions & 0 deletions src/main/charts/jira/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ spec:
failureThreshold: {{ .Values.jira.readinessProbe.failureThreshold }}
{{- end }}
{{- end }}
{{- if .Values.jira.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: {{ .Values.jira.ports.http }}
periodSeconds: {{ .Values.jira.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.jira.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.jira.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
Expand Down
6 changes: 5 additions & 1 deletion src/main/charts/jira/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ jira:
#
startupProbe:

# -- Whether to apply the startupProbe check to pod.
#
enabled: true

# -- How often (in seconds) the Jira container startup probe will run
#
periodSeconds: 5
Expand Down Expand Up @@ -848,7 +852,7 @@ monitoring:
#
dashboardLabels: {}
# grafana_dashboard: dc_monitoring

# -- Annotations added to Grafana dashboards ConfigMaps. See: https://github.com/kiwigrid/k8s-sidecar#usage
#
dashboardAnnotations: {}
Expand Down
23 changes: 23 additions & 0 deletions src/test/java/test/ReadinessLivenessProbesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,27 @@ void test_readiness_probe_custom_probe(Product product) throws Exception {
assertEquals("bar", resources.getStatefulSet(
product.getHelmReleaseName()).getContainer().get("readinessProbe").get("foo").asText());
}

@ParameterizedTest
@EnumSource(value = Product.class, names = {"bamboo_agent"}, mode = EnumSource.Mode.EXCLUDE)
void test_startup_probe_disabled(Product product) throws Exception {
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
product + ".startupProbe.enabled", "false"));

assertThat(resources.getStatefulSet(
product.getHelmReleaseName()).getContainer().get("startupProbe")).isEmpty();
}

@ParameterizedTest
@EnumSource(value = Product.class, names = {"bamboo_agent"}, mode = EnumSource.Mode.EXCLUDE)
void test_startup_probe_customized(Product product) throws Exception {
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
product + ".startupProbe.failureThreshold", "1200",
product + ".startupProbe.periodSeconds", "14"));

assertEquals("1200", resources.getStatefulSet(
product.getHelmReleaseName()).getContainer().get("startupProbe").get("failureThreshold").asText());
assertEquals("14", resources.getStatefulSet(
product.getHelmReleaseName()).getContainer().get("startupProbe").get("periodSeconds").asText());
}
}

0 comments on commit fda4e2e

Please sign in to comment.