mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-25 19:43:22 +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
|
accountName = azureSource.SecretName
|
||||||
}
|
}
|
||||||
resourceGroup := ""
|
resourceGroup := ""
|
||||||
|
if pv.ObjectMeta.Annotations != nil {
|
||||||
if v, ok := pv.ObjectMeta.Annotations[resourceGroupAnnotation]; ok {
|
if v, ok := pv.ObjectMeta.Annotations[resourceGroupAnnotation]; ok {
|
||||||
resourceGroup = v
|
resourceGroup = v
|
||||||
}
|
}
|
||||||
|
}
|
||||||
volumeID := fmt.Sprintf(volumeIDTemplate, resourceGroup, accountName, azureSource.ShareName, "")
|
volumeID := fmt.Sprintf(volumeIDTemplate, resourceGroup, accountName, azureSource.ShareName, "")
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -183,6 +185,9 @@ func (t *azureFileCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume)
|
|||||||
pv.Spec.CSI = nil
|
pv.Spec.CSI = nil
|
||||||
pv.Spec.AzureFile = azureSource
|
pv.Spec.AzureFile = azureSource
|
||||||
if resourceGroup != "" {
|
if resourceGroup != "" {
|
||||||
|
if pv.ObjectMeta.Annotations == nil {
|
||||||
|
pv.ObjectMeta.Annotations = map[string]string{}
|
||||||
|
}
|
||||||
pv.ObjectMeta.Annotations[resourceGroupAnnotation] = resourceGroup
|
pv.ObjectMeta.Annotations[resourceGroupAnnotation] = resourceGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user