Adding readiness/liveness probes to apt

This adds readiness and liveness probes to set daemonset to a non-ready status during dpkg usage

Change-Id: I5b9d029f1f8f696b4132a27ea29a77465babc29c
This commit is contained in:
SPEARS, DUSTIN (ds443n) 2022-10-18 16:01:00 -04:00
parent ebf0e22964
commit 7d533d65c3
5 changed files with 24 additions and 3 deletions

View File

@ -15,4 +15,4 @@
apiVersion: v1 apiVersion: v1
description: divingbell description: divingbell
name: divingbell name: divingbell
version: 0.1.1 version: 0.1.2

View File

@ -18,6 +18,8 @@
set -e set -e
rm -rf /tmp/done
cat <<'EOF' > {{ .Values.conf.chroot_mnt_path | quote }}/tmp/apt.sh cat <<'EOF' > {{ .Values.conf.chroot_mnt_path | quote }}/tmp/apt.sh
{{ include "divingbell.shcommon" . }} {{ include "divingbell.shcommon" . }}
@ -266,6 +268,8 @@ EOF
chmod 755 {{ .Values.conf.chroot_mnt_path | quote }}/tmp/apt.sh chmod 755 {{ .Values.conf.chroot_mnt_path | quote }}/tmp/apt.sh
chroot {{ .Values.conf.chroot_mnt_path | quote }} /tmp/apt.sh chroot {{ .Values.conf.chroot_mnt_path | quote }} /tmp/apt.sh
touch /tmp/done
while [ 1 ]; do while [ 1 ]; do
sleep 300 sleep 300
done done

View File

@ -14,6 +14,13 @@
# limitations under the License. # limitations under the License.
*/}} */}}
{{- define "readinessProbeTemplate" }}
exec:
command:
- cat
- /tmp/done
{{- end }}
{{- define "divingbell.daemonset.apt" }} {{- define "divingbell.daemonset.apt" }}
{{- $daemonset := index . 0 }} {{- $daemonset := index . 0 }}
{{- $secretName := index . 1 }} {{- $secretName := index . 1 }}
@ -51,6 +58,7 @@ spec:
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.apt | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }} {{ tuple $envAll $envAll.Values.pod.resources.apt | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
{{ dict "envAll" $envAll "application" "divingbell" "container" "apt" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 8 }} {{ dict "envAll" $envAll "application" "divingbell" "container" "apt" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 8 }}
{{ dict "envAll" $envAll "component" "divingbell" "container" "apt" "type" "readiness" "probeTemplate" (include "readinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 8 }}
command: command:
- /tmp/{{ $daemonset }}.sh - /tmp/{{ $daemonset }}.sh
volumeMounts: volumeMounts:

View File

@ -261,6 +261,15 @@ pod:
requests: requests:
memory: "128Mi" memory: "128Mi"
cpu: "100m" cpu: "100m"
probes:
divingbell:
apt:
readiness:
enabled: true
params:
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 120
network_policy: network_policy:
divingbell: divingbell:

View File

@ -56,9 +56,9 @@ author = u'Divingbell Authors'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = u'0.1.1' version = u'0.1.2'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = u'0.1.1' release = u'0.1.2'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.