#!/bin/bash

set -Eeuo pipefail

# https://cloud.yandex.ru/docs/managed-kubernetes/solutions/alb-ingress-controller#before-you-begin

# Uncomment what needed.
# Prod and preprod.
#export SA_MANE="yc.wall-e.ingress-controller-sa"
#export KEY_FILE_NAME="yc-walle-prod-ingress-controller-sa-key.json"
#export KEY_FILE_NAME="yc-walle-preprod-ingress-controller-sa-key.json"
# Testing.
export SA_MANE="yc.wall-e.ingress-controller-sa-testing"
export KEY_FILE_NAME="yc-walle-testing-ingress-controller-sa-key.json"

# Service accounts are created in Bootstrap Terraform.
yc iam key create \
   --service-account-id ${SA_MANE} \
   --output /tmp/${KEY_FILE_NAME}

echo "Save key in Yandex Vault and update README.md"
