Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework label selector and resource identifier type #3

Merged
merged 3 commits into from
Aug 15, 2023
Merged

Conversation

jaypipes
Copy link
Member

This introduces a breaking API change

Previously, the following YAML was used to select (or delete) resources
in a gdt-kube test spec:

tests:
 - kube.get: pods
   with:
     labels:
       app: nginx

This functionality has been changed to use the following format instead:

tests:
 - kube:
     get:
       type: pods
       labels:
         app: nginx

or using the kube.get shortcut, like so:

tests:
 - kube.get:
     type: pods
       labels:
         app: nginx

This was changed in order to better accomodate additional Kubernetes
actions coming in future PRs, including logs and exec actions, as
well as to standardize the parsing of resource identifiers and label
selectors.

reworks the parsing of the KubeSpec struct and identifying parse errors
earlier (along with a line/column for the failure of `With` struct
parsing).

Signed-off-by: Jay Pipes <[email protected]>
Introducing the `on.fail` field for the kube gdt plugin involves parsing
a kubernetes action (get, create, apply, etc) separate from the main
`kube` field in the KubeSpec. So, in this patch we separate out the
Action and then embed the Action struct inside the KubeSpec, separating
out the parsing of the Action struct.

Signed-off-by: Jay Pipes <[email protected]>
**This introduces a breaking API change**

Previously, the following YAML was used to select (or delete) resources
in a `gdt-kube` test spec:

```yaml
tests:
 - kube.get: pods
   with:
     labels:
       app: nginx
```

This functionality has been changed to use the following format instead:

```yaml
tests:
 - kube:
     get:
       type: pods
       labels:
         app: nginx
```

or using the `kube.get` shortcut, like so:

```yaml
tests:
 - kube.get:
     type: pods
       labels:
         app: nginx
```

This was changed in order to better accomodate additional Kubernetes
actions coming in future PRs, including `logs` and `exec` actions, as
well as to standardize the parsing of resource identifiers and label
selectors.

Signed-off-by: Jay Pipes <[email protected]>
@jaypipes jaypipes requested a review from a-hilaly August 14, 2023 21:58
Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!
/lgtm

@a-hilaly a-hilaly merged commit 0190c8b into main Aug 15, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants