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

Add JSON and JSONpath output for cilium API commands #1448

Closed
ianvernon opened this issue Aug 31, 2017 · 2 comments · Fixed by #1484
Closed

Add JSON and JSONpath output for cilium API commands #1448

ianvernon opened this issue Aug 31, 2017 · 2 comments · Fixed by #1484
Assignees
Labels
kind/enhancement This would improve or streamline existing functionality.
Milestone

Comments

@ianvernon
Copy link
Member

To make it easier to check for certain output in our APIs as part of our CI, we should add a flag to format the output of certain commands in JSON or JSONPath formats.

@ianvernon ianvernon added the kind/enhancement This would improve or streamline existing functionality. label Aug 31, 2017
@eloycoto
Copy link
Member

eloycoto commented Sep 5, 2017

Hey @ianvernon

If you provide a list of commands that you want I can do it tomorrow.

Regards

@tgraf tgraf added this to the 0.12 milestone Sep 5, 2017
@ianvernon
Copy link
Member Author

Per our convo on Slack:

cilium service list | get
cilium bpf tunnel list|get
cilium bpf endpoints
cilium bpf lb list
cilium identity list

#1463 will have to be merged before the work can be done for cilium identity list.

eloycoto added a commit to eloycoto/cilium that referenced this issue Sep 20, 2017
This commit updates some cmd commands, to support json output and
jsonpath queries. The example command output is the following:

```
$/home/ecoto# kubectl -n kube-system exec -ti cilium-fhcs4 -- cilium service list --json
[{"ID":1,"FrontendAddress":"10.96.0.10:53","BackendAddresses":["1 =\u003e 10.2.42.252:53"]},{"ID":2,"FrontendAddress":"10.96.0.1:443","BackendAddresses":["1 =\u003e 172.16.0.2:6443"]}]
$master:/home/ecoto# kubectl -n kube-system exec -ti cilium-fhcs4 -- cilium service list --jsonpath  '{[0].ID}'
1
```

- Two helpers functions were added:
    - AddJsonSupport: to enable both flags in the command definition.
    - DumpJson: function to dump the full json or execute the jsonPath query.
- Some cmd commands were refactoring to provide a consistent output to
  json and simple text.

- A new dependency was added: vendor/k8s.io/client-go/util/jsonpath/

This commit fixes cilium#1448

Signed-off-by: Eloy Coto <eloy.coto@gmail.com>
tgraf pushed a commit that referenced this issue Sep 20, 2017
This commit updates some cmd commands, to support json output and
jsonpath queries. The example command output is the following:

```
$/home/ecoto# kubectl -n kube-system exec -ti cilium-fhcs4 -- cilium service list --json
[{"ID":1,"FrontendAddress":"10.96.0.10:53","BackendAddresses":["1 =\u003e 10.2.42.252:53"]},{"ID":2,"FrontendAddress":"10.96.0.1:443","BackendAddresses":["1 =\u003e 172.16.0.2:6443"]}]
$master:/home/ecoto# kubectl -n kube-system exec -ti cilium-fhcs4 -- cilium service list --jsonpath  '{[0].ID}'
1
```

- Two helpers functions were added:
    - AddJsonSupport: to enable both flags in the command definition.
    - DumpJson: function to dump the full json or execute the jsonPath query.
- Some cmd commands were refactoring to provide a consistent output to
  json and simple text.

- A new dependency was added: vendor/k8s.io/client-go/util/jsonpath/

This commit fixes #1448

Signed-off-by: Eloy Coto <eloy.coto@gmail.com>
michi-covalent pushed a commit to michi-covalent/cilium that referenced this issue May 30, 2023
…k fix

cilium-cli uses the github.com/cilium/cilium/pkg/versioncheck package to
parse Cilium versions. In the latest version, this package was fixed to
allow parsing snapshot release versions, cf.
cilium#24286

For cilium#1448

Signed-off-by: Tobias Klauser <tobias@cilium.io>
michi-covalent pushed a commit to michi-covalent/cilium that referenced this issue May 30, 2023
Currently, installing snapshot version results in an error:

   $ cilium install --version v1.14.0-snapshot.0
   invalid parameters: invalid syntax "v1.14.0-snapshot.0" for image tag

Fix it by allowing dots in the part after the dash.

Fixes cilium#1448

Signed-off-by: Tobias Klauser <tobias@cilium.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This would improve or streamline existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants