func (s *azureSvc) GetAzureCredentials(host volume.VolumeHost, nameSpace, secretName, shareName string) (string, string, error) { var accountKey, accountName string kubeClient := host.GetKubeClient() if kubeClient == nil { return "", "", fmt.Errorf("Cannot get kube client") } keys, err := kubeClient.Core().Secrets(nameSpace).Get(secretName) if err != nil { return "", "", fmt.Errorf("Couldn't get secret %v/%v", nameSpace, secretName) } for name, data := range keys.Data { if name == "azurestorageaccountname" { accountName = string(data) } if name == "azurestorageaccountkey" { accountKey = string(data) } } if accountName == "" || accountKey == "" { return "", "", fmt.Errorf("Invalid %v/%v, couldn't extract azurestorageaccountname or azurestorageaccountkey", nameSpace, secretName) } return accountName, accountKey, nil }