<commit_before>#!/bin/bash -e

function kubectl::db_proxy_start () {
  if [[ ${kubernetes_db_proxy_enabled:-} == "true" ]]; then
    local proxy_pod
    proxy_pod=$(kubectl get pods --no-headers \
      --output=custom-columns=NAME:.metadata.name \
      --namespace tcp-proxy | head -n 1
    )
    echo "BIND ADDRESS: ${taito_db_proxy_bind_address:?}" > "${taito_vout:-}"
    taito::executing_start
    kubectl port-forward \
      "${proxy_pod}" \
      "${database_port:?}:${database_real_port:-5432}" \
      --address "${taito_db_proxy_bind_address}" \
      --namespace tcp-proxy > /dev/null &
    sleep 1
    if [[ $1 != "true" ]]; then
      wait
    else
      sleep 3
    fi
  fi
}

function kubectl::db_proxy_stop () {
  if [[ ${kubernetes_db_proxy_enabled:-} == "true" ]]; then<commit_msg>feat(kubectl): use db proxy instead of tcp proxy<commit_after>#!/bin/bash -e

function kubectl::db_proxy_start () {
  if [[ ${kubernetes_db_proxy_enabled:-} == "true" ]]; then
    proxy_namespace="db-proxy"
    proxy_instance="${database_instance:?}"

    # tcp-proxy still in use in old test zones (TODO: REMOVE)
    if [[ " gcloud-temp1 azure-test-256814 do-test-zone " == "${taito_zone:?}" ]]; then
      proxy_namespace="tcp-proxy"
      proxy_instance="tcp-proxy"
    fi

    local proxy_pod
    proxy_pod=$(kubectl get pods --no-headers \
      --output=custom-columns=NAME:.metadata.name \
      --namespace "${proxy_namespace}" | grep "${proxy_instance}" | head -n 1
    )
    echo "BIND ADDRESS: ${taito_db_proxy_bind_address:?}" > "${taito_vout:-}"
    taito::executing_start
    kubectl port-forward \
      "${proxy_pod}" \
      "${database_port:?}:${database_real_port:-5432}" \
      --address "${taito_db_proxy_bind_address}" \
      --namespace "${proxy_namespace}" > /dev/null &
    sleep 1
    if [[ $1 != "true" ]]; then
      wait
    else
      sleep 3
    fi
  fi
}

function kubectl::db_proxy_stop () {
  if [[ ${kubernetes_db_proxy_enabled:-} == "true" ]]; then
{'fraction_non_alphanumeric': 0.1665827881227982, 'fraction_numerical': 0.011575239053850024, 'mean_word_length': 3.0488798370672097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '3842811', 'n_tokens_mistral': 731, 'n_tokens_neox': 699, 'n_words': 135}