Skip to content

Commit

Permalink
feat: Make startup probe configurable (#35)
Browse files Browse the repository at this point in the history
* feat: Make startup probe configurable

Signed-off-by: Yoep Kortekaas <[email protected]>

* chore: fix typo

Signed-off-by: Yoep Kortekaas <[email protected]>

* test: add test for startup probe

Signed-off-by: Yoep Kortekaas <[email protected]>

* chore: version bump after rebase

Signed-off-by: Yoep Kortekaas <[email protected]>

---------

Signed-off-by: Yoep Kortekaas <[email protected]>
  • Loading branch information
Kortekaasy authored Jan 25, 2024
1 parent 1bbca56 commit 6e4339c
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/zot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ appVersion: v2.0.1-rc1
description: A Helm chart for Kubernetes
name: zot
type: application
version: 0.1.43
version: 0.1.44
13 changes: 13 additions & 0 deletions charts/zot/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ spec:
- name: Authorization
value: Basic {{ .Values.authHeader }}
{{- end }}
startupProbe:
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
httpGet:
path: /v2/
port: 5000
scheme: {{ .Values.httpGet.scheme }}
{{- if .Values.authHeader }}
httpHeaders:
- name: Authorization
value: Basic {{ .Values.authHeader }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if or .Values.mountConfig .Values.mountSecret .Values.persistence .Values.externalSecrets (not (empty .Values.extraVolumes))}}
Expand Down
9 changes: 9 additions & 0 deletions charts/zot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ ingress:
# in configuration, to prevent failures, the scheme must be set to 'HTTPS'.
httpGet:
scheme: HTTP
# By default, Kubernetes considers a Pod healthy if the liveness probe returns
# successfully. However, sometimes applications need additional startup time on
# their first initialization. By defining a startupProbe, we can allow the
# application to take extra time for initialization without compromising fast
# response to deadlocks.
startupProbe:
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
# If mountConfig is true the configMap named $CHART_RELEASE-config is mounted
# on the pod's '/etc/zot' directory
mountConfig: false
Expand Down
23 changes: 23 additions & 0 deletions tests/ci/startup-probe/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
10 changes: 10 additions & 0 deletions tests/ci/startup-probe/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: default
description: Test chart for zot with startupProbe
type: application
version: 0.1.0
appVersion: "0.1.0"
dependencies:
- name: zot
version: ~0.1.44
repository: "file://../../../charts/zot"
24 changes: 24 additions & 0 deletions tests/ci/startup-probe/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
zot:
startupProbe:
initialDelaySeconds: 5
periodSeconds: 10
# Increase failure threshold to give Zot up to 5 minutes to start up
failureThreshold: 30

# Create and mount config that enables search/ui extension
mountConfig: true
configFiles:
config.json: |-
{
"storage": { "rootDirectory": "/var/lib/registry" },
"http": { "address": "0.0.0.0", "port": "5000" },
"log": { "level": "debug" },
"extensions": {
"search": {
"enable": true
},
"ui": {
"enable": true
}
}
}

0 comments on commit 6e4339c

Please sign in to comment.