istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/test/framework/components/echo/cmd/echogen/README.md (about)

     1  # echogen
     2  
     3  `echogen` is a util for generating Kubernetes manifests from echo configurations.
     4  
     5  ## Overview
     6  
     7  ### Installation
     8  
     9  ```bash
    10  go install istio.io/istio/pkg/test/framework/components/echo/echogen
    11  ```
    12  
    13  ### Usage
    14  
    15  ```text
    16  echogen [opts] config.yaml
    17  ```
    18  
    19  The config file is YAML containing a list of
    20  [echo.Config](https://github.com/istio/istio/blob/master/pkg/test/framework/components/echo/config.go#L52) objects:
    21  
    22  ```yaml
    23  - Service: a
    24    Namespace: echo
    25  - Service: headless
    26    Namespace: echo
    27    Headless: true
    28  ```
    29  
    30  ### Options
    31  
    32  `echogen` supports all options from the test framework that would affect Echo deployments
    33  such as: `istio.test`, `.imagePullSecret`, `istio.test.hub` and several others.
    34  
    35  In addition to the framework level options:
    36  
    37  ```text
    38  -out <file>: Write output to the specified file
    39  -dir: If specified, each deployment will be written to a separate file, in a directory named by -out.
    40  ```
    41  
    42  ### Full Example with gRPC UI
    43  
    44  1. Make sure to install [gRPC UI](https://github.com/fullstorydev/grpcui) if you haven't already
    45  
    46  1. Create an `echogen` config:
    47  
    48  ```bash
    49  echo '
    50  - Service: a
    51    Namespace: echo
    52  - Service: b
    53    Namespace: echo
    54  ' > config.yaml
    55  ```
    56  
    57  1. Run `echogen`:
    58  
    59  ```bash
    60  echogen -out echo.yaml config.yaml
    61  ```
    62  
    63  1. Apply the manifest to the cluster
    64  
    65  ```bash
    66  kubectl apply -f echo.yaml
    67  ```
    68  
    69  1. Port-forward the gRPC port (default container port is 17070)
    70  
    71  ```bash
    72  kubectl -n echo port-forward a-v1-fc649d9fc-59rkj 17070
    73  ```
    74  
    75  1. Start gRPC UI
    76  
    77  ```bash
    78  grpcui -plaintext localhost:17070
    79  ```
    80  
    81  1. Because our echo gRPC service enables reflection, you should be able to open your browser
    82     and get a user interface that shows all of the possible methods and request options.
    83  
    84     Change the "Method name" to `ForwardEcho`, then in "Request Data" set `url` to `grpc://b:7070` then click `Invoke`
    85  
    86  1. (Bonus) If you open the "Raw Request (JSON)" tab, you can re-use that for requests via
    87     [grpcurl](https://github.com/fullstorydev/grpcurl) without constructing JSON by hand:
    88  
    89  ```bash
    90  grpcurl -plaintext localhost:17070 EchoTestService/ForwardEcho -d '{"url": "grpc://b:7070"}'
    91  ```