Skip to content

Commit

Permalink
feat(agent): add support for new agent readiness probe (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
aroberts87 authored Nov 29, 2023
1 parent 05748e0 commit 5ec0270
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ sources:
- https://app.sysdigcloud.com/#/settings/user
- https://github.com/draios/sysdig
type: application
version: 1.17.0
version: 1.17.1
3 changes: 2 additions & 1 deletion charts/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ The following table lists the configurable parameters of the Sysdig chart and th
| `daemonset.affinity` | Specifies node affinities. Overrides `daemonset.arch` and `daemonset.os` values. | `{}` |
| `daemonset.annotations` | Specifies the custom annotations for daemonset. | `{}` |
| `daemonset.labels` | Specifies the custom labels for daemonset as a multi-line templated string map or as YAML. | |
| `daemonset.probes.initialDelay` | Specifies the initial delay for liveness and readiness probes daemonset. | `{}` |
| `daemonset.probes.initialDelay` | Specifies the initial delay for the deamonset readiness probe. | `90` |
| `daemonset.probes.periodDelay` | Specifies the period delay for the daemonset readiness probe. | `3` |
| `daemonset.kmodule.env` | Sets the environment variables for the kernel module image builder. Provide as map of `VAR: val` | `{}` |
| `slim.enabled` | Uses the slim based Sysdig Agent image. | `true` |
| `slim.image.repository` | Specifies the slim agent image repository. | `sysdig/agent-slim` |
Expand Down
7 changes: 7 additions & 0 deletions charts/agent/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,16 @@ spec:
value: /opt/draios/etc/ca-certs/{{- include "sysdig.custom_ca.keyName" (dict "global" .Values.global.ssl "component" .Values.ssl) -}}
{{- end }}
readinessProbe:
{{- if ge (semver "12.18.0" | (semver .Values.image.tag).Compare) 0 }}
httpGet:
path: /healthz
port: 24483
{{- else }}
exec:
command: [ "test", "-e", "/opt/draios/logs/running" ]
{{- end }}
initialDelaySeconds: {{ .Values.daemonset.probes.initialDelay }}
periodSeconds: {{ .Values.daemonset.probes.periodDelay }}
volumeMounts:
{{- if .Values.localForwarder.enabled }}
- mountPath: /opt/draios/etc/local_forwarder_config.yaml
Expand Down
9 changes: 8 additions & 1 deletion charts/agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,16 @@ spec:
value: /opt/draios/etc/ca-certs/{{- include "sysdig.custom_ca.keyName" (dict "global" .Values.global.ssl "component" .Values.ssl) -}}
{{- end }}
readinessProbe:
{{- if ge (semver "12.18.0" | (semver .Values.image.tag).Compare) 0 }}
httpGet:
path: /healthz
port: 24483
{{- else }}
exec:
command: [ "test", "-e", "/opt/draios/logs/running" ]
failureThreshold: 3
{{- end }}
initialDelaySeconds: {{ .Values.delegatedAgentDeployment.deployment.probes.initialDelay }}
periodSeconds: {{ .Values.delegatedAgentDeployment.deployment.probes.periodDelay }}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
Expand Down
115 changes: 115 additions & 0 deletions charts/agent/tests/readiness_probe_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
suite: Test the Readiness Probe Configuration
templates:
- templates/daemonset.yaml
- templates/deployment.yaml
tests:
- it: "[DaemonSet] Readiness Probe (agent > 12.18.0)"
set:
image:
tag: 12.18.1
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
httpGet:
path: /healthz
port: 24483
initialDelaySeconds: 90
periodSeconds: 3
template: templates/daemonset.yaml
- it: "[DaemonSet] Readiness Probe (agent == 12.18.0)"
set:
image:
tag: 12.18.0
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
httpGet:
path: /healthz
port: 24483
initialDelaySeconds: 90
periodSeconds: 3
template: templates/daemonset.yaml
- it: "[DaemonSet] Readiness Probe (agent < 12.18.0)"
set:
image:
tag: 12.16.3
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
exec:
command:
- test
- -e
- /opt/draios/logs/running
initialDelaySeconds: 90
periodSeconds: 3
template: templates/daemonset.yaml
- it: "[DelegatedAgentDeployment] Readiness Probe (agent > 12.18.0)"
set:
delegatedAgentDeployment:
enabled: true
image:
tag: 12.18.1
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
httpGet:
path: /healthz
port: 24483
initialDelaySeconds: 90
periodSeconds: 3
- it: "[DelegatedAgentDeployment] Readiness Probe (agent == 12.18.0)"
set:
delegatedAgentDeployment:
enabled: true
image:
tag: 12.18.0
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
httpGet:
path: /healthz
port: 24483
initialDelaySeconds: 90
periodSeconds: 3
- it: "[DelegatedAgentDeployment] Readiness Probe (agent < 12.18.0)"
set:
delegatedAgentDeployment:
enabled: true
image:
tag: 12.16.3
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
exec:
command:
- test
- -e
- /opt/draios/logs/running
initialDelaySeconds: 90
periodSeconds: 3
- it: Test setting probe delays
set:
daemonset:
probes:
initialDelay: 5
periodDelay: 3
delegatedAgentDeployment:
deployment:
probes:
initialDelay: 5
periodDelay: 3
enabled: true
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe.initialDelaySeconds
value: 5
- equal:
path: spec.template.spec.containers[0].readinessProbe.periodSeconds
value: 3
7 changes: 6 additions & 1 deletion charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ daemonset:
annotations: {}
# Allow the DaemonSet to set labels
labels: {}
# Liveness and readiness probes initial delay (in seconds)
# readiness probe delays
probes:
initialDelay: 90
periodDelay: 3
kmodule:
env: {}
# If is behind a proxy you can set the proxy server
Expand Down Expand Up @@ -305,6 +306,10 @@ delegatedAgentDeployment:
os:
- linux
labels: {}
# readiness probes delays
probes:
initialDelay: 90
periodDelay: 3
progressDeadlineSeconds: 600
replicas: 1
resources:
Expand Down

0 comments on commit 5ec0270

Please sign in to comment.