Skip to content

Commit

Permalink
Recognize pods that use Longhorn generic ephemeral volumes
Browse files Browse the repository at this point in the history
Longhorn 8198

Signed-off-by: Eric Weber <eric.weber@suse.com>
  • Loading branch information
ejweber authored and innobead committed Mar 19, 2024
1 parent be11202 commit 3f99a66
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controller/kubernetes_pv_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,12 @@ func (kc *KubernetesPVController) getAssociatedPods(ks *longhorn.KubernetesStatu
if v.PersistentVolumeClaim != nil && v.PersistentVolumeClaim.ClaimName == ks.PVCName {
return true
}
// Generic ephemeral volumes have an Ephemeral section instead of a PersistentVolumeClaim section. The name
// of the PersistentVolumeClaim associated with a generic ephemeral volume is deterministic:
// https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#persistentvolumeclaim-naming.
if v.Ephemeral != nil && fmt.Sprintf("%s-%s", pod.Name, v.Name) == ks.PVCName {
return true
}
}
return false
})
Expand Down

0 comments on commit 3f99a66

Please sign in to comment.