ready¶
Check if a Kubernetes object exists and is ready.
Usage example¶
In the following example, the ready task checks if a deployment named httpbin-prod exists and its availability condition is set to true, and a service named httpbin exists.
helm upgrade --install \
--repo https://iter8-tools.github.io/iter8 --version 0.17 httpbin-test iter8 \
--set "tasks={ready,http}" \
--set ready.deploy=httpbin-prod \
--set ready.service=httpbin \
--set http.url=http://httpbin.default/get
Parameters¶
| Name | Type | Description |
|---|---|---|
| deploy | string | Name of a Kubernetes deployment. The task checks if the deployment exists and its Available condition is set to true. |
| service | string | Name of a Kubernetes service. The task checks if the service exists. |
| ksvc | string | Name of a Knative service. The task checks if the service exists and its Ready condition is set to true. |
| timeout | string | Timeout for readiness check to succeed. Default value is 60s. |
| namespace | string | The namespace under which to look for the Kubernetes objects. |
Extensions¶
Iter8 can be easily extended to support readiness checks for any type of Kubernetes object (including objects with custom resource types). Please consider submitting a pull request for such extensions. Readiness checking in Iter8 involves two templates, namely, task.ready and k.role. Extending the readiness checks to new resource types involves modifying these templates.
Example¶
Consider the Knative extension for this task; this extension enables Iter8 performance test authors to define a readiness check for Knative services. In the following example, the ready task succeed if the Knative service named httpbin exists, and has its Ready condition set to true.
helm upgrade --install \
--repo https://iter8-tools.github.io/iter8 --version 0.17 httpbin-test iter8 \
--set "tasks={ready,http}" \
--set ready.ksvc=httpbin \
--set http.url=http://httpbin.default/get
The task.ready and k.role were changed in the following ways to create this extension.
The group/version/resource (GVR) and the condition that should be checked for a Knative Service are defined in this template.
{{- if .Values.ready.ksvc }}
# task: determine if Knative Service exists and is ready
- task: ready
with:
name: {{ .Values.ready.ksvc | quote }}
group: serving.knative.dev
version: v1
resource: services
condition: Ready
{{- include "task.ready.tn" . }}
{{- end }}
The role named {{ .Release.Name }}-ready is extended with the Knative apiGroup.
{{- if .Values.ready.ksvc }}
- apiGroups: ["serving.knative.dev"]
resourceNames: [{{ .Values.ready.ksvc | quote }}]
resources: ["services"]
verbs: ["get"]
{{- end }}