<commit_before># How to start with Mako

This document describes how to start running writing benchmarks with mako on
GKE.

## Preconditions

- Assume cluster exists with istio lean and serving installed.
- ko is installed
- gcloud is installed

## Steps

Take `dataplane-probe` benchmark for example:

1. Apply
   [mako config](https://raw.githubusercontent.com/knative/serving/master/test/performance/config/config-mako.yaml)

   ```shell
   kubectl apply -f test/performance/config/config-mako.yaml
   ```

1. Create an IAM service account:

   ```shell
   gcloud iam service-accounts create mako-upload
   ```

1. Add the IAM service account
   [here](https://github.com/knative/serving/blob/47a3a2480d58ffcc1d3fd9998849fda359ab91ff/test/performance/dataplane-probe/dev.config#L19)
   (A current owner must apply this before things will work and the SA must be
   whitelisted) then run:

   ```shell
   mako update_benchmark test/performance/dataplane-probe/dev.config
   ```

1. Create a JSON key for it.

   ```shell
   gcloud iam service-accounts keys create robot.json \
     --iam-account=mako-upload@${PROJECT_<EMAIL>
   ```

1. Create a secret with it:

   ```shell
   kubectl create secret generic service-account --from-file=./robot.json
   ```

1. Patch istio:

   ```shell
   kubectl patch hpa -n istio-system istio-ingressgateway \
     --patch '{"spec": {"minReplicas": 10, "maxReplicas": 10}}'
   kubectl patch deploy -n istio-system cluster-local-gateway \
     --patch '{"spec": {"replicas": 10}}'
   ```

1. Patch knative:

   ```shell
   kubectl patch hpa -n knative-serving activator --patch '{"spec": {"minReplicas": 10}}'
   ```

1. Apply `setup` for benchmark:

   ```shell
   ko apply -f test/performance/dataplane-probe/dataplane-probe-setup.yaml
   ```

1. Wait for above to stabilize

1. Attach your desired tags to the runs by editing the config map, see the
   `_example` stanza for how.

    ```shell
    kubectl edit cm config-mako
    ```

1. Apply the benchmark cron:

   ```gcloud
   ko apply -f test/performance/dataplane-probe/dataplane-probe.yaml
   ```
<commit_msg>Format markdown (#5601)<commit_after># How to start with Mako

This document describes how to start running writing benchmarks with mako on
GKE.

## Preconditions

- Assume cluster exists with istio lean and serving installed.
- ko is installed
- gcloud is installed

## Steps

Take `dataplane-probe` benchmark for example:

1. Apply
   [mako config](https://raw.githubusercontent.com/knative/serving/master/test/performance/config/config-mako.yaml)

   ```shell
   kubectl apply -f test/performance/config/config-mako.yaml
   ```

1. Create an IAM service account:

   ```shell
   gcloud iam service-accounts create mako-upload
   ```

1. Add the IAM service account
   [here](https://github.com/knative/serving/blob/47a3a2480d58ffcc1d3fd9998849fda359ab91ff/test/performance/dataplane-probe/dev.config#L19)
   (A current owner must apply this before things will work and the SA must be
   whitelisted) then run:

   ```shell
   mako update_benchmark test/performance/dataplane-probe/dev.config
   ```

1. Create a JSON key for it.

   ```shell
   gcloud iam service-accounts keys create robot.json \
     --iam-account=mako-upload@${PROJECT_ID}.iam.gserviceaccount.com
   ```

1. Create a secret with it:

   ```shell
   kubectl create secret generic service-account --from-file=./robot.json
   ```

1. Patch istio:

   ```shell
   kubectl patch hpa -n istio-system istio-ingressgateway \
     --patch '{"spec": {"minReplicas": 10, "maxReplicas": 10}}'
   kubectl patch deploy -n istio-system cluster-local-gateway \
     --patch '{"spec": {"replicas": 10}}'
   ```

1. Patch knative:

   ```shell
   kubectl patch hpa -n knative-serving activator --patch '{"spec": {"minReplicas": 10}}'
   ```

1. Apply `setup` for benchmark:

   ```shell
   ko apply -f test/performance/dataplane-probe/dataplane-probe-setup.yaml
   ```

1. Wait for above to stabilize

1. Attach your desired tags to the runs by editing the config map, see the
   `_example` stanza for how.

   ```shell
   kubectl edit cm config-mako
   ```

1. Apply the benchmark cron:

   ```gcloud
   ko apply -f test/performance/dataplane-probe/dataplane-probe.yaml
   ```

{'fraction_non_alphanumeric': 0.11818825194621373, 'fraction_numerical': 0.0217032318943147, 'mean_word_length': 3.3666323377960867, 'pattern_counts': {'":': 14, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '203615', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1372, 'n_words': 420}