Skip to content

Commit

Permalink
fix(kumactl): add --mesh parameter to inspect <policy> (#7696)
Browse files Browse the repository at this point in the history
This was missing up until now

Signed-off-by: Charly Molter <[email protected]>
  • Loading branch information
lahabana authored and kumahq[bot] committed Sep 7, 2023
1 parent 84d3ac0 commit 782b66f
Show file tree
Hide file tree
Showing 29 changed files with 751 additions and 16 deletions.
381 changes: 381 additions & 0 deletions app/kumactl/cmd/completion/testdata/bash.golden

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/kumactl/cmd/inspect/inspect_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func newInspectPolicyCmd(policyDesc core_model.ResourceTypeDescriptor, pctx *cmd
return tmpl.Execute(cmd.OutOrStdout(), entryList)
},
}
cmd.PersistentFlags().StringVarP(&pctx.Args.Mesh, "mesh", "m", "default", "mesh to use")
return cmd
}

Expand Down
17 changes: 15 additions & 2 deletions app/kumactl/cmd/inspect/inspect_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ import (
)

type testPolicyInspectClient struct {
response *api_server_types.PolicyInspectEntryList
ensureMesh string
response *api_server_types.PolicyInspectEntryList
}

func (t *testPolicyInspectClient) Inspect(ctx context.Context, policyDesc model.ResourceTypeDescriptor, mesh, name string) (*api_server_types.PolicyInspectEntryList, error) {
if t.ensureMesh != "" {
Expect(mesh).To(Equal(t.ensureMesh))
}
return t.response, nil
}

