The Cloud Consumption Interface (CCI), Local Consumption Interface (LCI), or Consumption Interface (CI?). I have seen it referred to my several names, but at the time of writing the documentation says it’s CCI. Whatever it’s name, it’s a layer that provides an integration between VCF Automation and the Supervisor in vSphere.
Unsuprisingly it has its own plugin for kubectl. And like the one for vSphere it’s not great for the lazy typists amongst us. Even more so in this case because authentication requires a refresh token from VCF Automation so it’s a two-step process.
If you’ve seen my previous post where I created a profile function to help with using the vSphere plugin for kubectl, then it’ll come as no surprise that you can do the same thing for CCI!
So, instead of having to run a curl command to get a token and then supply it to the CCI plugin, you could use the following in your .zshrc (or other) profile to simplify the process:
alias k="kubectl"
export ADM="[email protected]"
export ME="[email protected]"
kcci() {
case $# in
0)
echo "Help for 'kcci':"
echo ""
echo " This function is a shortcut for performing a kubectl cci login. It expects the following positional parameters:"
echo " user - the username used to login"
echo ""
;;
1)
echo -n Password:
read -s password
refreshtoken=$(curl -X POST "https://automation.lab.mpoore.io/csp/gateway/am/api/login?access_token" -H "Content-Type: application/json" -H "Accept: application/json" -d "{\"username\": \"$1\",\"password\": \"$password\"}" | jq -r .refresh_token)
kubectl cci login -t $refreshtoken --server automation.lab.mpoore.io --insecure-skip-tls-verify
;;
*)
echo "WARNING!! Too many arguments supplied!"
echo ""
kcci
;;
esac
}
As with the vSphere example, using it is easy:
kcci $ADM
Just provide the password when prompted and you’re in!!!