#!/bin/bash
clear

tput setaf 5
echo -e "\n*******************************************************************************************************************"
echo -e "Enabling auditing on the cluster"
echo -e "*******************************************************************************************************************"

echo -e "\n\n*******************************************************************************************************************"
echo -e "Step 1: Creating /var/log/k8s"
echo -e "*******************************************************************************************************************"
docker exec -ti cluster01-control-plane mkdir /var/log/k8s

echo -e "\n\n*******************************************************************************************************************"
echo -e "Step 2: Creating /etc/kubernetes/audit"
echo -e "*******************************************************************************************************************"
docker exec -ti cluster01-control-plane mkdir /etc/kubernetes/audit

tput setaf 5
echo -e "\n*******************************************************************************************************************"
echo -e "Step 3: Copying Kubernetes audit policy to API server"
echo -e "*******************************************************************************************************************"
docker cp cm/k8s-audit-policy.yaml cluster01-control-plane:/etc/kubernetes/audit/

tput setaf 3
echo -e "\n\n*******************************************************************************************************************"
echo -e "Initial setup complete."
echo -e "\nYou must edit your API manifest fil manually, follow the steps in chapter 7 to enable auditing"
echo -e "*******************************************************************************************************************\n"
tput setaf 2


