changed spn method to service-principal

This commit is contained in:
Atharva Mulmuley
2021-05-11 17:24:45 +05:30
parent e64d948639
commit 05c41a0563
4 changed files with 47 additions and 9 deletions

View File

@ -11,8 +11,8 @@ const kubeconfig_timeout = 120;//timeout in seconds
export async function getArcKubeconfig(): Promise<string> {
try {
let method = core.getInput('method');
if (method != 'service-account' && method != 'SPN'){
throw Error("Supported methods for arc cluster are 'service-account' and 'SPN'.");
if (method != 'service-account' && method != 'service-principal'){
throw Error("Supported methods for arc cluster are 'service-account' and 'service-principal'.");
}
let resourceGroupName = core.getInput('resource-group');
@ -40,14 +40,14 @@ export async function getArcKubeconfig(): Promise<string> {
if(!saToken){
throw Error("'saToken' is not passed for 'service-account' method.")
}
console.log('using service account method for authenticating to arc cluster.')
console.log("using 'service-account' method for authenticating to arc cluster.")
const proc=spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath,'--token',saToken], {
detached: true,
stdio: 'ignore'
});
proc.unref();
} else{
console.log('using spn method for authenticating to arc cluster.')
console.log("using 'service-principal' method for authenticating to arc cluster.")
const proc=spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath], {
detached: true,
stdio: 'ignore'