Use this rule to control that the YAML documents do contain a required key. Parameters can be defined as a regular expression.

Parameters

parent-key-name
Regular expression that matches prerequisite key name
parent-key-value
Regular expression that matches the value for the prerequisite key name
parent-key-name-root
Filter only root keys for the parent-key-name | yes | not | anywhere
required-key-name
Regular expression that matches the required key name for the key-name

Examples

With parent-key-name = kind and parent-key-value = Pod and parent-key-name-root = yes and required-key-name = readinessProbe the following code snippet would PASS:

    apiVersion: v1
    kind: Pod
    metadata:
        labels:
            test: liveness
        name: liveness-http
    spec:
        containers:
            - name: liveness
                image: k8s.gcr.io/liveness
                args:
                - /server
                readinessProbe:
                    httpGet:
                        path: /healthz
                        port: 8080
                        httpHeaders:
                        - name: Custom-Header
                        value: Awesome
                    initialDelaySeconds: 3
                    periodSeconds: 3

the following code snippets would FAIL:

    apiVersion: v1
    kind: Pod
    metadata:
        labels:
            test: liveness
        name: liveness-http
    spec:
        containers:
            - name: liveness
                image: k8s.gcr.io/liveness
                args:
                    - /server
                initialDelaySeconds: 3
                periodSeconds: 3