#!/bin/sh

# This script patches the kubeconfig generated by Kind in order to access the cluster container via this container

echo "Patching Kubeconfig to target Kube container without link"
CONTROL_PLANE_IP=`docker inspect -f '{{(index .NetworkSettings.Networks "authelia_authelianet").IPAddress}}' kind-control-plane`
sed -i "s/127.0.0.1:.*/$CONTROL_PLANE_IP:6443/" `kind get kubeconfig-path --name="kind"`