Expand All @@ -36,6 +40,7 @@ var _ = Describe("kumactl inspect POLICY", func() {
type testCase struct {
goldenFile string
serverResponseFile string
mesh string
cmdArgs []string
}
DescribeTable("kumactl inspect dataplane",
Expand All @@ -52,7 +57,8 @@ var _ = Describe("kumactl inspect POLICY", func() {

rootCtx.Runtime.NewPolicyInspectClient = func(client util_http.Client) resources.PolicyInspectClient {
return &testPolicyInspectClient{
response: entryList,
response: entryList,
ensureMesh: given.mesh,
}
}

Expand All @@ -73,6 +79,7 @@ var _ = Describe("kumactl inspect POLICY", func() {
Entry("inbound policy", testCase{
goldenFile: "inspect-traffic-permission.golden.txt",
serverResponseFile: "inspect-traffic-permission.server-response.json",
mesh: "default",
cmdArgs: []string{"inspect", "traffic-permission", "tp1"},
}),
Entry("outbound policy", testCase{
Expand All @@ -95,5 +102,11 @@ var _ = Describe("kumactl inspect POLICY", func() {
serverResponseFile: "inspect-traffic-trace.server-response.json",
cmdArgs: []string{"inspect", "traffic-trace", "tt1"},
}),
Entry("other-mesh", testCase{
goldenFile: "inspect-traffic-trace-other-mesh.golden.txt",
serverResponseFile: "inspect-traffic-trace-other-mesh.server-response.json",
mesh: "other-mesh",
cmdArgs: []string{"inspect", "traffic-trace", "tt1", "--mesh", "other-mesh"},
}),
)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Affected data plane proxies:

backend-1
web-1
redis-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"total": 1,
"items": [
{
"kind": "SidecarDataplane",
"dataplane": {
"mesh": "other-mesh",
"name": "backend-1"
},
"attachments": [
{
"type": "dataplane",
"name": "",
"service": ""
}
]
},
{
"kind": "SidecarDataplane",
"dataplane": {
"mesh": "other-mesh",
"name": "web-1"
},
"attachments": [
{
"type": "dataplane",
"name": "",
"service": ""
}
]
},
{
"kind": "SidecarDataplane",
"dataplane": {
"mesh": "other-mesh",
"name": "redis-1"
},
"attachments": [
{
"type": "dataplane",
"name": "",
"service": ""
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ kumactl inspect circuit-breaker NAME [flags]
### Options

```
-h, --help help for circuit-breaker
-h, --help help for circuit-breaker
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ kumactl inspect fault-injection NAME [flags]
### Options

```
-h, --help help for fault-injection
-h, --help help for fault-injection
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands
Expand Down
3 changes: 2 additions & 1 deletion docs/generated/cmd/kumactl/kumactl_inspect_healthcheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ kumactl inspect healthcheck NAME [flags]
### Options

```
-h, --help help for healthcheck
-h, --help help for healthcheck
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands
Expand Down
3 changes: 2 additions & 1 deletion docs/generated/cmd/kumactl/kumactl_inspect_meshaccesslog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ kumactl inspect meshaccesslog NAME [flags]
### Options

```
-h, --help help for meshaccesslog
-h, --help help for meshaccesslog
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands
Expand Down
33 changes: 33 additions & 0 deletions docs/generated/cmd/kumactl/kumactl_inspect_meshhealthcheck.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## kumactl inspect meshhealthcheck

Inspect MeshHealthCheck

### Synopsis

Inspect MeshHealthCheck.

```
kumactl inspect meshhealthcheck NAME [flags]
```

### Options

```
-h, --help help for meshhealthcheck
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands

```
--api-timeout duration the timeout for api calls. It includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout (default 1m0s)
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--no-config if set no config file and config directory will be created
-o, --output string output format: one of table|yaml|json (default "table")
```

### SEE ALSO

* [kumactl inspect](kumactl_inspect.md) - Inspect Kuma resources

33 changes: 33 additions & 0 deletions docs/generated/cmd/kumactl/kumactl_inspect_meshhttproute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## kumactl inspect meshhttproute

Inspect MeshHTTPRoute

### Synopsis

Inspect MeshHTTPRoute.

```
kumactl inspect meshhttproute NAME [flags]
```

### Options

```
-h, --help help for meshhttproute
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands

```
--api-timeout duration the timeout for api calls. It includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout (default 1m0s)
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--no-config if set no config file and config directory will be created
-o, --output string output format: one of table|yaml|json (default "table")
```

### SEE ALSO

* [kumactl inspect](kumactl_inspect.md) - Inspect Kuma resources

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## kumactl inspect meshloadbalancingstrategy

Inspect MeshLoadBalancingStrategy

### Synopsis

Inspect MeshLoadBalancingStrategy.

```
kumactl inspect meshloadbalancingstrategy NAME [flags]
```

### Options

```
-h, --help help for meshloadbalancingstrategy
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands

```
--api-timeout duration the timeout for api calls. It includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout (default 1m0s)
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--no-config if set no config file and config directory will be created
-o, --output string output format: one of table|yaml|json (default "table")
```

### SEE ALSO

* [kumactl inspect](kumactl_inspect.md) - Inspect Kuma resources

33 changes: 33 additions & 0 deletions docs/generated/cmd/kumactl/kumactl_inspect_meshproxypatch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## kumactl inspect meshproxypatch

Inspect MeshProxyPatch

### Synopsis

Inspect MeshProxyPatch.

```
kumactl inspect meshproxypatch NAME [flags]
```

### Options

```
-h, --help help for meshproxypatch
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands

```
--api-timeout duration the timeout for api calls. It includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout (default 1m0s)
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--no-config if set no config file and config directory will be created
-o, --output string output format: one of table|yaml|json (default "table")
```

### SEE ALSO

* [kumactl inspect](kumactl_inspect.md) - Inspect Kuma resources

33 changes: 33 additions & 0 deletions docs/generated/cmd/kumactl/kumactl_inspect_meshratelimit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## kumactl inspect meshratelimit

Inspect MeshRateLimit

### Synopsis

Inspect MeshRateLimit.

```
kumactl inspect meshratelimit NAME [flags]
```

### Options

```
-h, --help help for meshratelimit
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands

```
--api-timeout duration the timeout for api calls. It includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout (default 1m0s)
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--no-config if set no config file and config directory will be created
-o, --output string output format: one of table|yaml|json (default "table")
```

### SEE ALSO

* [kumactl inspect](kumactl_inspect.md) - Inspect Kuma resources

33 changes: 33 additions & 0 deletions docs/generated/cmd/kumactl/kumactl_inspect_meshretry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## kumactl inspect meshretry

Inspect MeshRetry

### Synopsis

Inspect MeshRetry.

```
kumactl inspect meshretry NAME [flags]
```

### Options

```
-h, --help help for meshretry
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands

```
--api-timeout duration the timeout for api calls. It includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout (default 1m0s)
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--no-config if set no config file and config directory will be created
-o, --output string output format: one of table|yaml|json (default "table")
```

### SEE ALSO

* [kumactl inspect](kumactl_inspect.md) - Inspect Kuma resources

33 changes: 33 additions & 0 deletions docs/generated/cmd/kumactl/kumactl_inspect_meshtcproute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## kumactl inspect meshtcproute

Inspect MeshTCPRoute

### Synopsis

Inspect MeshTCPRoute.

```
kumactl inspect meshtcproute NAME [flags]
```

### Options

```
-h, --help help for meshtcproute
-m, --mesh string mesh to use (default "default")
```

### Options inherited from parent commands

```
--api-timeout duration the timeout for api calls. It includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout (default 1m0s)
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--no-config if set no config file and config directory will be created
-o, --output string output format: one of table|yaml|json (default "table")
```

### SEE ALSO

* [kumactl inspect](kumactl_inspect.md) - Inspect Kuma resources

Loading

0 comments on commit 782b66f

Please sign in to comment.