This commit is contained in:
ston1th 2019-12-01 01:17:19 +01:00
commit 3f84766915

View file

@ -52,12 +52,11 @@ func main() {
},
UpdateFunc: func(_, obj interface{}) {
pvc, ok := obj.(*corev1.PersistentVolumeClaim)
owner := pvc.OwnerReferences
if !ok || pvc.DeletionTimestamp == nil || owner == nil {
if !ok || pvc.DeletionTimestamp == nil || pvc.OwnerReferences == nil {
return
}
if owner[0].APIVersion == "tekton.dev/v1alpha1" &&
owner[0].Kind == "PipelineRun" {
if pvc.OwnerReferences[0].APIVersion == "tekton.dev/v1alpha1" &&
pvc.OwnerReferences[0].Kind == "PipelineRun" {
pvs := cl.CoreV1().PersistentVolumes()
pv, err := pvs.Get(pvc.Spec.VolumeName, metav1.GetOptions{})
if err != nil {