Skip to content

Checking readiness of Kubernetes resources

Many Iter8 experiments, like load-test-http, and load-test-grpc are intended to run inside a Kubernetes cluster and interact with Kubernetes resources. In such cases, it is useful to check the resources involved are ready at the beginning of the experiment, before other experiment tasks are executed. You can do this with various ready.* experiment parameters.

iter8 k -c load-test-http \
--set url=http://httpbin.default \
--set ready.deploy=httpbin

Currently, Iter8 provides native support for the following resource types:

  • Deployment: resource is ready if it exists and has the status condition Available set to True
  • Service: resource is ready if it exists

The option ready.timeout can be used to specify the maximum time that the experiment should wait for the readiness condition to be satisfied.

Readiness checking other resources

Iter8 can be extended to support readiness checking of additional resource types beyond deployments and services. Please consider submitting a pull request with new resource types.

In brief, the current implementation uses two templates task.ready and task.ready.rbac. To support a new type:

  • Modify task.ready to define the group/version/resource and, optionally, a condition that should be checked. For example, to add a readiness check for a Knative Service, the following might be added:

    {{- if .Values.ready.ksrv }}
    # task: determine if Knative Service is Ready
    - task: k8s-object-ready
      with:
        name: {{ .Values.ready.ksrv | quote }}
        group: serving.knative.dev
        version: v1
        resource: services
        condition: Ready
    {{- include "task.ready.tn" . | indent 4 }}
    {{ end }}
    

  • Add a new apiGroup to task.ready.rbac template for Role. For example:

    {{- if .Values.ready.ksrv }}
    - apiGroups: ["apps"]
      resourceNames: [{{ .Values.ready.ksrv | quote }}]
      resources: ["services"]
      verbs: ["get"]
    {{- end }}
    
Back to top