Fixing AKS creation failure
When the capz.kubeconfig file was missing, the creation of AKS cluster by the bootstrap container would fail when retrieving its kubeconfig file. The issue was that the container tries to delete an existing kubeconfig file and would fail if it didn't exist. The fix was to check if the kubeconfig file existed prior to deleting it. Change-Id: Ibf135a11ae1928fc69c35cacdf0e1339629027f2
This commit is contained in:
parent
3ad2f936c4
commit
a13dbd0dd1
@ -136,11 +136,14 @@ func prepareAKSCluster(azConfig *AzureConfig, isCreate bool) error {
|
||||
kubeconfig := dstMount + "/" + kubeconfigFile
|
||||
|
||||
// Delete existing Kubeconfig file, if any
|
||||
_, err = os.Stat(kubeconfig)
|
||||
if err == nil {
|
||||
err = os.Remove(kubeconfig)
|
||||
if err != nil {
|
||||
log.Printf("Failed to remove existing kubeconfig file %s.\n", kubeconfig)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieving the Kubeconfig file for the cluster
|
||||
err = execute(az, aks, getCredentials,
|
||||
|
Loading…
Reference in New Issue
Block a user