mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-25 03:21:15 +00:00
fix azure file migration panic
This commit is contained in:
parent
3eb90c19d0
commit
0d47999645
@ -119,9 +119,11 @@ func (t *azureFileCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume)
|
||||
accountName = azureSource.SecretName
|
||||
}
|
||||
resourceGroup := ""
|
||||
if pv.ObjectMeta.Annotations != nil {
|
||||
if v, ok := pv.ObjectMeta.Annotations[resourceGroupAnnotation]; ok {
|
||||
resourceGroup = v
|
||||
}
|
||||
}
|
||||
volumeID := fmt.Sprintf(volumeIDTemplate, resourceGroup, accountName, azureSource.ShareName, "")
|
||||
|
||||
var (
|
||||
@ -183,6 +185,9 @@ func (t *azureFileCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume)
|
||||
pv.Spec.CSI = nil
|
||||
pv.Spec.AzureFile = azureSource
|
||||
if resourceGroup != "" {
|
||||
if pv.ObjectMeta.Annotations == nil {
|
||||
pv.ObjectMeta.Annotations = map[string]string{}
|
||||
}
|
||||
pv.ObjectMeta.Annotations[resourceGroupAnnotation] = resourceGroup
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user