Skip to content

[Bug] Wait operation for not existing resource fails #2363

@pgmgb

Description

@pgmgb

chainsaw version Version

v0.2.12

Description

We use Kyverno to generate some RoleBinding's when a new namespace is created.
We would like to write some Chainsaw tests to ensure our process is working.
Because Kyverno needs a few seconds to create the RoleBinding's, we thought about using the wait operation. Unfortunately, it will fail directly without a retry. We try to avoid a static sleep.

- description: Wait for role binding 'namespace-admin'
  wait:
    for:
      jsonPath:
        path: '{.metadata.name}'
        value: "namespace-admin"
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    namespace: ($namespace)
    name: namespace-admin

Results in:

    | 17:43:51 | namespace | Create namespace                           | CMD       | RUN   |
        === COMMAND
        kubectl wait rolebindings.v1.rbac.authorization.k8s.io --for=jsonpath={.metadata.name}=namespace-admin namespace-admin -n chainsaw-personal-namespace --timeout 1m0s
    | 17:43:51 | namespace | Create namespace                           | CMD       | LOG   |
        === STDERR
        Error from server (NotFound): rolebindings.rbac.authorization.k8s.io "namespace-admin" not found
    | 17:43:51 | namespace | Create namespace                           | CMD       | ERROR |
        === ERROR
        exit status 1

Steps to reproduce

  1. Create a wait operation for a not existing resource

Expected behavior

The wait operation should use retry until the timeout is reached.

Screenshots

No response

Logs

Slack discussion

No response

Troubleshooting

  • I have searched other issues in this repository and mine is not recorded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions